Skip to content

fix(verify): steer T004 to the unglue fix for main-level bindings (ILO-546) - #790

Open
danieljohnmorris wants to merge 5 commits into
release/26.8from
fix/script-mode-fn-scope
Open

fix(verify): steer T004 to the unglue fix for main-level bindings (ILO-546)#790
danieljohnmorris wants to merge 5 commits into
release/26.8from
fix/script-mode-fn-scope

Conversation

@danieljohnmorris

Copy link
Copy Markdown
Collaborator

Summary

  • One-line glued scripts (sts=[..];ws=[..];grd a:n>t;..;@s sts{..}) put everything after the fn header into that fn's body, so top-level bindings are genuinely out of scope and ILO-T004 fires - but the old hint appended the ILO-504 enclosing-fn lambda advisory, steering repair models the wrong way. This was grade-calculator's 3/3 failure in the N=5 bench.
  • VerifyContext now records main's top-level Let names; when the undefined name is one of them (and we're not in main), the hint names the one-edit fix: put the statement on its own unindented line.
  • Ticket's original diagnosis (multi-line interleaved decls broken) was wrong - that shape always worked; pinned by regression tests.

Companion (separate branch)

Bench harness ILO_SYSTEM prompt no longer instructs 'compact one-liners' - semicolons within bodies only, own-line top-level statements.

Tests

  • tests/regression_script_scope_hint.rs: glued form gets the new hint (and not the lambda advisory); multi-line interleave, decl-after-statements, multi-decl shapes all run; lambda advisory survives for non-main names.
  • Full suite green except 2 pre-existing failures on release/26.8 tip (coverage_parser::builtin_as_decl_name, stmt_builtin_let_rejected) - broken by 69565d4 (builtin-shadow feature) before this branch, unrelated.

Linear: ILO-546

…O-546)

When a one-line script glues statements after a fn header with ';', those
statements join the fn body (documented script-mode rule) and lose access
to top-level bindings. T004 then fired with the ILO-504 lambda advisory,
which steers a repairing model toward captures instead of the one-edit
fix. Track main's top-level Let names in VerifyContext and, when the
undefined name is one of them, name the real fix: put the statement on
its own unindented line.

Multi-line interleaved decls were never broken (ticket's original
diagnosis was wrong); regression tests pin both shapes plus the surviving
lambda advisory for genuine capture attempts.
rust.yml fired only on main/next, so every PR into release/26.8 merged
with no build, test, fmt or clippy gate - the empty check list on #789
and #790. Release branches are the live integration line for a version;
they need the same gate as main.
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.07143% with 5 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/verify.rs 85.71% 3 Missing ⚠️
src/parser/mod.rs 93.93% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

`prnt fmt2(3.14, 2)` and `prnt at([5 6 7], 1)` failed with ILO-P003
'expected `)`, got `,`': parse_call_arg handled zero-arg `name()` but
not the adjacent paren-form arg list, so the arity-driven positional loop
parsed the group as a parenthesised expression and died on the comma.
User-fn calls were unaffected, which is why it read as a builtin-only bug.

Adds the same adjacency branch the statement-head and operand positions
already carry, and extends trailing operands inline up to the known arity
(ILO-544's `at([5 6 7])1`) rather than via paren_call_atom, which only
parse_call_or_atom consumes and would leak into an unrelated atom here.
Eight lint failures had accumulated while the Rust workflow was not
running on release branches. Mostly mechanical (identity map, unused
bindings, needless refs, useless format!). Two were real:

- The 2-arg `rou x digits` verifier arm was unreachable because `rou`
  also appeared in the 1-arg math-builtin arm, so the digits argument
  was never type-checked. `rou 3.1 "x"` now reports ILO-T013.
- Duplicated min/max and rou branches in the arity-hint chain collapsed
  into one matches!.
69565d4 made builtin names legal as bindings (they shadow the builtin in
value position, call position still dispatches it) but updated no tests,
and the Rust workflow was not running on release branches, so the breakage
stayed invisible. Five suites asserted the old ILO-P011 rejection:

- coverage_parser: the two builtin-binding cases now assert acceptance.
- regression_builtin_binding_name: rewritten around the new contract. The
  original persona bug (use site mis-dispatching to the builtin and
  reporting a bogus ILO-T006) is still pinned, now by asserting the use
  site resolves to the local. Adds a case for call position still
  dispatching the builtin, the half most likely to be broken later.
- regression_multi_line_body_span_drift: fixtures used `rev =` purely as
  an error vehicle for the span assertions; swapped to `fld`, which is
  still hard-reserved, so the spans are what is under test again.
- regression_listlit_builtin_call_hint: fmt2 has gained a known arity, so
  the list-literal shape parses correctly and ILO-P101 no longer fires
  for it. Asserts the parse; `fmt` (variadic) still covers P101.
- regression_top_level_chain_hint: the map= case now asserts the binding
  runs and that P102 does not swallow it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant