You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P1] Bound compiler nesting and return stable resource-limit diagnostics #64
At main d740bb530262c1c76a2b18c8a8aa47476f8b6b96, a roughly 256-character program with 100 parenthesis levels raises RecursionError in both compile_to_dict() and editor diagnostics(); 25 and 50 levels compile in the same environment.
source= ("strategy Deep { every 1m { if "+"("*100+"RSI < 30"+")"*100+" { observe() } } }")
Introduce explicit deterministic parser resource limits, starting with nesting depth and a positioned resource-limit error. Specify whether budgets also cover source bytes, token count and emitted nodes, using clear defaults and documented host configuration where appropriate.
Do not mutate Python's process-global recursion limit or hide arbitrary internal exceptions under a generic syntax error. Reject over-budget programs before exhausting the call stack; use iterative parsing where it materially simplifies the bound.
Acceptance
Exact-limit and one-over tests for parentheses, unary expressions, nested conditionals and long boolean chains.
Stable error code, actual source position and actionable limit diagnostic; CLI and editor agree.
No RecursionError for bounded adversarial/generated fixtures.
Valid corpus semantics, canonical bytes and existing error positions remain unchanged.
Benchmark worst-case admitted parse time/memory and publish the tested limits; no speculative performance claims.
Extend existing compiler fuzzing with these boundary cases.
Delivery
One focused main-based parser/error PR first; expand other budgets in separate PRs if necessary. #65-style machine-readable diagnostics can consume the error later, but this fix must not wait for an entire new frontend. No model/hardware use.
Implementation is reviewable in #73 (main-based, head 643cf5f698c5f95609bc84374e055dd2b8656c68). This issue remains open pending review and merge under #67.
59 dedicated limit tests cover exact/one-over parentheses, unary forms, conditionals and boolean chains; calls/index/member/arithmetic and 10,000-level adversaries; compiler/CLI/editor position agreement.
scripts/compiler_fuzz.py --refs HEAD --cases 256: five hash-seed workers, zero defects, stable corpus/semantic digests. Each worker also ran 30 resource-boundary cases / 156 adapter checks.
Existing valid compiler/library/editor/conformance corpus remains compatible; contribution checker reports 55 entries ready for review.
Independent review and 61 mixed-depth probes found no unexpected exceptions. Measured parse time and peak traced allocations are published with scripts/compiler_limits_benchmark.py in docs/compiler-limits.md.
Contract for dependent lanes: stable RESOURCE_LIMIT, exact 1-based source position, resource name and configured limit; default/tested maximum nesting 32; hosts may lower it with explicit frozen CompilerLimits. Source bytes, total tokens and emitted nodes are not budgeted in this focused PR. No recursion-limit mutation, model/provider execution or hardware use.
Hosted CI did not run: check annotations report that the GitHub account is locked due to a billing issue. The cross-version CI matrix is therefore unverified; the PR does not claim it passed. #65 is being built as a separate reviewable stack on this fix.
Activity
AetherAI3 commentedon Nov 1, 2026
Implementation is reviewable in #73 (main-based, head
643cf5f698c5f95609bc84374e055dd2b8656c68). This issue remains open pending review and merge under #67.Evidence:
py -3.11 -m pytest -q, 300.47s).scripts/compiler_fuzz.py --refs HEAD --cases 256: five hash-seed workers, zero defects, stable corpus/semantic digests. Each worker also ran 30 resource-boundary cases / 156 adapter checks.scripts/compiler_limits_benchmark.pyindocs/compiler-limits.md.Contract for dependent lanes: stable
RESOURCE_LIMIT, exact 1-based source position, resource name and configured limit; default/tested maximum nesting 32; hosts may lower it with explicit frozenCompilerLimits. Source bytes, total tokens and emitted nodes are not budgeted in this focused PR. No recursion-limit mutation, model/provider execution or hardware use.Hosted CI did not run: check annotations report that the GitHub account is locked due to a billing issue. The cross-version CI matrix is therefore unverified; the PR does not claim it passed. #65 is being built as a separate reviewable stack on this fix.