Skip to content

Resolve empty timeframe arguments, keep reference types across calls, and keep generated names distinct - #405

Merged
luisleo526 merged 28 commits into
mainfrom
fix/issues-394-390-350-stack
Nov 15, 2026
Merged

luisleo526 merged 28 commits into
mainfrom
fix/issues-394-390-350-stack

Conversation

@luisleo526

Copy link
Copy Markdown
Contributor

This pull request combines three fixes so that they land together. It supersedes #401, #403 and #402, whose fixes it contains.

Empty timeframe arguments (#394)

Empty timeframe string arguments now resolve as the chart timeframe across the timeframe functions, matching the documented meaning of an empty timeframe:

  • timeframe.in_seconds("") returns the chart's seconds;
  • timeframe.change("") fires when the chart period changes.

It also fixes a false refusal of valid namespace-qualified reads that an earlier version introduced. Sizing constants keep their Pine string type for these string consumers, so a reassigned sizing variable is converted to its integer code where a strategy risk call needs one. The risk tests check that the call reads the variable's current value after its write.

Tests: regression tests for each empty, explicit and omitted timeframe argument form, which fail on the base and pass with this change. One version-5 case uses a version-6 caller importing a version-5 library, which is the supported route for version-5 code.

Reference types across fields and function calls (#390)

Valid Pine v6 scripts could generate C++ that did not compile in three cases:

  • assigning na to a drawing or array field;
  • passing a drawing handle through a user function or tuple;
  • keeping a polyline handle in a local or UDT field.

The fix:

  • preserves the destination storage type for missing reference values;
  • passes drawing handles as values across function and tuple boundaries;
  • retains polyline handle types for declarations and deletion calls.

Reproduction tests are in tests/test_reference_handle_lowering.py, for example test_reference_field_na_uses_the_field_type and test_polyline_field_and_cast_preserve_typed_reads_and_delete.

Generated clone and storage names (#350)

Generated function variants, persistent local copies and composed storage members share one C++ namespace with the names a script authors. A script name such as acc_cs1, _pf_collection_hist_cs1 or x__blk1 could take the name the generator chose for one of its own copies, so two separate states could end up in one member. Generated names are now allocated against both authored and generated member names, and typed method names already established by main are kept.

Reproduction tests are in tests/test_clone_name_allocation.py, for example test_clone_and_collection_history_keep_distinct_state and test_sibling_storage_avoids_an_authored_derived_name.

All changelog entries are kept.

Fixes #394
Fixes #390
Fixes #350

Resolve dotted builtin signatures consistently and preserve explicit strings,
chart-period fallback and single evaluation. Reserve generated conversion names.
The existing symbol-clock anchor tests now check both calls in the emitted
empty-argument conditional. Add pure-Python checks of branch direction and
single evaluation, and make the temporary-name sweep reach the argument lambda.

Product code is unchanged by this test update.
Lower missing reference values to their destination storage and retain drawing
handle types through user functions and tuple returns. Support declared
polyline types, fields and deletion arguments.
Read optional function metadata safely when inferring reference casts, so bare
emitters retain matrix element types without raising an AttributeError.
Use the chart period for a generic missing timeframe argument and refuse
numeric values for string parameters during analysis. Cover named arguments,
helper calls, source locations and generated translation units.
Include only the stock-generated PF-E2095 definition and pin. Preserve all
prior catalog entry bytes and their existing order.
Merge the current main while retaining the feature correction.
Merge the current main while retaining the feature correction.
Use recognized Pine types in declared type slots to resolve equally literal
diagnostic templates. Keep stable code order for other ties and preserve
qualifier identities, raw arguments and rendering. Pin the timeframe type
diagnostic and its named arguments with direct regression controls.
Reject non-string timeframe arguments through the intrinsic signature before
C++ lowering, including helper parameters and boolean values. Preserve valid
string calls and exercise complete native controls at distinct optimization
levels. Declare the new diagnostic in the existing catalog delta fixture.
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.
Carry the generated argument-type entry and its pin into the member while
preserving all other catalog bytes and order. Use the grammatical message
and exact approved user presentation with the existing argument kinds.
Retain the same numeric refusal cases and qualifier controls.
Use the argument occurrence within the call instead of an identically
named helper parameter. Keep the exact line and column assertions and
all source inputs, diagnostic identities and test rows unchanged.
Carry registered namespace types through the semantic query used for written
helper calls while respecting lexical shadowing and version boundaries.
Reuse the existing expression-start locator for timeframe type refusals.
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.
Keep raw typed-method names on the function channel when they collide with
authored data members. Continue allocating encoded names and collisions with
generated storage so method definitions, calls and state stay distinct.
Sizing constants keep their Pine string type for the string consumers this
change fixes, so a reassigned sizing variable reaches the risk host boundary
as a string and is converted to its integer code there. Keeping the integer
comparison would need integer storage for these variables, which the string
consumers cannot use. The test still requires the call to read t after its
write, never its initializer, and now also checks the code chosen for the
assigned value.
Merge the empty timeframe argument fix (#394) with the reference type fix for
fields and function calls (#390). Both changelog entries are kept.
Merge the generated clone and storage name fix (#350) into the combined
#394 and #390 fixes. All changelog entries are kept.

@graphify-labs graphify-labs Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Graphify reviewed this change.

Worth a look — the grounded gate found no coupling regressions or blocking issues, but 2 advisory finding(s) below merit a look before merge.

Not checked: tests were not run; formal verification proved 0 of 44 changed function(s) (2 sampled, not proven, 42 not verified).

Formal verification. PR-changed functions: 2/44 verified (0 proven, 2 may-equivalent, 0 distinguished) · 42 not verified (23 unsupported, 19 over cap).

Not verified on this run: \_\_init\_\_ (unsupported), \_operator\_operand\_type (unsupported), \_visit\_FuncCall (unsupported), \_visit\_MemberAccess (unsupported), \_visit\_VarDecl (unsupported), \_check\_node (unsupported), \_\_init\_\_ (unsupported), \_build\_func\_instances (unsupported), \_generate\_cpp (unsupported), \_inline\_history\_contexts\_for\_owner (unsupported), and 13 more; 19 changed function(s) beyond the cap and 0 skipped when the time budget ran out.


Graphify review — findings

Adds a pre-emission PF-E2095 check that refuses non-string timeframe.* arguments, and makes timeframe.in_seconds and timeframe.change resolve an evaluated empty string to the chart period, evaluating the argument once. The check compares each bound argument's inferred type to string, and lets bare na and still-untyped helper parameters through. Keeps strategy sizing constants as strings through expressions, aliases and helper calls, converting to numeric only at the host order/risk setting boundary. Polyline locals, array elements and UDT fields now hold opaque handles that default to missing, while polyline.new and delete stay visual no-ops that evaluate their arguments once. Allocates sibling-block __blk storage, generated function variants and persistent locals against every identifier spelled in the script, and escapes names that look like integer-to-float temporaries, so authored names can't collide with generated members.

Worth a look

  • Qualified string timeframe arguments are rejected — pineforge_codegen/analyzer/base.py:7495 · Escalate · medium
    • unverified hypothesis — survived the adversarial refute pass; needs human review
  • polyline.copy() is not inferred as a polyline — pineforge_codegen/analyzer/types.py:616 · Escalate · medium
    • unverified hypothesis — survived the adversarial refute pass; needs human review

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 — 6601 functions depend on the 2148 functions this change touches.

Health — this change adds coupling hotspots:

  • worse: Analyzer — 113 callers, 15 callees
  • worse: CodeGen — 69 callers, 14 callees
  • worse: _Fold — 4 callers, 8 callees
  • new: get_variable_type_spec() — 4 callers, 3 callees
  • new: argument_runs() — 0 callers, 8 callees
  • new: test_numeric_timeframe_is_refused_during_analysis() — 0 callers, 7 callees
  • new: test_open_numeric_domain_is_not_reported_as_a_guessed_float() — 0 callers, 7 callees
  • new: test_non_string_timeframes_are_refused_by_semantic_type() — 0 callers, 7 callees
  • …and 1 more — each is listed as a finding

Verification — 6601 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: 5716 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

535 of 535 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-safety
  • tests/test_allow_entry_in_qualifier.py — impact, full-run-safety
  • tests/test_allow_entry_in_request_const.py — impact, full-run-safety
  • tests/test_analyzer.py — impact, full-run-safety
  • tests/test_analyzer_matrix_inference.py — impact, full-run-safety
  • tests/test_analyzer_ta_return_types.py — impact, full-run-safety
  • tests/test_anchor_tf_change.py — impact, changed-test, full-run-safety
  • tests/test_anchor_time.py — impact, full-run-safety
  • tests/test_anchor_vwap.py — impact, changed-test, full-run-safety
  • tests/test_array_bounds_insert_fill_slice.py — impact, full-run-safety
  • tests/test_array_checked_access.py — impact, full-run-safety
  • tests/test_array_empty_aggregates.py — impact, full-run-safety
  • tests/test_array_history.py — impact, full-run-safety
  • tests/test_array_missing_integer_index.py — impact, full-run-safety
  • tests/test_array_new_color_fill_and_na_size.py — impact, full-run-safety
  • tests/test_array_new_defaults_and_order.py — impact, full-run-safety
  • tests/test_array_reference_semantics.py — impact, full-run-safety
  • tests/test_array_retained_alias.py — impact, full-run-safety
  • tests/test_array_slice_view.py — impact, full-run-safety
  • tests/test_array_sort_indices.py — impact, full-run-safety
  • tests/test_array_terminal_returns.py — impact, full-run-safety
  • tests/test_arrseg_coded_run_stops.py — impact, full-run-safety
  • tests/test_arrseg_review_fixes.py — impact, full-run-safety
  • tests/test_binop_operand_order.py — impact, full-run-safety
  • tests/test_block_shadow_primitive_types.py — impact, full-run-safety
  • tests/test_block_var_plain_siblings.py — impact, full-run-safety
  • tests/test_bool_na_refusal.py — impact, full-run-safety
  • tests/test_bool_na_refusals_2.py — impact, full-run-safety
  • tests/test_bool_na_values.py — impact, full-run-safety
  • tests/test_bool_string_inference.py — impact, full-run-safety
  • tests/test_builtin_name_shadow.py — impact, full-run-safety
  • tests/test_builtin_named_locals_compile.py — impact, full-run-safety
  • tests/test_builtin_named_locals_price_refusal.py — impact, full-run-safety
  • tests/test_builtin_named_locals_receipt.py — impact, full-run-safety
  • tests/test_builtin_named_locals_scope.py — impact, full-run-safety
  • tests/test_builtin_named_parameters.py — impact, full-run-safety
  • tests/test_builtin_named_parameters_reference.py — full-run-safety
  • tests/test_calc_on_order_fills_codegen.py — impact, full-run-safety
  • tests/test_calendar_lambda_locals.py — impact, full-run-safety
  • tests/test_call_argument_order.py — impact, full-run-safety
  • tests/test_callable_local_histories.py — impact, full-run-safety
  • tests/test_callable_series_param_types.py — impact, full-run-safety
  • tests/test_callable_string_series_type.py — impact, full-run-safety
  • tests/test_callable_ta_forwarded_length.py — impact, full-run-safety
  • tests/test_callable_var_first_reach.py — impact, full-run-safety
  • tests/test_checked_settings.py — impact, full-run-safety
  • tests/test_ci_engine_main_touched.py — full-run-safety
  • tests/test_clone_name_allocation.py — impact, changed-test, full-run-safety
  • tests/test_closed_trade_fold.py — full-run-safety
  • tests/test_closed_trade_fold_emission.py — impact, full-run-safety
  • … and 485 more

non-code file(s) changed (CHANGELOG.md, docs/reference/support-contracts.md, pineforge_codegen/diagnostics_catalog.json, tests/fixtures/diagnostic_codes_pin.json, tests/fixtures/diagnostic_notes/delta.json …) → 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, docs/reference/support-contracts.md, pineforge_codegen/codegen/drawing.py, pineforge_codegen/codegen/emit_top.py, pineforge_codegen/codegen/visit_stmt.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)

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 \_operator\_operand\_type.

The verifier did not have enough to check \_operator\_operand\_type, 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\_FuncCall.

The verifier did not have enough to check \_visit\_FuncCall, 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\_MemberAccess.

The verifier did not have enough to check \_visit\_MemberAccess, 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 \_check\_node.

The verifier did not have enough to check \_check\_node, 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)

No difference found (not proven): No behavior difference found in \_type\_spec\_from\_expr (not a proof).

The verifier ran both versions of \_type\_spec\_from\_expr on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.

Guarantee: Empirical: the synth_receiver tier. A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.

Note: An input the sampler did not try could still differ.

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 \_is\_default\_drawing\_initializer.

The verifier did not have enough to check \_is\_default\_drawing\_initializer, 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 \_is\_omitted\_udt\_field.

The verifier did not have enough to check \_is\_omitted\_udt\_field, 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 \_is\_skip\_expr.

The verifier did not have enough to check \_is\_skip\_expr, 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 \_detect\_drawing\_usage.

The verifier did not have enough to check \_detect\_drawing\_usage, 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)

No difference found (not proven): No behavior difference found in \_drawing\_call\_is\_void (not a proof).

The verifier ran both versions of \_drawing\_call\_is\_void on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.

Guarantee: Empirical: the synth_receiver tier. A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.

Note: An input the sampler did not try could still differ.

Could not verify: Could not verify \_drawing\_call\_return\_cpp.

The verifier did not have enough to check \_drawing\_call\_return\_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 \_emit\_drawing\_method.

The verifier did not have enough to check \_emit\_drawing\_method, 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 \_spec\_mentions\_drawing.

The verifier did not have enough to check \_spec\_mentions\_drawing, 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\_constructor.

The verifier did not have enough to check \_emit\_constructor, 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\_includes.

The verifier did not have enough to check \_emit\_includes, 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)

· 6 grounded finding(s) anchored inline below; 3 more finding(s) on lines outside this diff (see the check run).

return STRATEGY_SIZING_CONSTANTS.get(f"{namespace}.{name}")


def get_variable_type_spec(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — get_variable_type_spec()

high coupling complexity (Ca·Ce = 12).

Grounded coupling-delta finding (deterministic), not an LLM guess.

@pytest.mark.parametrize("stem", [
"_pf_collection_hist", "_sec7", "_precalc", "_strat",
])
def test_composed_reserved_storage_avoids_a_parameter_at_its_escape(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — 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.



@pytest.fixture(scope="module")
def argument_runs(tmp_path_factory):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — argument_runs()

fans out to 8 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

("1.25", "float"),
("-2.5", "float"),
])
def test_numeric_timeframe_is_refused_during_analysis(function, named, argument, pine_type):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — test_numeric_timeframe_is_refused_during_analysis()

fans out to 7 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.



@pytest.mark.parametrize("function", ("change", "in_seconds"))
def test_open_numeric_domain_is_not_reported_as_a_guessed_float(function):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — test_open_numeric_domain_is_not_reported_as_a_guessed_float()

fans out to 7 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

])
@pytest.mark.parametrize("conversion", [False, True], ids=["alone", "bool-to-text"])
@pytest.mark.parametrize("declarations,argument,pine_type", NON_STRINGS)
def test_non_string_timeframes_are_refused_by_semantic_type(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression — test_non_string_timeframes_are_refused_by_semantic_type()

fans out to 7 callees (efferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

@luisleo526
luisleo526 merged commit 0ba632a into main Nov 15, 2026
25 checks passed
luisleo526 added a commit that referenced this pull request Nov 15, 2026
Bring the branch up to date with main after #405 merged. No conflicts.
luisleo526 added a commit that referenced this pull request Nov 15, 2026
* Resolve empty timeframe arguments to the chart period

* Preserve timeframe arguments and generated-name safety

Resolve dotted builtin signatures consistently and preserve explicit strings,
chart-period fallback and single evaluation. Reserve generated conversion names.

* Update anchor test expectations for conditional timeframe calls

The existing symbol-clock anchor tests now check both calls in the emitted
empty-argument conditional. Add pure-Python checks of branch direction and
single evaluation, and make the temporary-name sweep reach the argument lambda.

Product code is unchanged by this test update.

* Preserve reference types across fields and calls

Lower missing reference values to their destination storage and retain drawing
handle types through user functions and tuple returns. Support declared
polyline types, fields and deletion arguments.

* Handle emitters without function metadata

Read optional function metadata safely when inferring reference casts, so bare
emitters retain matrix element types without raising an AttributeError.

* Retain structured value types across user function calls

* Check compound values through native execution

Use the established integer storage and matrix alias in type-flow assertions.
Check array specializations, mutations, matrix values and copy independence.

* Bound type inference within expression queries

Share operand and value inference while an expression query is active, then
release cached results before bindings can change. Preserve ordinary matrix
member initialization when the declaration expression is still available.

* Validate timeframe argument types

Use the chart period for a generic missing timeframe argument and refuse
numeric values for string parameters during analysis. Cover named arguments,
helper calls, source locations and generated translation units.

* Register the timeframe argument diagnostic

Include only the stock-generated PF-E2095 definition and pin. Preserve all
prior catalog entry bytes and their existing order.

* Disambiguate diagnostic templates by argument kinds

Use recognized Pine types in declared type slots to resolve equally literal
diagnostic templates. Keep stable code order for other ties and preserve
qualifier identities, raw arguments and rendering. Pin the timeframe type
diagnostic and its named arguments with direct regression controls.

* Validate timeframe arguments using semantic types

Reject non-string timeframe arguments through the intrinsic signature before
C++ lowering, including helper parameters and boolean values. Preserve valid
string calls and exercise complete native controls at distinct optimization
levels. Declare the new diagnostic in the existing catalog delta fixture.

* fix(codegen): allocate function clone names against authored members

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.

* Use the generated timeframe type diagnostic presentation

Carry the generated argument-type entry and its pin into the member while
preserving all other catalog bytes and order. Use the grammatical message
and exact approved user presentation with the existing argument kinds.
Retain the same numeric refusal cases and qualifier controls.

* Locate helper argument expectations inside the builtin call

Use the argument occurrence within the call instead of an identically
named helper parameter. Keep the exact line and column assertions and
all source inputs, diagnostic identities and test rows unchanged.

* Resolve registered argument types and report their source starts

Carry registered namespace types through the semantic query used for written
helper calls while respecting lexical shadowing and version boundaries.
Reuse the existing expression-start locator for timeframe type refusals.

* fix(codegen): separate composed helper and lexical storage names

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.

* Preserve sizing string values across expressions and host settings

* Exercise v5 receiver shadowing through an imported library

* Preserve integer risk type boundary codes

* Strengthen sizing regression and reserve generated name

* Lower computed risk type arms at numeric boundary

* Convert sizing selection arms at host boundaries

* fix(codegen): preserve established typed method names

Keep raw typed-method names on the function channel when they collide with
authored data members. Continue allocating encoded names and collisions with
generated storage so method definitions, calls and state stay distinct.

* Assert the risk type conversion for reassigned sizing variables (#394)

Sizing constants keep their Pine string type for the string consumers this
change fixes, so a reassigned sizing variable reaches the risk host boundary
as a string and is converted to its integer code there. Keeping the integer
comparison would need integer storage for these variables, which the string
consumers cannot use. The test still requires the call to read t after its
write, never its initializer, and now also checks the code chosen for the
assigned value.

* Preserve unresolved script selection history

Keep the established admission policy for non-nullable script selections while
retaining exact compound value joins inside functions and methods. This avoids
introducing collection history for previously unresolved global selections.

* Resolve empty timeframe arguments, keep reference types across calls, and keep generated names distinct (#405)

* Resolve empty timeframe arguments to the chart period

* Preserve timeframe arguments and generated-name safety

Resolve dotted builtin signatures consistently and preserve explicit strings,
chart-period fallback and single evaluation. Reserve generated conversion names.

* Update anchor test expectations for conditional timeframe calls

The existing symbol-clock anchor tests now check both calls in the emitted
empty-argument conditional. Add pure-Python checks of branch direction and
single evaluation, and make the temporary-name sweep reach the argument lambda.

Product code is unchanged by this test update.

* Preserve reference types across fields and calls

Lower missing reference values to their destination storage and retain drawing
handle types through user functions and tuple returns. Support declared
polyline types, fields and deletion arguments.

* Handle emitters without function metadata

Read optional function metadata safely when inferring reference casts, so bare
emitters retain matrix element types without raising an AttributeError.

* Validate timeframe argument types

Use the chart period for a generic missing timeframe argument and refuse
numeric values for string parameters during analysis. Cover named arguments,
helper calls, source locations and generated translation units.

* Register the timeframe argument diagnostic

Include only the stock-generated PF-E2095 definition and pin. Preserve all
prior catalog entry bytes and their existing order.

* Disambiguate diagnostic templates by argument kinds

Use recognized Pine types in declared type slots to resolve equally literal
diagnostic templates. Keep stable code order for other ties and preserve
qualifier identities, raw arguments and rendering. Pin the timeframe type
diagnostic and its named arguments with direct regression controls.

* Validate timeframe arguments using semantic types

Reject non-string timeframe arguments through the intrinsic signature before
C++ lowering, including helper parameters and boolean values. Preserve valid
string calls and exercise complete native controls at distinct optimization
levels. Declare the new diagnostic in the existing catalog delta fixture.

* fix(codegen): allocate function clone names against authored members

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.

* Use the generated timeframe type diagnostic presentation

Carry the generated argument-type entry and its pin into the member while
preserving all other catalog bytes and order. Use the grammatical message
and exact approved user presentation with the existing argument kinds.
Retain the same numeric refusal cases and qualifier controls.

* Locate helper argument expectations inside the builtin call

Use the argument occurrence within the call instead of an identically
named helper parameter. Keep the exact line and column assertions and
all source inputs, diagnostic identities and test rows unchanged.

* Resolve registered argument types and report their source starts

Carry registered namespace types through the semantic query used for written
helper calls while respecting lexical shadowing and version boundaries.
Reuse the existing expression-start locator for timeframe type refusals.

* fix(codegen): separate composed helper and lexical storage names

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.

* Preserve sizing string values across expressions and host settings

* Exercise v5 receiver shadowing through an imported library

* Preserve integer risk type boundary codes

* Strengthen sizing regression and reserve generated name

* Lower computed risk type arms at numeric boundary

* Convert sizing selection arms at host boundaries

* fix(codegen): preserve established typed method names

Keep raw typed-method names on the function channel when they collide with
authored data members. Continue allocating encoded names and collisions with
generated storage so method definitions, calls and state stay distinct.

* Assert the risk type conversion for reassigned sizing variables (#394)

Sizing constants keep their Pine string type for the string consumers this
change fixes, so a reassigned sizing variable reaches the risk host boundary
as a string and is converted to its integer code there. Keeping the integer
comparison would need integer storage for these variables, which the string
consumers cannot use. The test still requires the call to read t after its
write, never its initializer, and now also checks the code chosen for the
assigned value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment