tix-tracker 0.12.0

A terminal issue tracker: markdown + YAML frontmatter issues with a kanban TUI and CLI
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
use std::io::IsTerminal;
use std::path::Path;
use std::process::Command;

use crate::config::Config;
use crate::error::{Result, TixError};
use crate::model::Issue;

/// Read a single line from TTY with basic readline-style editing.
///
/// This replaces `std::io::stdin().read_line` for interactive prompts so
/// common editing shortcuts (Ctrl-A/E, arrows, delete/backspace) work.
pub fn read_tty_line(prompt: &str) -> Result<String> {
    if !std::io::stdin().is_terminal() {
        return Err(TixError::InvalidInput(
            "interactive input requires a TTY; pass an explicit argument instead".into(),
        ));
    }

    use reedline::{DefaultPrompt, DefaultPromptSegment, Reedline, Signal};

    let mut line_editor = Reedline::create();
    let prompt = DefaultPrompt::new(
        DefaultPromptSegment::Basic(prompt.to_string()),
        DefaultPromptSegment::Empty,
    );

    match line_editor.read_line(&prompt) {
        Ok(Signal::Success(input)) => Ok(input.trim().to_string()),
        Ok(Signal::CtrlC) | Ok(Signal::CtrlD) => {
            Err(TixError::InvalidInput("input cancelled".into()))
        }
        Err(e) => Err(TixError::Editor(format!("failed to read tty line: {e}"))),
    }
}

pub struct FieldEdits {
    pub title: Option<String>,
    pub status: Option<String>,
    pub priority: Option<String>,
    pub labels: Option<Vec<String>>,
    pub files: Option<Vec<String>>,
    /// General cross-repository references, replacing the whole list when
    /// present (`Some(vec![])` clears). Free-form strings, stored verbatim.
    pub related_issues: Option<Vec<String>>,
    /// Issue type. `Some(None)` clears it, `Some(Some(v))` sets it; absent leaves
    /// it untouched.
    pub type_: Option<Option<String>>,
    pub assignee: Option<Option<String>>,
    pub estimate: Option<Option<String>>,
    pub commit: Option<Option<String>>,
    pub cycles: Option<Option<Vec<String>>>,
    pub milestones: Option<Option<Vec<String>>>,
    pub reviewer: Option<Option<String>>,
    pub start_date: Option<Option<String>>,
    pub due_date: Option<Option<String>>,
    /// The decomposition parent, as a **resolved canonical issue reference**.
    ///
    /// `Some(None)` clears it, mirroring `assignee` and every other optional field:
    /// an absent flag leaves it untouched, `--parent ""` removes it.
    ///
    /// A canonical id, never a selector, because a title is not stable and a stored title
    /// would silently break every child on a retitle. Resolution happens in
    /// [`crate::commands::edit`] against the store, which `merge_fields` has no
    /// access to.
    ///
    /// **Out of map for WP03** (`src/editor.rs` is in no WP's `owned_files`; see tix
    /// #1374). The field lives here, rather than as a separate parameter, because
    /// that is exactly what `assignee` does: the value is merged so the merge stays
    /// uniform, and the side effect `merge_fields` cannot perform — here validating
    /// through the hierarchy service and appending the History event — happens
    /// around it in the caller. The alternative, a second write path in `edit` that
    /// bypasses the merge, is what `assignee`'s precedent argues against.
    pub parent: Option<Option<crate::id::IssueRef>>,
}

pub fn resolve_editor(pref: Option<&str>) -> Result<String> {
    resolve_editor_with_env(
        pref,
        std::env::var("EDITOR").ok(),
        std::env::var("VISUAL").ok(),
    )
}

pub fn resolve_agent(pref: Option<&str>) -> Result<String> {
    resolve_editor_with_env(
        pref,
        std::env::var("TIX_AGENT")
            .ok()
            .or_else(|| std::env::var("AGENT").ok()),
        std::env::var("VISUAL").ok(),
    )
}

fn resolve_editor_with_env(
    pref: Option<&str>,
    editor: Option<String>,
    visual: Option<String>,
) -> Result<String> {
    if let Some(e) = pref
        && !e.is_empty()
    {
        return Ok(e.to_string());
    }
    if let Some(e) = editor.filter(|v| !v.is_empty()) {
        return Ok(e);
    }
    if let Some(e) = visual.filter(|v| !v.is_empty()) {
        return Ok(e);
    }
    let fallbacks: &[&str] = if cfg!(target_os = "windows") {
        &["cmd", "nano", "vi"]
    } else {
        &["editor", "nano", "vi"]
    };
    for name in fallbacks {
        if which(name) {
            return Ok(name.to_string());
        }
    }
    Err(TixError::Editor("no editor found".into()))
}

