test: pin counts in examples.spec.ts (README example traces)#133
Merged
Conversation
The README example traces are deterministic β the audit flagged the
\`> 0\` weakness in this file. Each run on the 2-visit fixture has
exact known dispatch counts.
Constants:
- VISIT_COUNT = 2 (visits 1=A, 2=B-then-halt)
- A_VISIT_COUNT = 1 (only visit 1 has head 'A')
- HALT_TRANSITION_COUNT = 1 (only visit 2 transitions to halt)
Replaced:
- \`breakCount > 0\` β \`.toBe(VISIT_COUNT)\` for wildcard before-pause.
- \`symASeen > 0\` β \`.toBe(A_VISIT_COUNT)\` for symbol-list match;
also pin the non-match count (= 0) so misses on the wrong visit
are caught.
- \`order.toContain('before') / 'after'\` β \`.toEqual(['before', 'after'])\`
for the symbol-list both-flags test (pins both ORDER and that only
the matching visit dispatches).
- \`haltPause === true\` β \`.toHaveLength(HALT_TRANSITION_COUNT)\` plus
pin which visit triggered (lifecycle-aware index check).
- \`stepCount > 0\` / \`breakCount > 0\` β \`.toBe(VISIT_COUNT)\` for both
in the onStep+onPause-independence test.
- \`'Disable later by assigning null'\` strengthened with intermediate
\`debug.before === true\` assertion.
Test count: 7 β 8. Total: 392 tests pass.
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.
Task 9/10. The README example traces are deterministic on a 2-visit fixture; the audit flagged the `> 0` weakness across this file.
What this commit pins
Constants at the top make the trajectory explicit:
Then every `> 0` becomes a pinned count:
Numbers