Simplify EventModel test golden file management
Resolved 💬 1 comment Opened Jan 12, 2026 by randrag Closed Jan 12, 2026
Problem
Currently, EventModel test PUML golden files use descriptive names that include both the D-number and test description:
D185657 - Update provisional unit cost on docket line.puml
This causes issues when test descriptions change (e.g., renaming "provisional" to "estimated"):
- Duplicate files are created with old and new names
- Manual cleanup required to remove old files
- The WIP/Golden folder comparison adds complexity
Proposed Changes
1. Use D-number only for PUML filenames
Name files using only their D-number:
D185657.puml
Benefits:
- Renaming test descriptions doesn't create duplicate files
- Simpler, consistent naming
- The description is already in the test code and PUML title
2. Remove WIP folder - work directly in Golden
Current flow:
- Test generates PUML to
WIP/folder - Test compares WIP content against
Golden/folder - Test fails if mismatch
- Developer manually copies WIP to Golden
Proposed flow:
- Test generates/updates PUML directly in
Golden/folder - Use
git diffto review changes - Commit when satisfied
Benefits:
- Eliminates duplicate folder structure
- Natural git workflow for reviewing changes
- No manual copy step required
3. Don't fail tests on golden file changes
Currently tests fail with ContentsMismatch when PUML output differs from golden file.
Instead:
- Always write the current output to the golden file
- Use git to track and review changes
- Tests should validate expected final state(s) via assertions, not file comparison
Benefits:
- Tests focus on behavioral correctness, not output format
- PUML changes from refactoring don't break CI
- Developers review PUML changes in normal git diff workflow
4. Require state assertions in all EventModel tests
Each test should include explicit assertions checking the expected final state after commands execute. Example:
// Critical data assertion
let estimatedUnitCostLine1 =
cs.CommandSessionResult.CacheState.get_sal_d__
|> _.ToLatestStateM
|> _.ToStateT_L
|> List.head
|> _.State
|> fun stateU ->
match stateU with
| Docket.StateU.Draft dd ->
dd.LineM.ToMapWithRank
|> Map.find Docket.Lines.id_1
|> fun (lineP, _rank) -> lineP.EstimatedUnitCostO
| _ -> None
|> Option.map _.UnwrappedToDecimal
test <@ estimatedUnitCostLine1 = Some 7M @>
Migration Path
- Rename all existing PUML files to D-number only format
- Update
Runner.runWorkAndSaveDiagramto write directly to Golden folder - Remove WIP folder comparison logic
- Remove
GoldenFileCheckResult.IsSuccessassertions from tests - Audit tests to ensure each has meaningful state assertions
Files Affected
p20.2.EventModels.Sales/- Sales domain EventModel testsp15.2.EventModels.Manufacturing/- Manufacturing EventModel testsp15.4.EventModels.Inventory/- Inventory EventModel testsp20.2.EventModels.Retail/- Retail EventModel tests- EventModel test runner/infrastructure code
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