Repository navigation
chart: forest-equality differential against V1's pipeline (toys, seeds 4 and 44) - #658
Merged
Merged
Conversation
The precedence section gains a bullet naming ForestDiff, the V1 side and the candidate, and the tests that show the comparison can fail before the recognizer changes, ahead of the code (live document first). The shared section is rewritten whole by the milestone's docs issue. Implements: 01a21447-d0ba-7afb-8ead-01525fd151d7 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YDSkrXBzd3pd6nDkewof8N
ForestDiff compares a candidate's forest with V1's: the verdict, the nodes reachable from the root, matched by symbol, rule position and span rather than by index, and each reachable node's kept alternatives in order. TestForestEqualityDetectsPerturbation shows a dropped alternative, reordered alternatives, an added and a removed reachable node, a flipped verdict and a changed rule or dot each reported by the comparison that owns it, and equal forests, a renumbered forest and an added unreachable node reported by none. Each comparison was disabled in turn and its subtest went red. Implements: 01a21447-d0ba-7afb-8ead-01525fd151d7 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YDSkrXBzd3pd6nDkewof8N
…nizer V1Forest and V1ToyForest are V1's pipeline: the recognizer V1Recognizer builds, which only ever judges no precedence, then Build, LibraryOperators for a source, then Constrain, each stage entered through the V1 side's own hooks. The V1 side's chart accepts print $fh [];, $a <=> $b <=> $c; and 1 .. 2 .. 3; and its Constrain refuses each, so a V1 side running the judged recognizer fails; and it enters its own LibraryOperators and Constrain once per input, so a V1 side wired to production's output fails. Each was shown red by mutation: Constrain skipped, the chart refusing, the side wired to ParseWith, and either hook bypassed. Implements: 01a21447-d0ba-7afb-8ead-01525fd151d7 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YDSkrXBzd3pd6nDkewof8N
…seeds 4 and 44 CandidateForest is production's forest before resolve: parseStream now ends at constrainedStream, which resolve and the readings count follow, so the candidate is what ParseWith judges with nothing taken away. CandidateToyForest is production's recognizer, Build and Constrain over a toy's own precedence. Both are variables a later issue can point at the judged recognizer. TestForestEqualityToys compares 4395 of 4395 toy sentences and TestForestEqualityGeneratedSentences 20083 of 20083 seed-4 and 15000 of 15000 seed-44 sentences, each requiring both verdicts among them; the seed generators are now functions both differentials share. TestForestEqualityHarnessesUseCandidate swaps in a candidate that refuses everything and requires both loops to report it, so neither compares V1 with itself. empty-input and both-refuse join the perturbation subtests. Shown red by mutation: each loop comparing V1 with itself, compared counting only accepted inputs, and either candidate skipping Constrain. Implements: 01a21447-d0ba-7afb-8ead-01525fd151d7 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YDSkrXBzd3pd6nDkewof8N
…erential
No corpus file takes Constrain's shortcut: (C5), so the differential
gains a constructed input, STDOUT isa my $m | 1;, on which V1's
judgement keeps the term over isa my $m | 1 under two contexts with two
different non-empty alternative sets, {35} and {34 35}, and keeps
their union. contextAltSets reads each context's set apart by mark's
own loop without marking; the test logs and requires
contexts: 2, distinct non-empty alternative sets: 2, holds the
measurement to Constrain's kept set as a union on every node of 2413
accepted inputs (the toys, the 83 handcrafted sentences,
_ - $h{1} - $fh; and TestPrecedenceMarkFirstFilter's toy), and requires
the candidate's forest to equal V1's. Shown red by mutation: contexts
merged, mark's first-terminal filter or reduce check dropped, V1
skipping Constrain, the candidate skipping Constrain, and an input that
takes no shortcut.
Implements: 01a21447-d0ba-7afb-8ead-01525fd151d7
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YDSkrXBzd3pd6nDkewof8N
The simplify pass inlines a single-use lexer helper and computes each subtest's reachable nodes once. The README's differential bullet names TestForestEqualityHarnessesUseCandidate, which holds that neither loop compares V1 with itself. make test passes with T1_CORPUS set. Implements: 01a21447-d0ba-7afb-8ead-01525fd151d7 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YDSkrXBzd3pd6nDkewof8N
… differentials Gate finding F2: TestForestEqualityUnionShortcut logs one input, not a compared-of-loaded count, so the README's claim names the two differentials that make it. The bullet also says the harness test holds that the candidates never enter the V1 side's stages (F1), ahead of the test. Implements: 01a21447-d0ba-7afb-8ead-01525fd151d7 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YDSkrXBzd3pd6nDkewof8N
… side Gate finding F1: TestForestEqualityHarnessesUseCandidate proved the loops call the candidate variables but not what those variables are, so CandidateForest = V1Forest (M15) or CandidateToyForest = V1ToyForest (M16) left every TestForestEquality test green. The new subtest candidates-are-not-v1 wraps the V1 side's LibraryOperators and Constrain hooks to count, runs CandidateForest on three sources and CandidateToyForest on twenty ladder sentences, and requires no entry. Under M15 and M16 it goes red, entered 6 times each; green as committed. Implements: 01a21447-d0ba-7afb-8ead-01525fd151d7 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YDSkrXBzd3pd6nDkewof8N
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.
Summary
This adds the forest-equality differential for chart-perly-w4. It compares production's forest before resolve with V1's pipeline, which is the unjudged recognizer, then
LibraryOperators,BuildandConstrain. The comparison runs over the toys and seeds 4 and 44, plus a fixture that exercises V1's union shortcut.ForestDiffcompares the verdict first, then the reachable nodes by (symbol, rule position, span), then the kept alternatives in order.V1Recognizer,V1ForestandV1ToyForest, so later differentials reuse it. ItsLibraryOperatorsandConstraingo through hooks that tests count.CandidateForestandCandidateToyForest. A test requires that the candidates never enter V1's hooked stages, so a differential cannot compare V1 with itself.parseStreamis split at resolve intoconstrainedStream. Its behaviour is unchanged, andresolved-forest-digest.goldenis byte-identical.internal/chart/README.md, committed first.Implements: 01a21447-d0ba-7afb-8ead-01525fd151d7
Gate
The gate ran at Tier 2, with alignment, architecture and review applied inline.
7661a9f5. The candidate variables could be redefined as the V1 side and stay green (F1), and one README sentence overstated what the tests log (F2).d6fe1e08. The reviewer's mutations went red atcandidates-are-not-v1, and the runner's 12 commands, criteria plusmake test, all exited 0.Out-of-scope findings are carried by later issues:
ForestDiffduplicate keys (01a217d4-9769).Test plan
d6fe1e08.T1_CORPUS=/opt/corpora/PerlOnJava/src/test/resources/unit make testpasses.Generated by Claude Code