/// Run the editor on `path` and wait for it.
///
/// This runs the editor and nothing else (tix #1506). It deliberately does
/// **not** validate the result: the old trailing `Issue::parse` threw the real
/// diagnostic away and replaced it with `file not valid after edit`, so the
/// caller could not tell a duplicate key from a missing fence. Callers parse the
/// copy themselves and classify what came back with [`crate::edit_problems`],
/// which is where a problem's fix lives.
pub fn run_editor(editor: &str, path: &Path, _config: &Config) -> Result<()> {
    let status = Command::new(editor)
        .arg(path)
        .status()
        .map_err(|e| TixError::Editor(format!("failed to launch {editor}: {e}")))?;
    if !status.success() {
        return Err(TixError::Editor(format!(
            "editor {editor} exited with {status}"
        )));
    }
    Ok(())
}

/// The auto viewer probe chain, in the order tix tries the programs (tix #1507).
///
/// `mdterm` first because it is the tool built for this — a read-only markdown
/// pager. `batcat` is Debian's name for `bat`, and `most`/`less`/`more` are the
/// pagers nearly every system ships one of.
pub const VIEWER_CANDIDATES: &[&str] = &["mdterm", "batcat", "most", "less", "more"];

/// Resolve the read-only viewer used by the TUI's `v` key (tix #1507).
///
/// An explicit, non-`auto` preference wins. `None`, `Some("auto")`, and a
/// whitespace-only value are the probe chain; a whitespace-only value is an
/// error rather than a silent fallback, because the way to ask for the chain is
/// `auto` (or omitting the key).
///
/// The `auto` probe result is cached for the process, so a surface that renders
/// the resolved name does not spawn `which` on every frame.
pub fn resolve_viewer(pref: Option<&str>) -> Result<String> {
    static AUTO_VIEWER: std::sync::LazyLock<Option<String>> = std::sync::LazyLock::new(|| {
        VIEWER_CANDIDATES
            .iter()
            .find(|name| which(name))
            .map(|name| (*name).to_string())
    });
    resolve_viewer_with(pref, |name| AUTO_VIEWER.as_deref() == Some(name))
}

/// [`resolve_viewer`] with the PATH probe injected, so the ordering, the
/// override, and the none-found error are testable without the host's PATH.
pub fn resolve_viewer_with(pref: Option<&str>, probe: impl Fn(&str) -> bool) -> Result<String> {
    if let Some(name) = explicit_viewer(pref)? {
        return Ok(name);
    }
    VIEWER_CANDIDATES
        .iter()
        .find(|name| probe(name))
        .map(|name| (*name).to_string())
        .ok_or_else(no_viewer_error)
}

/// The trimmed explicit viewer, or `None` when the preference means "auto".
///
/// Errors on a whitespace-only preference: it is neither a usable program nor a
/// request for the chain, so guessing at the user's intent would be worse than
/// saying so.
fn explicit_viewer(pref: Option<&str>) -> Result<Option<String>> {
    match pref {
        None => Ok(None),
        Some(raw) => {
            let name = raw.trim();
            if name.is_empty() {
                return Err(TixError::Editor(
                    "`viewer` must not be blank; use `auto` for the default chain".into(),
                ));
            }
            if name == "auto" {
                Ok(None)
            } else {
                Ok(Some(name.to_string()))
            }
        }
    }
}

fn no_viewer_error() -> TixError {
    TixError::Editor(format!(
        "no viewer found: install one of {} (or set `viewer` in tix.toml)",
        VIEWER_CANDIDATES.join(", ")
    ))
}

/// Run a read-only viewer on `path`, with inherited stdio and a wait.
///
/// Mirrors [`run_editor`]'s mechanics — same inherited terminal, same wait — but
/// strictly read-only: no temp file, no read-back, no write. A **non-zero exit
/// is not an error**: a pager exits non-zero on an ordinary quit, so reporting
/// that would turn every close into a failure message. Only a spawn failure is
/// an error.
pub fn run_viewer(viewer: &str, path: &Path) -> Result<()> {
    Command::new(viewer)
        .arg(path)
        .status()
        .map_err(|e| TixError::Editor(format!("failed to launch {viewer}: {e}")))?;
    Ok(())
}

