Cosmetic: unify family-wrapper stdout key order (json! -> to_json), deferred from #73 #99

Closed
opened 2026-06-18 19:54:21 +02:00 by Brummel · 0 comments
Owner

Deferred from #73 (cosmetic sub-item). Family-wrapped stdout lines for
aura sweep / mc / walkforward emit the embedded RunReport via
serde_json::json!({ "family_id": …, "report": report }), which routes the report
through a serde_json::Value whose object keys are alphabetical (leading
broker). The standalone render paths (runs family, the retired runs list) use
RunReport::to_json()declaration order (leading commit), matching the
stored families.jsonl.

Unify the family-wrapper lines to declaration order. NOT a trivial swap: embedding
report.to_json() (a String) inside json! double-encodes it, and a Value
re-alphabetizes. The fix is manual JSON construction at the 3 sites
(main.rs sweep / walkforward / mc wrapper println!s), e.g.
format!(r#"{{"family_id":{},"report":{}}}"#, serde_json::to_string(&id)?, report.to_json()).

Pure presentation — both forms are valid JSON, round-trip unaffected, the stored
families.jsonl already uses declaration order. The existing wrapper tests assert
via .contains(...) (no key-order pin), so a new test must pin the leading key.

context: split from #73's retire to keep that change focused and low-risk.

Deferred from #73 (cosmetic sub-item). Family-wrapped stdout lines for `aura sweep` / `mc` / `walkforward` emit the embedded `RunReport` via `serde_json::json!({ "family_id": …, "report": report })`, which routes the report through a `serde_json::Value` whose object keys are **alphabetical** (leading `broker`). The standalone render paths (`runs family`, the retired `runs list`) use `RunReport::to_json()` — **declaration order** (leading `commit`), matching the stored `families.jsonl`. Unify the family-wrapper lines to declaration order. NOT a trivial swap: embedding `report.to_json()` (a String) inside `json!` double-encodes it, and a `Value` re-alphabetizes. The fix is manual JSON construction at the 3 sites (`main.rs` sweep / walkforward / mc wrapper `println!`s), e.g. `format!(r#"{{"family_id":{},"report":{}}}"#, serde_json::to_string(&id)?, report.to_json())`. Pure presentation — both forms are valid JSON, round-trip unaffected, the stored `families.jsonl` already uses declaration order. The existing wrapper tests assert via `.contains(...)` (no key-order pin), so a new test must pin the leading key. context: split from #73's retire to keep that change focused and low-risk.
Brummel added the idea label 2026-06-18 19:54:22 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Brummel/Aura#99