Repository navigation
Keep generated clone and storage names distinct from script names - #402
luisleo526 wants to merge 2 commits into
Conversation
Keep generated state and callable clone identities distinct from authored members and use the same allocated identities at declarations and calls. Preserve noncolliding names and duplicate-state assertions.
Allocate composed callable and persistent-storage identities outside reserved helper families, and reserve all authored spellings before sibling-block qualification. Keep declarations, calls and history consumers on the same allocated identity. Exercise collision cases through the public pipeline.
There was a problem hiding this comment.
Graphify reviewed this change.
No issues found by static checks — no coupling regressions or blocking issues in the code graph. That is not the same as safe to merge: see what was not checked.
Not checked: tests were not run; formal verification proved 0 of 16 changed function(s) (16 not verified).
Formal verification. PR-changed functions: 0/16 verified (0 proven, 0 may-equivalent, 0 distinguished) · 16 not verified (16 unsupported).
Not verified on this run: \_\_init\_\_ (unsupported), \_visit\_VarDecl (unsupported), \_\_init\_\_ (unsupported), \_build\_func\_instances (unsupported), \_generate\_cpp (unsupported), \_inline\_history\_contexts\_for\_owner (unsupported), \_prepare\_inline\_history\_members (unsupported), \_prepare\_runtime\_scalar\_var\_initializers (unsupported), \_prepare\_udt\_generated\_names (unsupported), \_emit\_func\_def\_body (unsupported), and 6 more.
Graphify review — findings
Fixes generated C++ name collisions by allocating every generated function clone, persistent local copy and history member through one collision-aware path, so authored names such as foo_cs1 or x__blk1 can no longer overlap generated ones. Codegen now freezes each clone's name once via _func_variant_name (and _generated_class_name for var clones and __ni instances), so declarations, calls and history storage all use the same identity. The analyzer's sibling-block __blk renames now skip every name spelled in the script, using a lazily built name set from the AST. Adds a changelog entry; users need to regenerate C++ and relink affected strategies.
Review partial — this diff was larger than one review pass covers, so later files were not reviewed; some findings may be missing.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 5045 functions depend on the 971 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
CodeGen— 69 callers, 14 callees - new:
test_composed_reserved_storage_avoids_a_parameter_at_its_escape()— 0 callers, 6 callees
Verification — 5045 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 4105 function(s) in the blast radius were not formally verified this run
Cross-repo impact
Cross-repo impact
This change impacts 2 symbol(s) across 1 peer repo(s) — blast radius over derived cross-repo edges:
- pineforge-4pass/pineforge-hpo —
python/pineforge_hpo/transpile.py(via import_moniker, heuristic),tests/python/test_transpile.py(via import_moniker, heuristic)
1 peer repo(s) in this group are not yet indexed — cross-repo impact may be incomplete.
Cross-repo linkage is derived (SCIP-moniker matches are sound; name/contract matches are heuristic) and ADVISORY — it never affects this check's conclusion.
Test selection
Test selection
528 of 528 test file(s) selected (100%) via static blast radius.
Escalated to a full run for safety (
noncode-change,uncovered-code) — the selection is not trustworthy on its own (see below). CI should run the whole suite.
tests/test_action_pins.py— full-run-safetytests/test_allow_entry_in_qualifier.py— impact, full-run-safetytests/test_allow_entry_in_request_const.py— impact, full-run-safetytests/test_analyzer.py— impact, full-run-safetytests/test_analyzer_matrix_inference.py— impact, full-run-safetytests/test_analyzer_ta_return_types.py— impact, full-run-safetytests/test_anchor_tf_change.py— impact, full-run-safetytests/test_anchor_time.py— impact, full-run-safetytests/test_anchor_vwap.py— impact, full-run-safetytests/test_array_bounds_insert_fill_slice.py— impact, full-run-safetytests/test_array_checked_access.py— impact, full-run-safetytests/test_array_empty_aggregates.py— impact, full-run-safetytests/test_array_history.py— impact, full-run-safetytests/test_array_missing_integer_index.py— impact, full-run-safetytests/test_array_new_color_fill_and_na_size.py— impact, full-run-safetytests/test_array_new_defaults_and_order.py— impact, full-run-safetytests/test_array_reference_semantics.py— impact, full-run-safetytests/test_array_retained_alias.py— impact, full-run-safetytests/test_array_slice_view.py— impact, full-run-safetytests/test_array_sort_indices.py— impact, full-run-safetytests/test_array_terminal_returns.py— impact, full-run-safetytests/test_arrseg_coded_run_stops.py— impact, full-run-safetytests/test_arrseg_review_fixes.py— impact, full-run-safetytests/test_binop_operand_order.py— impact, full-run-safetytests/test_block_shadow_primitive_types.py— impact, full-run-safetytests/test_block_var_plain_siblings.py— impact, full-run-safetytests/test_bool_na_refusal.py— impact, full-run-safetytests/test_bool_na_refusals_2.py— impact, full-run-safetytests/test_bool_na_values.py— impact, full-run-safetytests/test_bool_string_inference.py— impact, full-run-safetytests/test_builtin_name_shadow.py— impact, full-run-safetytests/test_builtin_named_locals_compile.py— impact, full-run-safetytests/test_builtin_named_locals_price_refusal.py— impact, full-run-safetytests/test_builtin_named_locals_receipt.py— impact, full-run-safetytests/test_builtin_named_locals_scope.py— impact, full-run-safetytests/test_builtin_named_parameters.py— impact, full-run-safetytests/test_builtin_named_parameters_reference.py— full-run-safetytests/test_calc_on_order_fills_codegen.py— impact, full-run-safetytests/test_calendar_lambda_locals.py— impact, full-run-safetytests/test_call_argument_order.py— impact, full-run-safetytests/test_callable_local_histories.py— impact, full-run-safetytests/test_callable_series_param_types.py— impact, full-run-safetytests/test_callable_string_series_type.py— impact, full-run-safetytests/test_callable_ta_forwarded_length.py— impact, full-run-safetytests/test_callable_var_first_reach.py— impact, full-run-safetytests/test_checked_settings.py— impact, full-run-safetytests/test_ci_engine_main_touched.py— full-run-safetytests/test_clone_name_allocation.py— impact, changed-test, full-run-safetytests/test_closed_trade_fold.py— full-run-safetytests/test_closed_trade_fold_emission.py— impact, full-run-safety- … and 478 more
non-code file(s) changed (
CHANGELOG.md) → running the full suite for safety (a code graph can't see config/fixture/data deps)
changed code file(s) with no mapped test (
CHANGELOG.md,pineforge_codegen/codegen/emit_top.py) — a coverage gap or a missing link — running the full suite rather than only the selected tests
Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.
Docs that may be stale (advisory)
AGENTS.md§ Parity campaign gate (applies on EVERY harness) (lines 256-277): references changed symbolsrecord
Formal verification
Could not verify: Could not verify \_\_init\_\_.
The verifier did not have enough to check \_\_init\_\_, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)
Could not verify: Could not verify \_visit\_VarDecl.
The verifier did not have enough to check \_visit\_VarDecl, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)
Could not verify: Could not verify \_\_init\_\_.
The verifier did not have enough to check \_\_init\_\_, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)
Could not verify: Could not verify \_build\_func\_instances.
The verifier did not have enough to check \_build\_func\_instances, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)
Could not verify: Could not verify \_generate\_cpp.
The verifier did not have enough to check \_generate\_cpp, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)
Could not verify: Could not verify \_inline\_history\_contexts\_for\_owner.
The verifier did not have enough to check \_inline\_history\_contexts\_for\_owner, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)
Could not verify: Could not verify \_prepare\_inline\_history\_members.
The verifier did not have enough to check \_prepare\_inline\_history\_members, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)
Could not verify: Could not verify \_prepare\_runtime\_scalar\_var\_initializers.
The verifier did not have enough to check \_prepare\_runtime\_scalar\_var\_initializers, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)
Could not verify: Could not verify \_prepare\_udt\_generated\_names.
The verifier did not have enough to check \_prepare\_udt\_generated\_names, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)
Could not verify: Could not verify \_emit\_func\_def\_body.
The verifier did not have enough to check \_emit\_func\_def\_body, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)
Could not verify: Could not verify \_emit\_udt\_method\_cpp\_name.
The verifier did not have enough to check \_emit\_udt\_method\_cpp\_name, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)
Could not verify: Could not verify \_func\_safe\_name.
The verifier did not have enough to check \_func\_safe\_name, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)
Could not verify: Could not verify \_initialise\_safe\_names.
The verifier did not have enough to check \_initialise\_safe\_names, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)
Could not verify: Could not verify \_prepare\_lazy\_source\_clock\_sites.
The verifier did not have enough to check \_prepare\_lazy\_source\_clock\_sites, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)
Could not verify: Could not verify \_udt\_method\_call\_emit\_name.
The verifier did not have enough to check \_udt\_method\_call\_emit\_name, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)
Could not verify: Could not verify \_visit\_func\_call.
The verifier did not have enough to check \_visit\_func\_call, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: method — first parameter is `self`, which needs a constructed instance (not synthesizable)
· 1 grounded finding(s) anchored inline below; 1 more finding(s) on lines outside this diff (see the check run).
| @pytest.mark.parametrize("stem", [ | ||
| "_pf_collection_hist", "_sec7", "_precalc", "_strat", | ||
| ]) | ||
| def test_composed_reserved_storage_avoids_a_parameter_at_its_escape( |
There was a problem hiding this comment.
test_composed_reserved_storage_avoids_a_parameter_at_its_escape()
fans out to 6 callees (efferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
Summary
Generated function variants, persistent local copies and composed storage members share one C++ namespace with the names a script authors. Some spellings collided. A script name such as
acc_cs1,_pf_collection_hist_cs1orx__blk1could take the name the generator chose for one of its own copies, so two separate states could end up in one member. This change allocates generated names against both authored and generated member names, so each state keeps its own storage.Changes
_cs1and composed names that overlap collection-history or requested-context storage.Tests
tests/test_clone_name_allocation.pyadds one reproduction per collision, each with a rename control. Examples aretest_clone_and_collection_history_keep_distinct_state,test_clone_and_requested_mutable_state_stay_distinctandtest_sibling_storage_avoids_an_authored_derived_name. Further controls check that scripts without collisions keep their complete reference C++.Fixes #350