Single-source + sweep-safe cost-port naming: intern cost[k].<port>, not per-build leak #152
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Cycle 0084 (#148) extracted the cost-graph wiring into
cost_graphinaura-composites. The 0084 architect drift review flagged two coupled [medium]
items around the
cost[k].<port>port-name mechanism. Both are harmless on thecurrent run-only cost path but become real on the deferred sweep-cost cycle.
The two coupled concerns
Per-build
.leak()vs. interning (latent allocation regression).cost_graph(crates/aura-composites/src/lib.rs:185,190).leak()s itsruntime-computed port names (
cost[k].<port>,cost[k].<field>) to satisfyNodeHandle::input/output's&'static strbound. This is acceptable today:cost is run-path-only (sweep/walkforward/mc pass
None), socost_graphisbuilt once per run — a one-shot leak, exactly like the test-only pattern at
tests/risk_executor.rs:72/165/197. But the deliberate production patternfor reused builders is the
COL_PORTSLazyLockintern(crates/aura-cli/src/main.rs:2606, used on the reduce path at :2719/:2867/:2982);
the deleted
COST_SUM_PORTSinterned for the same reason. When cost reaches theper-member sweep/MC path,
cost_graphis rebuilt per member, and theper-build leak accumulates unboundedly across the sweep. (The 0084 commit's
"risk_executor precedent" provenance was imprecise — that
.leak()lives inrisk_executor's test, not its production builder; corrected in the 0084
audit-close.)
cost[k].<port>namespacing restated across three crates.The index-namespacing format is restated at crates/aura-std/src/cost_sum.rs:45
(
CostSuminput ports), crates/aura-composites/src/lib.rs:184,190 (cost_graphrole + agg-input), and crates/aura-cli/src/main.rs:2753 (the CLI feeding the vol
node's extra). A compiler-unlinked lockstep — the same class 0082 flagged and
0083 collapsed for the 3-field names (via
COST_FIELD_NAMES). Build-validated(a divergent name fails loudly at
g.build()resolution, NOT the silentpositional-join risk 0083 fixed), so no correctness risk in the interim.
The fix (one deliberate unit)
A single-source, sweep-safe cost-port-name contract in the cost module
(
aura-std/src/cost.rs): one helper producing thecost[k].<port>/cost[k].<field>names, interned (process-global, dedup'd) rather than.leak()ed per build, read byCostSum,cost_graph, and the CLI. Splittingthis into a now-helper (still leaking) + a later-intern would churn the same
surface twice, so it is best built with the sweep-cost cycle, when the
per-member interning requirement is concrete and testable.
depends on: the deferred sweep-path / OOS-pooling cost cycle (#148)
context: 0084 audit drift items (architect review); harmless on the current
run-only cost path, a prerequisite before cost reaches the per-member sweep path.
Triage 2026-07-09 (tree at
68317ec) — scope note; the deferral stands but the surface shrank:.leak()for the extra-port and cost[k]. names; the doc comment at :152-156 references this issue); theformat!("cost[{k}].{field}")twin lives at crates/aura-std/src/cost_sum.rs:45. No interning helper exists.b5ad53d) removed the CLI's dead single-run cost branch, so the restatement sites are two, not three, and cost_graph currently has no production caller (the campaign runner carries no cost leg, crates/aura-cli/src/campaign_run.rs:583).