pub fn merge_fields(issue: &Issue, edits: &FieldEdits) -> Issue {
    let mut result = issue.clone();
    if let Some(ref title) = edits.title {
        result.title = title.clone();
    }
    if let Some(ref status) = edits.status {
        result.status = crate::model::Status::new(status);
    }
    if let Some(ref priority) = edits.priority {
        result.priority = priority.parse().unwrap_or_default();
    }
    if let Some(ref labels) = edits.labels {
        result.labels = labels.clone();
    }
    if let Some(ref files) = edits.files {
        result.files = files.clone();
    }
    if let Some(related_issues) = &edits.related_issues {
        result.related_issues = related_issues.clone();
    }
    if let Some(t) = &edits.type_ {
        result.type_ = t.clone();
    }
    if let Some(ref assignee) = edits.assignee {
        result.assignee = assignee.clone();
    }
    if let Some(ref estimate) = edits.estimate {
        result.estimate = estimate.clone();
    }
    if let Some(ref commit) = edits.commit {
        result.commit = commit.clone();
    }
    if let Some(ref cycles) = edits.cycles {
        result.cycles = cycles.clone();
    }
    if let Some(ref milestones) = edits.milestones {
        result.milestones = milestones.clone();
    }
    if let Some(ref reviewer) = edits.reviewer {
        result.reviewer = reviewer.clone();
    }
    if let Some(ref start_date) = edits.start_date {
        result.start_date = start_date.clone();
    }
    if let Some(ref due_date) = edits.due_date {
        result.due_date = due_date.clone();
    }
    if let Some(ref parent) = edits.parent {
        result.parent = *parent;
    }
    result
}

fn which(name: &str) -> bool {
    let output = Command::new("which")
        .arg(name)
        .output()
        .map(|o| o.status.success());
    output.unwrap_or(false)
}

#[cfg(test)]
mod tests {
    #[allow(clippy::wildcard_imports)]
    use super::*;
    use crate::model::{Priority, Status};
    use std::fs;
    use tempfile::TempDir;

    #[test]
    fn resolve_editor_pref_wins() {
        let result = resolve_editor_with_env(Some("nvim"), None, None).unwrap();
        assert_eq!(result, "nvim");
    }

    #[test]
    fn resolve_editor_pref_empty_falls_through() {
        let result = resolve_editor_with_env(Some(""), Some("vim".into()), None).unwrap();
        assert_eq!(result, "vim");
    }

    #[test]
    fn resolve_editor_editor_env() {
        let result = resolve_editor_with_env(None, Some("emacs".into()), None).unwrap();
        assert_eq!(result, "emacs");
    }

    #[test]
    fn resolve_editor_visual_env() {
        let result = resolve_editor_with_env(None, None, Some("helix".into())).unwrap();
        assert_eq!(result, "helix");
    }

    #[test]
    fn resolve_editor_editor_beats_visual() {
        let result =
            resolve_editor_with_env(None, Some("vim".into()), Some("helix".into())).unwrap();
        assert_eq!(result, "vim");
    }

    #[test]
    fn resolve_editor_empty_env_falls_through_to_fallback() {
        let result = resolve_editor_with_env(None, Some("".into()), None);
        // Either a fallback editor resolves, or a clear error is returned.
        match result {
            Ok(name) => assert_ne!(name, ""),
            Err(TixError::Editor(_)) => {}
            Err(other) => panic!("unexpected error: {other:?}"),
        }
    }

    #[test]
    fn run_editor_success() {
        let tmp = TempDir::new().unwrap();
        let file = tmp.path().join("issue.md");
        fs::write(
            &file,
            "---\nnumber: 1\ntitle: T\nstatus: todo\nlabels: []\npriority: medium\ncreated: \"2026-01-01\"\nupdated: \"2026-01-01\"\n---\n\nbody",
        )
        .unwrap();
        let script = tmp.path().join("edit.sh");
        fs::write(&script, "#!/bin/sh\necho 'done' > /dev/null\n").unwrap();
        Command::new("chmod")
            .arg("+x")
            .arg(&script)
            .status()
            .unwrap();
        let config = Config::default();
        run_editor(script.to_str().unwrap(), &file, &config).unwrap();
    }

    #[test]
    fn run_editor_non_zero_exits_with_error() {
        let tmp = TempDir::new().unwrap();
        let file = tmp.path().join("issue.md");
        fs::write(
            &file,
            "---\nnumber: 1\ntitle: T\nstatus: todo\nlabels: []\npriority: medium\ncreated: \"2026-01-01\"\nupdated: \"2026-01-01\"\n---\n\nbody",
        )
        .unwrap();
        let script = tmp.path().join("fail.sh");
        fs::write(&script, "#!/bin/sh\nexit 1\n").unwrap();
        Command::new("chmod")
            .arg("+x")
            .arg(&script)
            .status()
            .unwrap();
        let config = Config::default();
        let err = run_editor(script.to_str().unwrap(), &file, &config).unwrap_err();
        assert!(matches!(err, TixError::Editor(_)));
    }

