design: IRVersion is never enforced on decode #2

Open
opened 2026-06-11 15:37:32 +02:00 by yorunikakeru · 0 comments
Owner

`IR.Types` haddock promises: "A version mismatch causes the engine to reject the document and roll back." But `FromJSON IRVersion` accepts any Int (IR/Types.hs:96-97) and nothing anywhere compares against `currentIRVersion`. A v1 document parses fine as long as the field names happen to match — the actual failure mode is a confusing field/tag parse error or, worse, silent acceptance.

Also: version-bump discipline is a comment ("Bump this whenever Condition or Action sums are extended") with no enforcement, and the Service.Action parser already grew a parallel compat mechanism (priority defaults to 100 when absent, IR/Types... IR/Domain/Service.hs:79,86) — two ad-hoc strategies for the same problem.

Proposal: `FromJSON IRDocument` checks version against a supported range and fails with a dedicated error; add a golden test that pins the wire format so an unbumped schema change fails CI. Coordinate with spec issue on rollback compatibility window (FrogOS/spec#4).

\`IR.Types\` haddock promises: "A version mismatch causes the engine to reject the document and roll back." But \`FromJSON IRVersion\` accepts any Int (IR/Types.hs:96-97) and nothing anywhere compares against \`currentIRVersion\`. A v1 document parses fine as long as the field names happen to match — the actual failure mode is a confusing field/tag parse error or, worse, silent acceptance. Also: version-bump discipline is a comment ("Bump this whenever Condition or Action sums are extended") with no enforcement, and the Service.Action parser already grew a parallel compat mechanism (priority defaults to 100 when absent, IR/Types... IR/Domain/Service.hs:79,86) — two ad-hoc strategies for the same problem. Proposal: \`FromJSON IRDocument\` checks version against a supported range and fails with a dedicated error; add a golden test that pins the wire format so an unbumped schema change fails CI. Coordinate with spec issue on rollback compatibility window (FrogOS/spec#4).
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
FrogOS/IR#2
No description provided.