Skip to content

Commit e45c3f3

Browse files
committed
fix(cli): wire up journal field in work add command
Add missing "journal" match arm in add_to_field() so that `govctl work add <WI> journal "..."` works instead of returning E0810. Also fix snapshot test instability: signature hashes embed today's date via the spec, making them change daily. Normalize sha256 hashes to `sha256:<HASH>` in test output so snapshots are date-independent. Add test_work_add_journal integration test covering the new code path.
1 parent dfc5ea4 commit e45c3f3

22 files changed

+140
-31
lines changed

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
## [0.5.2] - 2026-02-23
10+
### Added
11+
12+
- test_work_add_journal integration test (WI-2026-02-24-001)
1113

1214
### Fixed
1315

14-
- `commit` skill is now correctly bundled
16+
- work add journal command succeeds (WI-2026-02-24-001)
17+
- snapshot tests stable across days/machines (WI-2026-02-24-001)
1518

1619
## [0.5.1] - 2026-02-22
1720

gov/releases.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
[[releases]]
2-
version = "0.5.2"
3-
date = "2026-02-23"
4-
refs = [
5-
"WI-2026-02-22-005",
6-
"WI-2026-02-22-006",
7-
]
8-
91
[[releases]]
102
version = "0.5.1"
113
date = "2026-02-22"

gov/work/2026-02-22-add-tests-for-render-adr-and-render-work-item-new-fields.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ started = "2026-02-22"
88
completed = "2026-02-22"
99

1010
[content]
11-
description = """
12-
Describe the work to be done.
13-
What is the goal? What are the acceptance criteria?"""
11+
description = "Add unit tests for render_adr (pros, cons, rejection_reason) and render_work_item (journal field) to cover new ADR-0027 and ADR-0026 fields."
1412

1513
[[content.acceptance_criteria]]
1614
text = "Unit tests cover render_adr with pros, cons, rejection_reason"

gov/work/2026-02-22-fix-non-deterministic-output-in-rfc-finalize.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ started = "2026-02-22"
88
completed = "2026-02-22"
99

1010
[content]
11-
description = """
12-
Describe the work to be done.
13-
What is the goal? What are the acceptance criteria?"""
11+
description = "Fix non-deterministic output ordering in rfc finalize command to ensure CI test stability."
1412

1513
[[content.acceptance_criteria]]
1614
text = "CI test passes with deterministic output order"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[govctl]
2+
schema = 1
3+
id = "WI-2026-02-24-001"
4+
title = "Fix journal add command for work items"
5+
status = "done"
6+
created = "2026-02-24"
7+
started = "2026-02-24"
8+
completed = "2026-02-24"
9+
10+
[content]
11+
description = "Fix govctl work add journal command which returned E0810 (not an array or unsupported). Also fix snapshot test instability caused by date-dependent signature hashes."
12+
13+
[[content.journal]]
14+
date = "2026-02-24"
15+
content = "Fixed missing journal arm in add_to_field match statement"
16+
17+
[[content.journal]]
18+
date = "2026-02-24"
19+
content = "Added journal arm to add_to_field match in edit.rs. Fixed snapshot instability by normalizing sha256 hashes in test output. Added test_work_add_journal integration test. Updated 14 stale snapshots."
20+
21+
[[content.acceptance_criteria]]
22+
text = "work add journal command succeeds"
23+
status = "done"
24+
category = "fixed"
25+
26+
[[content.acceptance_criteria]]
27+
text = "snapshot tests stable across days/machines"
28+
status = "done"
29+
category = "fixed"
30+
31+
[[content.acceptance_criteria]]
32+
text = "test_work_add_journal integration test"
33+
status = "done"
34+
category = "added"

src/cmd/edit.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,15 @@ pub fn add_to_field(
671671
));
672672
}
673673
}
674+
"journal" => {
675+
use crate::model::JournalEntry;
676+
use crate::write::today;
677+
entry.spec.content.journal.push(JournalEntry {
678+
date: today(),
679+
scope: None,
680+
content: value.to_string(),
681+
});
682+
}
674683
"notes" => {
675684
if !entry.spec.content.notes.contains(&value.to_string()) {
676685
entry.spec.content.notes.push(value.to_string());

tests/common/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ pub fn normalize_output(output: &str, dir: &Path, date: &str) -> String {
3333
.replace_all(&normalized, "ADR-XXXX-")
3434
.to_string();
3535

36+
// Replace signature hashes (date-dependent due to embedded dates in specs)
37+
let sig_pattern = regex::Regex::new(r"sha256:[0-9a-f]{64}").unwrap();
38+
normalized = sig_pattern
39+
.replace_all(&normalized, "sha256:<HASH>")
40+
.to_string();
41+
3642
normalized
3743
}
3844

tests/snapshots/test_display_paths__render_adr_display_path.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ $ govctl adr render ADR-0001 --dry-run
66
Would write: docs/adr/ADR-0001.md
77
--- Content preview ---
88
<!-- GENERATED: do not edit. Source: ADR-0001 -->
9-
<!-- SIGNATURE: sha256:1361156622c0cda06e5f42f70800f307a78793d6586e8a7d5b700a9d4326c18c -->
9+
<!-- SIGNATURE: sha256:<HASH> -->
1010

1111
# ADR-0001: Test Decision
1212

tests/snapshots/test_display_paths__render_rfc_display_path.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ $ govctl rfc render RFC-0001 --dry-run
66
Would write: docs/rfc/RFC-0001.md
77
--- Content preview ---
88
<!-- GENERATED: do not edit. Source: RFC-0001 -->
9-
<!-- SIGNATURE: sha256:61ddb76cfb587b6be51e84d202960a419c1c3cdb136f01ccbfff817cd13fee51 -->
9+
<!-- SIGNATURE: sha256:<HASH> -->
1010

1111
# RFC-0001: Test RFC
1212

tests/snapshots/test_display_paths__render_work_display_path.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ $ govctl work render WI-<DATE>-001 --dry-run
66
Would write: docs/work/WI-<DATE>-001.md
77
--- Content preview ---
88
<!-- GENERATED: do not edit. Source: WI-<DATE>-001 -->
9-
<!-- SIGNATURE: sha256:77cba937dcfbc7e5d9125d64e477feb0b5d6d9eee8c65503700a1d1b23ae3dda -->
9+
<!-- SIGNATURE: sha256:<HASH> -->
1010

1111
# Test Work
1212

0 commit comments

Comments
 (0)