fix: hint two-kebab-half subtraction in ILO-T004 (mandelbrot)#575
Merged
Conversation
When an unbound 3+ segment kebab ident splits uniquely into two halves that ARE bound, suggest the subtraction reading. Hit by mandelbrot persona writing `zr-sq-zi-sq` with no spaces around the operator, expecting it to parse as `(zr-sq) - (zi-sq)`. Pre-fix the verifier emitted bare ILO-T004 with no hint (single segments unbound, levenshtein distance > 3 too). The 2-segment path now also requires both halves to resolve before firing the existing hint, matching the new 3+ logic and dropping a small false-positive case where only the legacy "all segments bound" test gated. Hint shows both prefix (`- zr-sq zi-sq`) and infix-with-spaces (`zr-sq - zi-sq`) forms so the persona has two unambiguous canonical spellings.
Adds a `mandel zr-sq:n zi-sq:n>n;- zr-sq zi-sq` line to the kebab-vs- subtract example so the cross-engine examples harness exercises the canonical "subtraction between two hyphenated names" form on every engine. Comment block above it explains why the no-space form would fail and points at the new diagnostic.
Pins the lexer's whitespace-sensitive disambiguation in the identifier- syntax section: `a-b` is always one ident, `a - b` is subtraction. Mentions the new two-kebab-half hint surfaced by ILO-T004 so agents reading the spec see the canonical prefix and infix-with-spaces forms. ai.txt regenerated by build.rs from SPEC.md.
regression_reserved_names_doc has been failing on main since the crypto-primitives merge (PR #560 added b64 / b64-dec / hex without updating the enumerated 3-char reserved list). Adds them so the test goes green for any branch off main. ai.txt regenerated.
❌ 2 Tests Failed:
View the top 2 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
This was referenced May 21, 2026
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
Persona-reported:
zr-sq - zi-sqwritten without spaces around the operator collapses to a single 4-segment identzr-sq-zi-sq, surfacing as bare ILO-T004 with no hint. The mandelbrot dogfood persona hit this 2026-05-20 (#5aq).The lexer is already correct:
a-bis one ident,a - b(with spaces) is three tokens. The fix is purely diagnostic — when an unbound 3+ segment kebab ident splits uniquely into two halves that ARE bound, the verifier now suggests both the prefix form (- zr-sq zi-sq) and the infix-with-spaces form (zr-sq - zi-sq).Repro before/after
Before:
After:
What's in the diff
c9aa5cc7 fix(verify): hint two-kebab-half subtraction in ILO-T004— extendskebab_subtract_hintinsrc/verify.rsto scan binary split points for 3+ segment idents; fires when exactly one split yields two bound names. Falls back to the legacy "atomic clarification" only when ALL segments are also bound (ambiguous case). Three new cross-engine tests intests/regression_kebab_precedence.rscover the collision-no-spaces, bare-ref-position, and ambiguous-split-fallback paths.1c1225da test: pin the two-kebab-half subtraction case via examples_engines— adds amandel zr-sq:n zi-sq:n>n;- zr-sq zi-sqline toexamples/kebab-vs-subtract.iloso the cross-engine examples harness exercises the canonical no-collision form on every engine.85e0b798 doc(spec): note hyphen-vs-subtraction whitespace rule— adds an explanatory paragraph in SPEC.md identifier-syntax section. ai.txt regenerated by build.rs.25570c34 chore: add b64/hex to SPEC reserved-names section— unrelated CI fix:regression_reserved_names_docwas failing on main since PR feature: crypto primitives - sha256, hmac-sha256, base64, hex, ct-eq (#5ag) #560 (crypto-primitives) added b64 / b64-dec / hex without updating the enumerated 3-char list. Included here so this branch passes CI; happy to split into its own PR if preferred.Test plan
cargo test --release --features cranelift --test regression_kebab_precedence— 11/11 passing including 3 new testscargo test --release --features cranelift --test examples_engines— passes with newmandellinecargo test --release --features cranelift --test regression_reserved_names_doc— passes after b64/hex additioncargo fmt --checkcleancargo clippy --release --features cranelift --no-depscleancargo test --release --features craneliftsuite — passed (only fail before this PR wasregression_reserved_names_doc, fixed by the chore commit)Follow-ups
None. This is a contained diagnostic improvement plus the necessary doc-sync.