Repository navigation
A skipped page's answers are left out of what is stored, not out of what is judged (0246) - #363
Merged
Merged
Conversation
…hat is judged (0246) A page a skip rule walks past had its fields hidden from validation and its answers stored all the same, in every release since 0.3.0: what a client sent for a skipped page, what was typed there before the page was walked past, and a default on a page skipped from the start (hazards A4, A10). And a skip shared one switch with the visible rules, so a field's own rule showed it again on a skipped page and a required one held the form up where the replay accepted it (A2). The server now stores, and hands to webhooks, the engine's new submission(): value() without each field, group and list on a skipped page, whole, by its own clearOnHide. value() is unchanged, so the replay judges what the browser judged. Pruning the store let a skip reading its own page undo itself, and leaving the answers out of value() made the replay judge without answers the browser judged with; 0246 records both and what this costs. A skip and a visible rule now hide apart. The skip machinery leaves the engine for skips.ts.
… needs, and a page is opened in the membership walk
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
sharkysan
added a commit
that referenced
this pull request
Nov 27, 2026
…ser did, by random roads (#364) A property walks seven forms by random roads of up to thirty steps, each answer one a person could give and each row one the buttons allow, and asks the replay of a JSON copy of value() for the same verdict, errors, pages walked past, stored value and every field's reading. It fails against the engines before #358 and #363, against one that strips a skipped page's answers from value(), and against one whose server ignores disabled rules. It found one disagreement on main: a rule reading an answer that a hiding clears in the same pass decides as though it were still there, because the pass reads the answers as it began. Both ways round: the browser can refuse what the server accepts, and accept and send what the server refuses, on a field it shows as optional or on one it does not show at all. That road is pinned as debt in four cases (A2, arc42 §11) and left out of the forms until its fix.
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.
A page a
skiprule walks past had its fields hidden from validation and its answers stored all the same. Measured onmain: a server replay of{ needsVisa: false, passport: "X123" }with the passport page skipped accepted the submission and storedpassport: "X123". What was typed on a page before it was walked past was stored too, and so was a default on a page skipped from the start. Read from0.3.0's code, the first release with askiprule, it has been so since then (hazards A4 and A10). 0087 promised the answers would stay out of the submission; nothing did that, and nothing tested it.A skip also shared one switch with
visiblerules. A field on a skipped page with avisiblerule of its own that showed it was shown again by the browser's next pass. A required one then held the form up on a page nobody could reach, where the replay of the same answers accepted it (A2).The fix (0246).
engine.submission()returnsvalue()without each field, group and list on a skipped page, whole, unless its ownclearOnHideisfalse.value()is unchanged: it is what a binding sends, what a draft keeps and what the server replays. So every rule judges as it did, and the replay judges what the browser judged.visiblerule now hide apart, and either one hides the field.engine.tsforskips.ts.Two other repairs were built, measured and dropped; 0246 records both:
total == 0.0came back at a total of nothing, and two crossed skips with defaults overflowed the stack.value()made the server's replay judge without answers the browser had judged with. The reviewer found six cases where the two disagreed.A new test table, the replay of what the browser hands over, guards that property from now on. It reaches each state answer by answer in the browser, replays exactly what
value()hands over in server mode, and requires the same verdict, the same pages and the samesubmission(). All six cases fail under the second dropped design.What this costs, recorded in 0246, A3, A4 and §11:
main. A field shown because of it is asked and stored, and a value computed from it is stored, while the answer itself is not. So a stored response can disagree with its own inputs. A test pins this, so changing it is a decision.submission().@formancy/coremeasures 17.751 kB brotli, 0.22 kB abovemain, which leaves 0.25 kB of its 18 kB budget (§9.3).Other readers follow the same line:
submission(), and so does an example'sabsent, so neither shows a skipped page's answer as one that will be sent.value(), what was judged. One on a skipped page that its list does not offer is still refused, as onmain, because the rules read it.Also fixed, found on the way (hazard A7): a sourced answer on a page was never checked against its list, in every release since
0.2.0, the first with a membership check. The membership walk took a page for a group, looked for the page's key in the answers, found nothing, and asked the source about none of the fields on it. So on any paged form, a value the list does not offer was stored. The walk now opens pages with the sameflattenPagesthe file walk already used, which moves toserver-core/src/pages.ts. From the upgrade, a paged form version published before refuses, withoption, a sourced answer it used to accept.From the upgrade, a form version published before stores none of what a client sends for a page its answers walk past, except what a field there keeps with
clearOnHide: false. Responses stored before keep what they were stored with, and never migrate.Not fixed, recorded in A4's residual: in the browser, a computed field that a
visiblerule hides is written again by the next pass that re-runs its rule. In the case measured the replay stripped it.Tests:
packages/core/src/skip.test.tshas sixteen new cases, all of which pass. Removing the strip, letting it ignoreclearOnHide, sharing the rules' switch, or strippingvalue()instead each fails at least one of them.review.test.tsandscenarios.test.ts, which fail when their file readsvalue().packages/server-core/src/use-cases.test.tshas two new cases:value();submission(), or when the walk does not open pages.options-membership.test.tshas one new case, which fails onmain's walk.Run locally: build, typecheck, lint, format check, and the core, spec, docs, server-core, server, builder-core, conformance, mcp, React and Angular suites. The e2e and browser gates are left to CI.