Repository navigation
Make fence structure total in structural_decompress - #43
Merged
Merged
Conversation
Every byte string now denotes a program. structural_decompress previously
raised ValueError in three places — a closer with no open fence, a closer
that did not match the innermost fence, and a fence left open at end of
input — so unbalanced sources were not compilable at all.
Fences left open at EOF are now closed implicitly, innermost first, running
the same lifetime finalisation an explicit closer runs. A closer that
matches no open fence is dropped. The shared close path is factored into a
close_scope helper so implicit and explicit closes cannot drift apart.
The grade-fence check ("effect grade exceeds fence") is unchanged: that is a
static effect violation rather than a parse failure, and it still raises.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K7BqQpyspK2owRy6g6SFxw
continuous_semantics_profile caught the ValueError raised by structural_decompress and recorded a distance of zero, so a mutation the front end refuses to compile was indistinguishable from a mutation that changed nothing. The measurement had holes exactly where the interesting boundary cases live. A rejected mutant now scores the rejection distance: every instruction of the base program counted as deleted, floored at 1 so an empty base program cannot collapse the score back to zero. Every profile entry also carries an explicit `compiles` flag, so callers can separate "identical" from "uncompilable" instead of inferring it from the presence of `error`. The preceding commit removed the fence-imbalance ValueErrors, so the remaining rejection path is the grade-fence violation, which the added tests exercise directly. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K7BqQpyspK2owRy6g6SFxw
Stop scoring rejected mutants as semantically identical
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.
Makes "every string compiles" true for fencing.
Problem
structural_decompressraisedValueErrorin three places, so unbalanced sources were not compilable at all:"}""{)""{a"Change
close_scopehelper, so implicit and explicit closes run the same lifetime finalisation and cannot drift apart.Scope
The grade-fence check (
Effect grade 'state' exceeds 'pure' fence in ()) is a fourthValueErrorand is unchanged. It is a static effect violation rather than a parse failure, so"(c)"still raises. Worth knowing if the goal is literal totality ofstructural_decompress, since that path remains.Tests
Existing tests that asserted the three removed errors now assert the new behaviour. Added to
test_invariants.py: a parametrised set of unbalanced sources, checks that stray closers leave the tree identical to the balanced parse, that implicitly closed fences end lifetimes exactly like explicit ones, and an exhaustive sweep over all 512 three-character fence-only strings.Full suite: no new failures. The 4 pre-existing failures are environment coupling, addressed separately.
🤖 Generated with Claude Code
https://claude.ai/code/session_01K7BqQpyspK2owRy6g6SFxw
Generated by Claude Code