    /// `run_editor` runs the editor; it does not own validation (tix #1506).
    ///
    /// The old trailing `Issue::parse` replaced the real diagnostic with the
    /// generic `file not valid after edit`; an editor that leaves an unparsable
    /// file must therefore come back `Ok`, so the caller can classify it.
    #[test]
    fn run_editor_does_not_validate_the_file() {
        let tmp = TempDir::new().unwrap();
        let file = tmp.path().join("issue.md");
        fs::write(&file, "not an issue at all").unwrap();
        let script = tmp.path().join("noop.sh");
        fs::write(&script, "#!/bin/sh\nexit 0\n").unwrap();
        Command::new("chmod")
            .arg("+x")
            .arg(&script)
            .status()
            .unwrap();
        let config = Config::default();
        run_editor(script.to_str().unwrap(), &file, &config).unwrap();
        assert_eq!(fs::read_to_string(&file).unwrap(), "not an issue at all");
    }

    #[test]
    fn resolve_viewer_explicit_override_wins() {
        let result = resolve_viewer_with(Some("mdview"), |_| false).unwrap();
        assert_eq!(result, "mdview");
    }

    #[test]
    fn resolve_viewer_trims_the_override() {
        let result = resolve_viewer_with(Some("  mdview  "), |_| true).unwrap();
        assert_eq!(result, "mdview");
    }

    #[test]
    fn resolve_viewer_blank_override_is_an_error() {
        // Whitespace is neither a program nor "use the chain"; guessing would be
        // worse than saying so.
        let err = resolve_viewer_with(Some("   "), |_| true).unwrap_err();
        assert!(matches!(err, TixError::Editor(_)));
    }

    #[test]
    fn resolve_viewer_follows_the_documented_probe_order() {
        let order = |found: &[&str]| {
            let found = found.to_vec();
            resolve_viewer_with(None, move |name| found.contains(&name)).unwrap()
        };
        assert_eq!(
            order(&["mdterm", "batcat", "most", "less", "more"]),
            "mdterm"
        );
        assert_eq!(order(&["batcat", "most", "less", "more"]), "batcat");
        assert_eq!(order(&["most", "less", "more"]), "most");
        assert_eq!(order(&["less", "more"]), "less");
        assert_eq!(order(&["more"]), "more");
    }

    #[test]
    fn resolve_viewer_auto_uses_the_probe_chain() {
        let found = ["less"];
        let result = resolve_viewer_with(Some("auto"), |name| found.contains(&name)).unwrap();
        assert_eq!(result, "less");
    }

    #[test]
    fn resolve_viewer_none_found_names_every_candidate() {
        let err = resolve_viewer_with(None, |_| false)
            .unwrap_err()
            .to_string();
        for name in VIEWER_CANDIDATES {
            assert!(err.contains(name), "the error must name `{name}`: {err}");
        }
    }

    #[test]
    fn run_viewer_ignores_a_non_zero_exit_and_leaves_the_file_alone() {
        // A pager quits non-zero on an ordinary close; that is not a failure.
        let tmp = TempDir::new().unwrap();
        let file = tmp.path().join("issue.md");
        fs::write(&file, "body").unwrap();
        let script = tmp.path().join("quit.sh");
        fs::write(&script, "#!/bin/sh\nexit 3\n").unwrap();
        Command::new("chmod")
            .arg("+x")
            .arg(&script)
            .status()
            .unwrap();
        run_viewer(script.to_str().unwrap(), &file).unwrap();
        assert_eq!(
            fs::read_to_string(&file).unwrap(),
            "body",
            "the viewer is read-only"
        );
    }

    #[test]
    fn run_viewer_spawn_failure_is_an_error() {
        let tmp = TempDir::new().unwrap();
        let file = tmp.path().join("issue.md");
        fs::write(&file, "body").unwrap();
        let err = run_viewer("tix-no-such-viewer-1507", &file).unwrap_err();
        assert!(matches!(err, TixError::Editor(_)));
    }

