Trace re-run hardcodes the default vol-stop, false-failing the C1 drift alarm for non-default risk regimes #219

Closed
opened 2026-07-07 23:01:42 +02:00 by Brummel · 0 comments
Owner

Summary

The campaign trace re-run (the C1 drift alarm inside persist_campaign_traces)
hardcodes the default vol-stop Vol { R_SMA_STOP_LENGTH, R_SMA_STOP_K } instead
of the regime the cell actually ran under. For any campaign that uses a
non-default risk regime and persists a trace, the re-run diverges from the
recorded nominee and the guard returns a hard Err — a false C1 violation:
it refuses to persist a correct trace, blaming non-determinism that its own
hardcoded stop introduced.

Root cause — a lossy record, not an ignored variable

The stop crosses a record boundary that drops it:

  • CellSpec.regime: Option<RiskRegime> (crates/aura-campaign/src/lib.rs:39)
    is the source of truth during the run.
  • The live member runner honours it —
    crates/aura-cli/src/campaign_run.rs:271:
    None => Vol { R_SMA_STOP_LENGTH, R_SMA_STOP_K },
    Some(Vol { length, k }) => Vol { length, k }.
  • But the persisted record cell CellRealization
    (crates/aura-campaign/src/exec.rs:459) carries only
    strategy, instrument, window_ms, stagesno regime field. Neither does
    the zipped CellOutcome (exec.rs:56, nominee: Option<(params, RunReport)>).
  • So the re-run at crates/aura-cli/src/campaign_run.rs:741 has nothing to read
    and hardcodes the default:
    StopRule::Vol { length: R_SMA_STOP_LENGTH, k: R_SMA_STOP_K }.

The fix is at the record boundary (persist the regime), not at the re-run site
(where there is currently nothing better to read).

Observable failure

crates/aura-cli/src/campaign_run.rs:766 compares rerun_metrics against
nominee_report.metrics and, on inequality, returns:

trace re-run diverged from the recorded nominee (C1 violation): cell {cell_key} of trace {trace_name} does not reproduce its recorded metrics; refusing to persist a silently-wrong trace

The Err propagates through ? at campaign_run.rs:564aura campaign exits
non-zero. The recorded metrics reflect the real regime Vol{l,k}; the re-run
uses Vol{3, 2.0}; different stop → different exits → different R rows →
different metrics.

Reachability

Trace persistence runs when outcome.record.trace_name is Some
(campaign_run.rs:555); the drift-alarm re-run + equality check fires for every
cell with a nominee, unconditionally on the taps. The trigger is therefore:

aura campaign <doc.json> where the doc has a non-empty risk list with a
non-default Vol { length, k } (length != 3 or k != 2.0) and a trace
name. The default-regime path (empty risk) matches by construction and hides
the bug, which is why it has gone unnoticed.

(Latent secondary smell in the same area: even a fix that only threads the
regime leaves run_blueprint_member stamping an r_sma-flavoured broker label
and the empty-risk default constants living in the runner — cosmetic, out of
scope here.)

Fix direction (GREEN side — RED-first)

RED test first: a campaign doc with risk: [Vol { length: 5, k: 3.0 }] and a
trace name; assert the traces persist (today it errors with the false C1
message). GREEN: add regime: Option<RiskRegime> to CellRealization, populate
it in execute where the cell is realized, and have the re-run at
campaign_run.rs:741 match it exactly as the member runner does at
campaign_run.rs:271.

Provenance

Surfaced by an audit during #159 (retiring the hardwired demo harnesses). The
fast/slow verb-sugar weld is tracked separately; this is the independent
trace-fidelity defect the audit turned up.

## Summary The campaign trace re-run (the C1 drift alarm inside `persist_campaign_traces`) hardcodes the default vol-stop `Vol { R_SMA_STOP_LENGTH, R_SMA_STOP_K }` instead of the regime the cell actually ran under. For any campaign that uses a **non-default** risk regime and persists a trace, the re-run diverges from the recorded nominee and the guard returns a hard `Err` — a **false** C1 violation: it refuses to persist a *correct* trace, blaming non-determinism that its own hardcoded stop introduced. ## Root cause — a lossy record, not an ignored variable The stop crosses a record boundary that drops it: - `CellSpec.regime: Option<RiskRegime>` (`crates/aura-campaign/src/lib.rs:39`) is the source of truth during the run. - The live member runner honours it — `crates/aura-cli/src/campaign_run.rs:271`: `None => Vol { R_SMA_STOP_LENGTH, R_SMA_STOP_K }`, `Some(Vol { length, k }) => Vol { length, k }`. - But the persisted record cell `CellRealization` (`crates/aura-campaign/src/exec.rs:459`) carries only `strategy, instrument, window_ms, stages` — **no regime field**. Neither does the zipped `CellOutcome` (`exec.rs:56`, `nominee: Option<(params, RunReport)>`). - So the re-run at `crates/aura-cli/src/campaign_run.rs:741` has nothing to read and hardcodes the default: `StopRule::Vol { length: R_SMA_STOP_LENGTH, k: R_SMA_STOP_K }`. The fix is at the record boundary (persist the regime), not at the re-run site (where there is currently nothing better to read). ## Observable failure `crates/aura-cli/src/campaign_run.rs:766` compares `rerun_metrics` against `nominee_report.metrics` and, on inequality, returns: > `trace re-run diverged from the recorded nominee (C1 violation): cell {cell_key} > of trace {trace_name} does not reproduce its recorded metrics; refusing to > persist a silently-wrong trace` The `Err` propagates through `?` at `campaign_run.rs:564` → `aura campaign` exits non-zero. The recorded metrics reflect the real regime `Vol{l,k}`; the re-run uses `Vol{3, 2.0}`; different stop → different exits → different R rows → different metrics. ## Reachability Trace persistence runs when `outcome.record.trace_name` is `Some` (`campaign_run.rs:555`); the drift-alarm re-run + equality check fires for every cell with a nominee, unconditionally on the taps. The trigger is therefore: `aura campaign <doc.json>` where the doc has a **non-empty `risk`** list with a non-default `Vol { length, k }` (`length != 3` or `k != 2.0`) **and** a trace name. The default-regime path (empty `risk`) matches by construction and hides the bug, which is why it has gone unnoticed. (Latent secondary smell in the same area: even a fix that only threads the regime leaves `run_blueprint_member` stamping an `r_sma`-flavoured broker label and the empty-risk default constants living in the runner — cosmetic, out of scope here.) ## Fix direction (GREEN side — RED-first) RED test first: a campaign doc with `risk: [Vol { length: 5, k: 3.0 }]` and a trace name; assert the traces persist (today it errors with the false C1 message). GREEN: add `regime: Option<RiskRegime>` to `CellRealization`, populate it in `execute` where the cell is realized, and have the re-run at `campaign_run.rs:741` match it exactly as the member runner does at `campaign_run.rs:271`. ## Provenance Surfaced by an audit during #159 (retiring the hardwired demo harnesses). The fast/slow verb-sugar weld is tracked separately; this is the independent trace-fidelity defect the audit turned up.
Brummel added the bug label 2026-07-07 23:01:42 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Brummel/Aura#219