Unify RunReport JSON: retire hand-rolled to_json, render stdout via serde (stdout↔disk shape divergence) #54

Closed
opened 2026-06-10 20:41:21 +02:00 by Brummel · 0 comments
Owner

Since cycle 0029 (#33), one RunReport has two divergent JSON encoders:

  • serde (serde_json) — used by aura-registry for the on-disk store
    (runs/runs.jsonl). serde's natural shape: params as an array-of-pairs
    ([["sma_cross.fast",2.0],…]), floats as 2.0.
  • hand-rolled to_json (crates/aura-engine/src/report.rs:80) — used for
    all stdout (aura run / aura sweep / aura runs list / aura runs rank).
    Shape: params as an object ({"sma_cross.fast":2,…}), whole floats as 2.

So the same record is a structurally different JSON document on disk vs. on the
wire, and no test pins their relationship. This was a deliberate, named
deferral
in the 0029 spec (§Architecture "C16 amendment" + Out of scope:
"the aura run/aura sweep stdout→serde unification"): keeping to_json for
stdout avoided churning the aura run/aura sweep goldens while the registry
adopted serde for its typed read-path.

The fix: retire the hand-rolled to_json and render stdout via serde too
(one shape for stored and printed records), updating the aura run/aura sweep/
aura runs goldens to serde's shape. This also removes the last hand-rolled JSON
writer, consistent with the amended C16 (don't hand-roll what a vetted standard
crate does).

depends on: nothing (serde already in the workspace since 0029)
context: deferred from cycle 0029 to keep stdout goldens stable that cycle

Since cycle 0029 (#33), one `RunReport` has **two divergent JSON encoders**: - **serde** (`serde_json`) — used by `aura-registry` for the on-disk store (`runs/runs.jsonl`). serde's natural shape: `params` as an array-of-pairs (`[["sma_cross.fast",2.0],…]`), floats as `2.0`. - **hand-rolled `to_json`** (`crates/aura-engine/src/report.rs:80`) — used for all stdout (`aura run` / `aura sweep` / `aura runs list` / `aura runs rank`). Shape: `params` as an object (`{"sma_cross.fast":2,…}`), whole floats as `2`. So the same record is a structurally different JSON document on disk vs. on the wire, and no test pins their relationship. This was a **deliberate, named deferral** in the 0029 spec (§Architecture "C16 amendment" + Out of scope: "the `aura run`/`aura sweep` stdout→serde unification"): keeping `to_json` for stdout avoided churning the `aura run`/`aura sweep` goldens while the registry adopted serde for its typed read-path. **The fix:** retire the hand-rolled `to_json` and render stdout via serde too (one shape for stored and printed records), updating the `aura run`/`aura sweep`/ `aura runs` goldens to serde's shape. This also removes the last hand-rolled JSON writer, consistent with the amended C16 (don't hand-roll what a vetted standard crate does). depends on: nothing (serde already in the workspace since 0029) context: deferred from cycle 0029 to keep stdout goldens stable that cycle
Brummel added the idea label 2026-06-10 20:41:21 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Brummel/Aura#54