    #[test]
    fn merge_fields_flag_driven() {
        let issue = Issue {
            projects: None,
            id: None,
            number: 1,
            title: "Old".into(),
            status: Status::new("todo"),
            labels: vec![],
            priority: Priority::Low,
            assignee: Some("alice".into()),
            estimate: Some("2".into()),
            commit: None,
            gitlab_id: None,
            linear_id: None,
            mission: None,
            task: None,
            relationships: vec![],
            related_issues: vec![],
            files: vec![],
            cycles: None,
            milestones: None,
            reviewer: None,
            start_date: None,
            due_date: None,
            created: "2026-01-01".into(),
            type_: None,
            updated: "2026-01-01".into(),
            filename: String::new(),
            body: "original body".into(),
            history: crate::model::History::new(),
            has_retired_links_key: false,
            time_entries: vec![],
            parent: None,
            series: None,
            health: None,
            epics: None,
            extra_frontmatter: std::collections::BTreeMap::new(),
            archived: false,
            entered_at: None,
            source: None,
        };
        let edits = FieldEdits {
            title: Some("New".into()),
            status: None,
            priority: None,
            labels: None,
            files: None,
            assignee: None,
            estimate: None,
            commit: None,
            cycles: None,
            milestones: None,
            reviewer: None,
            start_date: None,
            due_date: None,
            parent: None,
            related_issues: None,
            type_: None,
        };
        let merged = merge_fields(&issue, &edits);
        assert_eq!(merged.title, "New");
        assert_eq!(merged.status.display(), "todo");
        assert_eq!(merged.body, "original body");
        assert_eq!(merged.assignee.as_deref(), Some("alice"));
    }

    #[test]
    fn merge_fields_commit_clear() {
        let issue = Issue {
            projects: None,
            id: None,
            number: 1,
            title: "T".into(),
            status: Status::new("done"),
            labels: vec![],
            priority: Priority::default(),
            assignee: None,
            estimate: None,
            commit: Some("abc".into()),
            gitlab_id: None,
            linear_id: None,
            mission: None,
            task: None,
            relationships: vec![],
            related_issues: vec![],
            files: vec![],
            cycles: None,
            milestones: None,
            reviewer: None,
            start_date: None,
            due_date: None,
            created: "2026-01-01".into(),
            type_: None,
            updated: "2026-01-01".into(),
            filename: String::new(),
            body: String::new(),
            history: crate::model::History::new(),
            has_retired_links_key: false,
            time_entries: vec![],
            parent: None,
            series: None,
            health: None,
            epics: None,
            extra_frontmatter: std::collections::BTreeMap::new(),
            archived: false,
            entered_at: None,
            source: None,
        };
        let edits = FieldEdits {
            title: None,
            status: Some("in progress".into()),
            priority: None,
            labels: None,
            files: None,
            assignee: None,
            estimate: None,
            commit: Some(None),
            cycles: None,
            milestones: None,
            reviewer: None,
            start_date: None,
            due_date: None,
            parent: None,
            related_issues: None,
            type_: None,
        };
        let merged = merge_fields(&issue, &edits);
        assert!(merged.commit.is_none());
        assert_eq!(merged.status.display(), "in progress");
    }

    #[test]
    fn merge_fields_body_never_altered() {
        let issue = Issue {
            projects: None,
            id: None,
            number: 1,
            title: "T".into(),
            status: Status::new("todo"),
            labels: vec![],
            priority: Priority::default(),
            assignee: None,
            estimate: None,
            commit: None,
            gitlab_id: None,
            linear_id: None,
            mission: None,
            task: None,
            relationships: vec![],
            related_issues: vec![],
            history: crate::model::History::new(),
            has_retired_links_key: false,
            time_entries: vec![],
            parent: None,
            series: None,
            health: None,
            files: vec![],
            cycles: None,
            milestones: None,
            reviewer: None,
            start_date: None,
            due_date: None,
            created: "2026-01-01".into(),
            type_: None,
            updated: "2026-01-01".into(),
            filename: String::new(),
            body: "important body".into(),
            epics: None,
            extra_frontmatter: std::collections::BTreeMap::new(),
            archived: false,
            entered_at: None,
            source: None,
        };
        let edits = FieldEdits {
            title: Some("Changed".into()),
            status: Some("done".into()),
            priority: Some("high".into()),
            labels: Some(vec!["bug".into()]),
            files: Some(vec!["specs/s.md".into()]),
            assignee: Some(Some("bob".into())),
            estimate: Some(Some("3".into())),
            commit: Some(Some("def".into())),
            cycles: Some(Some(vec!["c1".into()])),
            milestones: None,
            reviewer: Some(Some("renata".into())),
            start_date: None,
            due_date: None,
            parent: None,
            related_issues: None,
            type_: None,
        };
        let merged = merge_fields(&issue, &edits);
        assert_eq!(merged.body, "important body");
    }
}