Repository navigation
feat(complexity_gate): infer-perf composed-lens guard (follow-on to #5135) - #5139
gunbai-bot[bot] wants to merge 15 commits into
Conversation
…esses Root cause for 244s body_producer resolve was decode_value_expression_projection_bundle (15-deep bind_outcome in target_model, ~287s analyze_item), not body_producer itself. Shard into one-bind chain steps (244s→~23s). Execution instrumentation confirms H2a: substitute_generics 13446 calls / 169 distinct sites (ratio 79.6) — memo deferred to merry-owl cache-kernel consolidation per §3. Adds §5 witness (bounded resolve + wrong-type RED). Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Accidental removal of Commands::Ci and extdeps_shape_transport_policy_project broke CI (`gunbc ci` unrecognized). Restore both alongside generic-inst instrumentation. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep generic_instantiation_instrument and interface_elaboration_instrument modules from the perf-fix branch. Co-authored-by: Cursor <cursoragent@cursor.com>
…ducers Empty `diagnostics: []` failed resolve (Diagnostics is None | Some, not List). Co-authored-by: Cursor <cursoragent@cursor.com>
Remove generic_instantiation_instrument and interface_elaboration_instrument (hand-Rust scaffolding with no dissolution receipt). H2a localization and the structural perf fixes are proven; hooks added per-call overhead on substitute_generics/build_type_env/typecheck_module. Guard enrollment tracks in follow-on #5139. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Verified — this REQUEST_CHANGES is correct. #5139 (branched at merge-base b63934d, before the removal commits) still carries generic_instantiation_instrument / interface_elaboration_instrument wired into the infer hot path, the claim_batch.rs reset/eprint_report hooks, and the languages_import_elaboration_profile_test harness. Resolution is at the root, not a patch here: these exact scaffolds were ALREADY removed on #5135 @ a47cd9d — both modules deleted, all production/CI hooks gone (verified). #5139 is the complexity-gate guard FOLLOW-ON, sequenced to rebase onto #5135 after it lands; that rebase brings in the instrument removal and clears this finding, rather than patching a base that is about to be rebased away. #5139 is in DRAFT and not a merge candidate yet for two reasons beyond the rebase:
REQUEST_CHANGES acknowledged; it resolves via the rebase + the rework above, and #5139 stays draft until then. — sent from merry-crab-687 |
|
Closing this follow-on — it is blocked and must restart from a rebased base, so a perpetually-draft PR is misleading. Specifics:
|
…3/§7 REQUEST_CHANGES: model substitute_generics_apply identity short-circuit in 04_infer.dag + regen seed (#5146) * WIP: Resolve/infer perf fix: 03_body_producer.dag 244s super-linear infer (H1 * WIP: Resolve/infer perf fix: 03_body_producer.dag 244s super-linear infer (H1 * WIP: Resolve/infer perf fix: 03_body_producer.dag 244s super-linear infer (H1 * WIP: Resolve/infer perf fix: 03_body_producer.dag 244s super-linear infer (H1 * WIP: Resolve/infer perf fix: 03_body_producer.dag 244s super-linear infer (H1 * fix(infer): shard target_model VEP decode; confirm H2a; add perf witnesses Root cause for 244s body_producer resolve was decode_value_expression_projection_bundle (15-deep bind_outcome in target_model, ~287s analyze_item), not body_producer itself. Shard into one-bind chain steps (244s→~23s). Execution instrumentation confirms H2a: substitute_generics 13446 calls / 169 distinct sites (ratio 79.6) — memo deferred to merry-owl cache-kernel consolidation per §3. Adds §5 witness (bounded resolve + wrong-type RED). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(stage0): restore gunbc ci subcommand dropped by regen Accidental removal of Commands::Ci and extdeps_shape_transport_policy_project broke CI (`gunbc ci` unrecognized). Restore both alongside generic-inst instrumentation. Co-authored-by: Cursor <cursoragent@cursor.com> * WIP: Resolve/infer perf fix: 03_body_producer.dag 244s super-linear infer (H1 * WIP: Resolve/infer perf fix: 03_body_producer.dag 244s super-linear infer (H1 * WIP: Resolve/infer perf fix: 03_body_producer.dag 244s super-linear infer (H1 * WIP: Resolve/infer perf fix: 03_body_producer.dag 244s super-linear infer (H1 * WIP: Resolve/infer perf fix: 03_body_producer.dag 244s super-linear infer (H1 * fix(complexity_gate): use outcome_accepted for infer-perf subject producers Empty `diagnostics: []` failed resolve (Diagnostics is None | Some, not List). Co-authored-by: Cursor <cursoragent@cursor.com> * chore(#5135): move composed-lens guard to follow-on #5139 #5135 is fix-only per sequencing: substitute_generics + VEP shard + execution witnesses. Complexity_lens roster enrollment tracked in #5139. Co-authored-by: Cursor <cursoragent@cursor.com> * WIP: Resolve/infer perf fix: 03_body_producer.dag 244s super-linear infer (H1 * fix(#5135): drop investigation instrumentation from production hot paths Remove generic_instantiation_instrument and interface_elaboration_instrument (hand-Rust scaffolding with no dissolution receipt). H2a localization and the structural perf fixes are proven; hooks added per-call overhead on substitute_generics/build_type_env/typecheck_module. Guard enrollment tracks in follow-on #5139. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(#5135): register map_is_empty in v1 builtin registry substitute_generics uses map_is_empty(subst) in 04_infer.dag; without builtin_function_registry entry it fell through to unit_type() and diverged from hand-synced Rust. Wire .dag authority + seed + interpreter. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(#5135): model substitute_generics_apply identity short-circuit in 04_infer.dag Resolves the §3/§7 REQUEST_CHANGES: the seed's substitute_generics_apply preserved Node identity via a short-circuit (Rc::ptr_eq on the resolved inferred node + rc_vec_ptr_eq on children/params) that the .dag never modeled and could not emit — a second authority for infer behavior in a "do not edit" generated seed. Model it in 04_infer.dag as a SOUND IDENTITY HINT (true => structurally equal): recurse children/params/inferred, return the original n when all are unchanged, else rebuild. Surface the primitives as ordinary builtins with OWNED Rc signatures (cheap refcount bump preserves inner pointers), so they emit through the normal clone path — no all-args-by-ref emit rule and no emit-logic change: - runtime_rust.dag: add rc_ptr_eq, flip rc_vec_ptr_eq to owned + contract - extdeps/languages/rust/emit.dag: register map_is_empty, rc_ptr_eq, rc_vec_ptr_eq in rt_function_registry (map_is_empty also never round-tripped before — fixed here) - 04_method.dag: register rc_ptr_eq/rc_vec_ptr_eq result types - v1_interpreter.rs: value-equality realization of the same contract Seed regenerated via regen_stage0 from the .dag (round-trip proven: the emitter now produces v1_rt::rc_ptr_eq(new_rt.clone(), rt.clone()) etc.). Narrow seed update only — a blanket regen also rewrites unrelated files (emit_rust.rs wire_variant_tag_for_policy, extdeps_cargo.rs) byte- identically on main too, a pre-existing emit non-fixpoint tracked separately; adopting it would regress the seed (broken /* Type */ placeholder), so it is out of scope here. Also fixes pre-existing PR-branch CI dirtiness: cargo fmt on build_type_env + the perf witness/profile tests, and #[cfg(test)] on the profile test module (the lone module missing it, which failed clippy --all-targets). Proof: crate builds, clippy --all-targets -D warnings green, fmt clean, body_producer_infer_perf_witness green (clean resolve + wrong-type RED). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Brian Searls <briansrls@gunb.ai> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
Tracked follow-on to #5135 — enrolls the infer-perf pathologies in the existing
subject_complexity_budget_roster+complexity_lensmachinery (no parallel budget authority).What the roster measures (pinned by reading
v2/lens/complexity.dag):complexity_lens= asymptotic projection ofcost_lens→SymbolicCost→AsymptoticClass(Constant / Linear / Polynomial / …). It is Big-O class over Node-tree symbolic cost, NOT concrete op-count. Cardinality fold →LinearCost; nested Cardinality →ProductCost→ multidimensional polynomial (nested_testreceipt).Discrimination by execution (claim_batch receipts):
infer_substitute_tree_x_subst_semantic_red_holdsPASS — pre-fix nested-Cardinality fixture FAILS linear declared budget; post-fixinfer_substitute_budget_claim_holdsPASS.infer_vep_mega_closure_semantic_red_holdsPASS — pre-fix nested fixture FAILSConstantComplexity; post-fixinfer_vep_decode_budget_claim_holdsPASS.Coverage honesty: VEP row uses nested-Cardinality pathology model (not literal
bind_outcomedepth counting —Bindis zero-cost incost_lens). If real decode-tower depth is too coarse for Big-O class alone, axis extension lands in this PR coordinated with quiet-swift (one roster, extended — never forked).Depends on
#5135 (perf fix: substitute_generics
map_is_empty+ target_model VEP shard)Test plan
claim_batchsemantic RED witnesses (pre-fix dominance FAIL)claim_batchGREEN budget claims (post-fix dominance HOLD)complexity_budget_roster_family_gate_holdsMade with Cursor