Stamp a literal version in fromV3, not the moving constant - #53
Closed
jellologic wants to merge 1 commit into
Closed
Stamp a literal version in fromV3, not the moving constant#53jellologic wants to merge 1 commit into
jellologic wants to merge 1 commit into
Conversation
`fromV3` stamped `version: SUPPORTED_VERSION`. `migrate()` dispatches on that number, so a rung stamping the CURRENT version makes the ladder skip every step above it: the draft claims to be current while still carrying the older shape. `fromV1` and `fromV2` both stamp literals and both carry a comment warning about exactly this, the second of which says "the moment SUPPORTED_VERSION became 4 this was the bug it predicted." It then happened one rung further up. Latent today and invisible for a specific reason: while SUPPORTED_VERSION is 4, `SUPPORTED_VERSION` and `4` produce identical output. It becomes wrong the moment a v5 exists, at which point a v3 config is marked v5 while holding v4 shape — and `fs-config-store` would write that back. That same property means a behavioural test cannot fail on it today. The added tests are therefore two kinds: - Per-rung assertions that each `fromVN` returns N+1, written against literals rather than SUPPORTED_VERSION. Against the constant they would have passed while the bug was present, which is how it survived review. These are future guards and cannot fail now. - A source-level guard, in the spirit of test/architecture.test.ts, asserting no rung stamps a non-literal. This one does fail on the unfixed code, verified by reintroducing the bug. Each rung is fed its own minimal input rather than the previous rung's output, so the tests need no widening cast. Refs #37 Signed-off-by: jellologic <31935831+jellologic@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #37.
fromV3stampedversion: SUPPORTED_VERSION.migrate()dispatches on that number, so a rung stamping the current version makes the ladder skip every step above it — the draft claims to be current while carrying the older shape.fromV1andfromV2both stamp literals and both carry a comment warning about this. The v2 one says "the moment SUPPORTED_VERSION became 4 this was the bug it predicted." It then happened one rung further up.Why the tests come in two kinds
While
SUPPORTED_VERSIONis 4,SUPPORTED_VERSIONand4produce identical output, so no behavioural test can fail on this today. That is also why it survived review.fromVNreturns N+1, written against literals. Against the constant they would have passed while the bug was present. Future guards; cannot fail now.test/architecture.test.ts, asserting no rung stamps a non-literal. This one does fail on the unfixed code — verified by reintroducing the bug:Each rung is fed its own minimal input rather than the previous rung's output, so the tests need no widening cast.
811 tests green.