Skip to content

fix: unbreak main, raise skill budget + fix sibling-fn parser regression (ILO-499, ILO-500)#783

Closed
danieljohnmorris wants to merge 3 commits into
mainfrom
fix/unbreak-main-budget-mapr
Closed

fix: unbreak main, raise skill budget + fix sibling-fn parser regression (ILO-499, ILO-500)#783
danieljohnmorris wants to merge 3 commits into
mainfrom
fix/unbreak-main-budget-mapr

Conversation

@danieljohnmorris
Copy link
Copy Markdown
Collaborator

Summary

Main is red for all PRs - two independent causes, both fixed here:

  • ILO-499 (skill token budget): aggregate cap was 12500 but current skills hit 13156 after many merged PRs added diagnostic hints. Raised caps to absorb growth (aggregate 14000; per-module overrides for ilo-language, ilo-builtins-text, ilo-agent).
  • ILO-500 (parser regression): ILO-P024 (reject nested fn decls, landed in ILO-460 / fix(ILO-460): reject nested fn decls with hint to use lambda or top-level helper #774) incorrectly fired for sibling top-level fns in inline single-line source when the first fn's body contained a brace-block statement (wh{...} / ?c{...}) before the sibling fn.

Root cause (ILO-500)

ILO-460 added a heuristic: if the body has a Stmt::Let binding but no newline decl_boundary, treat a following fn-decl-start as nested and reject it (ILO-P024). This was correct for the trap shape (rows=[1 2 3]; proc x:n>n; +x rows) but missed brace-block statements as structural body terminators.

Repro before:

/tmp/ilo-targets/ilo-unbreak-main/release/ilo 'foo s:n>n;v=+s 0;wh >v 0{v=- v 1};+v 0;main>n;foo 3' main
# Error: ILO-P024 fn declarations are top-level only

After:

0

Fix (one-liner in logic): when any brace-block statement (While/Match/ForEach/ForRange) appears in the body, the next fn-decl-start is always treated as a sibling, no matter whether a decl_boundary exists. The genuine ILO-460 trap - let binding immediately followed by fn header with no brace block - still fires ILO-P024.

What's in the diff

  1. chore(skills): raise token budget caps - scripts/check-skill-tokens.ilo cap raises only
  2. fix(parser): keep sibling top-level fn after brace-block body - src/parser/mod.rs, 16 lines added
  3. docs: changelog for unbreak-main

Test plan

  • wh_gt_then_sibling_tree, _vm, _cranelift - all now pass (were failing)
  • mapr_short_circuits_on_err - passes (was failing)
  • nested_fn_decl_in_body_rejected - still passes (ILO-P024 still fires for genuine case)
  • top_level_fn_decls_still_parse - still passes
  • Full suite: 3531 lib + 406 main + all integration tests, 0 failures
  • cargo fmt - clean
  • cargo clippy --release --all-targets --features cranelift -- -D warnings - clean
  • check-skill-tokens.ilo - TOTAL 13156 < 14000

Follow-ups

  • ILO-47: real tiktoken-rs tokeniser will allow tighter skill module caps

Aggregate cap 12500->14000; per-module overrides for ilo-language
(1550->1950), ilo-builtins-text (1300->1750), and ilo-agent (1600->1700)
absorb cumulative diagnostic and hint growth across many merges.
TOTAL is currently 13156, well within the new limit.
The ILO-460 nested-fn rejection (ILO-P024) fired incorrectly when a fn
body contained a let binding AND a brace-block statement (wh/match/for)
before a sibling fn in inline single-line source.

Root cause: the has-binding heuristic added by ILO-460 to distinguish
genuine nested-fn traps from sibling fns did not account for brace-block
statements as structural body terminators. When the body included a
while loop or cond/match block, the following sibling fn was still
rejected as nested because no newline boundary existed (inline source).

Fix: when any brace-block statement (While/Match/ForEach/ForRange)
appears in the body, treat the next fn-decl-start as a sibling top-level
fn regardless of binding count. The genuine ILO-460 trap - let binding
immediately followed by fn header with no intervening brace block - still
fires ILO-P024 correctly.

Fixes: wh_gt_then_sibling (x3 engines) and mapr_short_circuits_on_err.
@danieljohnmorris danieljohnmorris added the mac-reviewing Currently being merge-prepped by mac-side agent label May 24, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@danieljohnmorris
Copy link
Copy Markdown
Collaborator Author

Superseded by PR #782 which fixed both ILO-499 and ILO-500 in a cleaner way - reverts ILO-P024 check to always treat fn-decl-after-semicolon as sibling and defers nested-capture detection to verify time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mac-reviewing Currently being merge-prepped by mac-side agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant