Skip to content

fix: P2 bundled diagnostic improvements from rerun7#342

Merged
danieljohnmorris merged 3 commits into
mainfrom
fix/persona-diag-batch-4
May 17, 2026
Merged

fix: P2 bundled diagnostic improvements from rerun7#342
danieljohnmorris merged 3 commits into
mainfrom
fix/persona-diag-batch-4

Conversation

@danieljohnmorris
Copy link
Copy Markdown
Collaborator

Summary

Three rerun7 P2 diagnostic / scripting fixes in one PR. Each is small, isolated, and addresses a specific persona-reported false-positive or missing hint.

  1. \x{body} Haskell/Rust lambda shorthand hint (quant-trader rerun7) - lexer hits \ followed by ident-then-{ (or ->) and emits ILO-L001 pointing at the canonical parenthesised lambda (x:t>r;body). Manifesto win: persona's first retry is the right shape.
  2. Precedence-pair hint dedupe (content-mod, ab-tester, logs-forensics, scientific-researcher rerun7) - detect_prefix_precedence_trap was suppressed inside (...) but still spammed [*/a b c] and brace-bodied uses with self-contradictory advice. Extend the immediate-predecessor suppression list to include LBracket and LBrace alongside LParen.
  3. ensure-ilo.sh direction swap (streaming-tail rerun7) - the script used string-equality only for version compare. A dev build ahead of the published release (local 0.11.6 vs published 0.11.5) hit the not-equal branch and tried to "Update from 0.11.6 to 0.11.5". Now uses sort -V to skip the upgrade when local is newer.

Repro before / after

Item 1:

$ ilo run /tmp/lam.ilo  # f xs:L n>L n;map \x{+x 1} xs
# before
error: unexpected token '\'   suggestion: Unexpected character(s): '\'
# after
error: unexpected token '\'   suggestion: `\x{body}` is a Haskell/Rust lambda shorthand.
                              ilo lambdas are parenthesised: `(x:t>r;body)`...

Item 2:

$ ilo run /tmp/list.ilo  # f a:n b:n c:n>n;hd [*/a b c]
# before
hints: ["hint: `*/a b c` parses as `(a/b)*c` ..."]   # false positive
# after
(silent — bare `*/a b c` after `;`/`=`/etc still fires correctly)

Item 3:

$ ensure-ilo.sh  # local 0.11.6, published 0.11.5
# before
Updating ilo from 0.11.6 to 0.11.5...   # downgrade!
# after
ilo is ahead of the published release (0.11.6 > 0.11.5), keeping local build

What's in the diff (per commit)

  • lexer: hint at parenthesised lambda for \x{body} shorthand - new backslash_lambda_hint helper, detection at the L001 site, five regression tests (brace, arrow, space-param, lone backslash, ident-no-brace fallback). SPEC.md gets the entry in the Cross-language gotchas table (mirrors into ai.txt and SKILL.md via build.rs). SKILL.md numbered gotchas list gets entry 8a. New examples/backslash-lambda-hint.ilo runs across every engine via the example harness.
  • main: suppress prefix-precedence hint inside [ and { grouping - one-line extension of the predecessor match in detect_prefix_precedence_trap. Three regression tests cover bracket-grouped at all four pair shapes, nested paren-inside-brackets, and a unit-level pin for both new openers.
  • scripts: skip ensure-ilo upgrade when local is newer than published - sort -V comparison after the equality check.

Test plan

  • cargo test --release --features cranelift - all 351+ tests pass
  • cargo clippy --release --features cranelift -- -D warnings - clean
  • cargo fmt --check - clean
  • Manual repro: each of the three before/after scenarios verified against the release binary
  • Example harness runs the new backslash-lambda-hint.ilo across every engine (tree, VM, Cranelift)
  • Existing precedence-trap regression tests (paren-grouped, bare, infix, etc.) still pass

Follow-ups

None. Each fix is self-contained.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 17, 2026

Codecov Report

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

Files with missing lines Patch % Lines
src/lexer/mod.rs 97.36% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Personas reaching for Haskell/Rust-style \x{body} or \x -> body inside
HOFs (map, flt, srt) saw a bare ILO-L001 'unexpected token \' with no
path forward. Logos rejects the leading backslash before we ever see the
intended shape, so the agent's first retry was a guess.

Detect the shape at the L001 site: \ followed by an ident-shaped run and
then { or ->. Emit ILO-L001 pointing at the canonical parenthesised
lambda (x:t>r;body) with a concrete map example. Lone \ and \foo with
no brace/arrow fall back to the generic hint.

Add the entry to the Cross-language gotchas table in SPEC.md (which
mirrors into ai.txt and SKILL.md via build.rs) and to the numbered
gotchas list in SKILL.md. New examples/backslash-lambda-hint.ilo
demonstrates the three common shapes (map, flt, srt) and runs across
every engine via the example harness.

quant-trader rerun7.
detect_prefix_precedence_trap suppresses on LParen predecessor since the
parenthesised form is the canonical disambiguation the hint itself
suggests. But authors using list literals ([*/a b c]) or brace-bodied
expressions ({*/a b c}) have applied the same explicit-grouping
discipline, just with different delimiters. The hint still fired and
spammed those shapes with self-contradictory advice.

Extend the immediate-predecessor suppression list to include LBracket
and LBrace alongside LParen. Bare *\/a b c after =/;/etc still fires.

Adds three regression tests (bracket-grouped at all four pair shapes,
nested paren-inside-brackets, unit-level pin for both new openers).

content-mod, ab-tester, logs-forensics, scientific-researcher rerun7.
ensure-ilo.sh compared CURRENT_VER and LATEST with string equality only.
A dev build ahead of the published release (local 0.11.6 vs published
0.11.5) hit the not-equal branch and printed 'Updating ilo from 0.11.6
to 0.11.5...' before downloading the older binary over the newer one.

Add a sort -V comparison after the equality check: skip the upgrade
when CURRENT_VER sorts strictly after LATEST. The original 'Updating
...' message only prints when the local version is genuinely behind.

streaming-tail rerun7.
@danieljohnmorris danieljohnmorris force-pushed the fix/persona-diag-batch-4 branch from 242b1de to 0b5dd38 Compare May 17, 2026 14:38
@danieljohnmorris danieljohnmorris merged commit 3f10110 into main May 17, 2026
5 checks passed
@danieljohnmorris danieljohnmorris deleted the fix/persona-diag-batch-4 branch May 17, 2026 14:47
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