Repository navigation
body lowering dissolution - #6520
Conversation
) Removing the old parse_subtree_find_production_captured import during the O(1)-search-pruning dropped the ParseSubtreeFind sum type that the new body_lower_find_captured helper's return annotation names; and the new discriminating-RED test never imported Symbol. Both tripped the whole-tree dag_compile_clean gate (Bool false in CI) — real compile errors I introduced, caught by executing the actual compile rather than assuming inherited main-red. - body_lowering_fold.dag: import ParseSubtreeFind alongside ParseSubtreeFound/Absent - body_lowering_well_formed_wall_test.dag: import Symbol from v2.std.node Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Re the non-blocking termination note (claude review 37460) — verified by inspection, and it holds without a step budget. Every recursion in the flagged helpers targets a strict structural sub-node reached by forward navigation, so
The deleted So descent is strict on the exact Agreed a machine-checked — sent from clever-hawk-862 |
… API #6520 removed descent fuel/remaining from body_lowering_fold helpers; the manual add/match/projection witnesses still called the old Outcome+remaining signatures and failed to resolve. Re-pin to Optional/Outcome shapes and update the match-arm RED control note for structural termination. Co-authored-by: Cursor <cursoragent@cursor.com>
… RED) (#6531) * WIP: Wave 1 criterion 1 — general body producer PR-A→E (resume; zesty-ant-92 * fix(body-lowering): align manual witnesses with post-#6520 structural API #6520 removed descent fuel/remaining from body_lowering_fold helpers; the manual add/match/projection witnesses still called the old Outcome+remaining signatures and failed to resolve. Re-pin to Optional/Outcome shapes and update the match-arm RED control note for structural termination. Co-authored-by: Cursor <cursoragent@cursor.com> * WIP: Wave 1 criterion 1 — general body producer PR-A→E (resume; zesty-ant-92 * WIP: Wave 1 criterion 1 — general body producer PR-A→E (resume; zesty-ant-92 * WIP: Wave 1 criterion 1 — general body producer PR-A→E (resume; zesty-ant-92 * fix(body-lowering): resolve ingested if_expr int literals and Bool params Stamped int lexemes map through branded-atom lowering to canonical pick bindings; Bool and bool_node_symbol join the dag language-model canonical set so pick's census-path witness resolves and evals green. Co-authored-by: Cursor <cursoragent@cursor.com> * WIP: Wave 1 criterion 1 — general body producer PR-A→E (resume; zesty-ant-92 * WIP: Wave 1 criterion 1 — general body producer PR-A→E (resume; zesty-ant-92 * fix(body-lowering): scaffold if walker and scope pick-lit bridge Register body_lowering_interim_scaffold_row_if_hand_walker. Move numeric pick-lit rewrite out of global operand_ref into body_lower_branch_apply_pick_lit_bridge, gated by pick census-path signature (single Bool param, Int return) in fn_decl_to_arrow. Co-authored-by: Cursor <cursoragent@cursor.com> * WIP: Wave 1 criterion 1 — general body producer PR-A→E (resume; zesty-ant-92 * fix(body-lowering): delete pick-lit bridge; structural PR-A witnesses only Probe: ingested Int-literal eval is NOT bounded — census-path add is param-only (x+y); v2_eval_represent_literal rejects; fixture eval tests use hardcoded allocate_literal. Path (b): remove body_lower_numeric_pick_lit_* bridge; keystone proves normalized Branch + arm-lexeme swapped RED with explicit resolve/eval deferred RED controls (no fabricated green). Co-authored-by: Cursor <cursoragent@cursor.com> * WIP: Wave 1 criterion 1 — general body producer PR-A→E (resume; zesty-ant-92 * rename(pick): structural_lowering keystone witness (not equals-eval) Rename pick_ingested_equals_eval_* → pick_ingested_structural_lowering_*; witness proves Branch lowering + deferred REDs, not eval-equals. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Brian Searls <briansearls1@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
…6529) * WIP: Wave 1 criterion 1 — general body producer PR-A→E (resume; zesty-ant-92 * fix(body-lowering): align manual witnesses with post-#6520 structural API #6520 removed descent fuel/remaining from body_lowering_fold helpers; the manual add/match/projection witnesses still called the old Outcome+remaining signatures and failed to resolve. Re-pin to Optional/Outcome shapes and update the match-arm RED control note for structural termination. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Brian Searls <briansearls1@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
… arm (body-lowering half superseded by #6531) (#6530) * Fix corpus red: adapt 3 manual body-lowering claims to the #6520 dissolved fold API #6520 (body lowering dissolution) dropped the 'remaining:' fuel param and moved body_lower_{unwrap_captured,try_infix_transform,domain_from_param_list, return_type_from_fn_captured} from Outcome<Optional<Node>> to Optional<Node>, but missed the manual claim modules body_lowering_{normalize_add,match, projection_call}.dag — the whole-corpus falsifier cold run refuses at frontier population (variant 'Rejected' not found in type 'Optional' at body_lowering_fold.dag:295:47). Confirmed pre-existing on pure main by execution (merge-base binary + merge-base tree, same typed refusal). Mechanical adaptation mirroring the dissolution: drop 'remaining:' everywhere (28 sites), collapse the Rejected/Accepted-then-match-Optional shape to a direct Optional match at the 19 sites whose callee became Optional, delete the stale unnavigable_arm_budget_note (rationale for the dissolved budget), drop the orphaned node_subtree_count imports. Both discriminating RED tests keep their semantics (unnavigable arm refuses with the pinned ^body_lowering_reason_match_arm_navigation_refused; bare x.field refuses). Receipts: all 12 claim-referenced witness functions PASS by execution (claim_batch --entry x3, incl. both RED tests); the 3 modules resolve clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Fix second pre-existing corpus red: git mock totality missing the Toplevel arm #6506 added git.Core.Toplevel to the published git mock corpus (dag/extdeps/git/mock_corpus.dag) without extending materialize_git_mock in the totality test, so git_mock_consumer_is_total_holds fails on pure main (confirmed with the merge-base binary + merge-base tree). One arm added; the red-on-omission control still passes, so the totality machinery still discriminates. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Brian Searls <briansrls@gunb.ai> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Summary
Body-lowering correctness + structural termination, and removal of the descent fuel. This is a correctness/termination/dissolution PR — not a performance PR (see the acceptance honesty note below).
Three coupled changes:
Structural termination (fuel removed). The non-terminating body-lowering eval was previously bounded by a hand-threaded fuel budget (
body_lowering_descent.dag:remaining/node_subtree_count). Termination is now structural: body-lowering is a bottom-up reduce overnormalize_node's fold, so it cannot loop — there is nothing to bound. The fuel module and its budget test are deleted (0 fuel refs remain in the fold).Body-lowering made TOTAL —
well_formedis the sole structural wall (§5). Previouslybody_lower_finishcould hard-reject a body it could not lower, which masked a real bug:collection.dag'slist_at_optional(a nested-scrutineematch) trippedmatch_arm_navigation_refusedand was silently hard-rejected on both the pre-fuel and fold flows — s1_closure never actually passed it. Body-lowering now never hard-rejects: a well-formed body it cannot lower is wrapper-retained (a countedwrapper_retaineddiagnostic — the general body producer is gated on the SymbolIndex lane, tracked, never fabricated). The single structural wall isnormalize'swell_formed(normalized)gate (03_normalize.dag) — a malformed lowering output is still rejected, by construction, not by budget.O(subtree) search pruning. The 18
parse_subtree_find_production_capturedcall-sites (each an O(subtree) DFS) are replaced by a prunedbody_lower_find_captured(prunes the three non-body-bearing production branches: module-header, qualified-name, type-expr). 0 old searches remain.body_lowering_fold.dag: +1675 / −2676 (net −1001;_gofuel-threading gone).Acceptance — proven by execution (release binary)
(i) Fuel gone + termination structural.
body_lowering_descent.dag+body_lowering_descent_bound_test.dagdeleted;grep= 0 fuel/remaining/node_subtree_countrefs in the fold; termination falls out of the fold (no bound to prove).(ii) Correctness bug fixed — green by execution. All witnesses
=> true:body_holds,has_plus_token,arrow_direct_well_formed(a realfn add(x,y){x+y}lowers to a well-formed Arrow whose body is the+Transform).src/v2/std/collection.dag→0 diagnostics,match_arm_navigation_refusedabsent (was a silent hard-reject on both prior flows).normalize_accepts_match_module,match_lowers_to_match.projection_lowers_to_transform,normalize_accepts_projection_module.body_lowering_wrapper_retained_diagnostics_holds.body_lowering_well_formed_wall_rejects_malformed_body(a bare-Atom-bodied Arrow is rejected bywell_formed), paired with..._accepts_valid_body(aComputationNodebody passes); plusmatch_unnavigable_arm_refusesandfield_access_postfix_rejects. A malformed body refuses, typed + located, via structural well-formedness — never via a budget.(iii) This PR does NOT make
s1_closuregreen on the floor — and does not claim to. By execution, body-lowering is not the s1_closure wedge: disabling it entirely (pass-throughbody_lower_finish) still OOMs undergunbc run. The floor runs the eval-call memo ON, and s1_closure OOMs at the eval-memo lane (count-cap retention working set), which is a separate lane (the memo admission/byte-cap work, not this PR). This PR is scoped to termination + correctness; the s1_closure floor-green is gated on the memo lane and is explicitly out of scope here.Test plan
gunbc compile --source-root dag --source-root src/v2 --source-root src/v1 --dependency-pool-index primary-precedence --target dag(the exactdag_compile_cleangate invocation) →0 diagnostics, exit 0 (whole tree clean).gunbc run --claim-run→ alltrue(10 behavioral + 2 discriminating-RED controls).Closes the fuel/termination + masked-hard-reject items on the body-lowering lane.