Source: code-review of #30; nice-to-have, deferred at merge.
The negative test fixtures in tests/chronicle/append/bad-signatures.txt assert specific diagnostic substrings — e.g. "section 'Diagnosis' is not appendable for type 'hypothesis'". Any rewording of the die message will break the test even when the failure mode itself is unchanged.
Today the tests mostly exercise the message author's typing rather than the script's behaviour. Per Beck, Test-Driven Development: tests should fail for one reason.
Concrete proposal (two options, depending on intent):
-
If diagnostic copy is itself the user contract (i.e., we want to guarantee it doesn't drift): document this explicitly in bad-signatures.txt with a comment so a future maintainer knows they're committing to the wording, not the failure class.
-
If diagnostic copy is incidental (more likely): introduce error-class tags, e.g. emit [ERR_NOT_APPENDABLE] as a stable prefix on the stderr line and assert against the tag. Wording can then evolve without test churn.
Same pattern applies to the existing tests/chronicle/bad-signatures.txt for the validator — worth addressing both at once if we go with option 2.
Files:
tests/chronicle/append/bad-signatures.txt
tests/chronicle/bad-signatures.txt
scripts/chronicle.sh (the die ... call sites if we add tags)
Risk: low — refactor with the harness as the safety net.
Source: code-review of #30; nice-to-have, deferred at merge.
The negative test fixtures in
tests/chronicle/append/bad-signatures.txtassert specific diagnostic substrings — e.g."section 'Diagnosis' is not appendable for type 'hypothesis'". Any rewording of thediemessage will break the test even when the failure mode itself is unchanged.Today the tests mostly exercise the message author's typing rather than the script's behaviour. Per Beck, Test-Driven Development: tests should fail for one reason.
Concrete proposal (two options, depending on intent):
If diagnostic copy is itself the user contract (i.e., we want to guarantee it doesn't drift): document this explicitly in
bad-signatures.txtwith a comment so a future maintainer knows they're committing to the wording, not the failure class.If diagnostic copy is incidental (more likely): introduce error-class tags, e.g. emit
[ERR_NOT_APPENDABLE]as a stable prefix on the stderr line and assert against the tag. Wording can then evolve without test churn.Same pattern applies to the existing
tests/chronicle/bad-signatures.txtfor the validator — worth addressing both at once if we go with option 2.Files:
tests/chronicle/append/bad-signatures.txttests/chronicle/bad-signatures.txtscripts/chronicle.sh(thedie ...call sites if we add tags)Risk: low — refactor with the harness as the safety net.