Skip to content

scorecard: NavScorecard reader (from_dict/from_json) — Track 4 Phase 0 - #97

Merged
transfix merged 1 commit into
mainfrom
feat/nav-stats-scorecard-reader
Sep 26, 2026
Merged

transfix merged 1 commit into
mainfrom
feat/nav-stats-scorecard-reader

Conversation

@transfix

Copy link
Copy Markdown
Contributor

Track 4 Phase 0 (scorecard plumbing): the scorecard layer could WRITE (to_dict/to_json) but not READ. Add the inverse so a recorded corpus-fitness row loads back into Python — the plumbing a selection/loss stage reads from (nothing consumes it yet; Phase 1+ wires it into training).

Because to_dict's keys are field-for-field the C++ cvc::nav::scorecard_json keys, the same reader loads a dbg_arrival_check3 --episodes / scorecard_json row directly.

  • NavScorecard.from_dict(d): exact inverse of to_dict across all Track-1 field families (base + formation + coverage + drive + material_time_share + nested mean_coverage). Tolerant of a partial producer (missing keys keep dataclass defaults); ignores an embedded "rf" sub-object (the DBG scorecard_json shape) — the base reader is RF-free, the DBG side reads the RF scorecard separately.
  • NavScorecard.from_json(s): json.loads + from_dict.

Tests: full round-trip (to_dict→from_dict and to_json→from_json reproduce the row exactly, all field families populated) + partial/rf-tolerance. The existing C++↔Python parity gate already pins every aggregate field, so this only adds the reader's own coverage. 13/13 pass; ruff clean.

Next (Phase 1, SELECTION): consume a recorded scorecard's composite_score in CommTrainer + formation/belief/grip as nav_scorecard selection fields.

…ase 0

The scorecard layer could WRITE (to_dict/to_json) but not READ. Add the inverse so
a recorded corpus-fitness row loads back into Python — the plumbing a selection/loss
stage will read from (nothing consumes it yet; Track 4 Phase 1+ wires it into
training). Because to_dict's keys are field-for-field the C++ cvc::nav::scorecard_json
keys, the same reader loads a `dbg_arrival_check3 --episodes` / scorecard_json row
directly.

- NavScorecard.from_dict(d): exact inverse of to_dict across all Track-1 field
  families (base + formation + coverage + drive + material_time_share + the nested
  mean_coverage). Tolerant of a partial producer (missing keys keep dataclass
  defaults) and ignores an embedded "rf" sub-object (the DBG scorecard_json shape) —
  the base reader is RF-free; the DBG side reads the RF scorecard separately.
- NavScorecard.from_json(s): json.loads + from_dict.

Tests: a full round-trip (to_dict->from_dict and to_json->from_json reproduce the
row exactly, all field families populated) + partial/rf-tolerance. The existing
C++<->Python parity gate already pins every aggregate field, so this only adds the
reader's own coverage. 13/13 pass; ruff clean.
@transfix
transfix force-pushed the feat/nav-stats-scorecard-reader branch from 4700627 to 1815936 Compare September 26, 2026 05:17
@transfix
transfix merged commit eef3abf into main Sep 26, 2026
7 of 9 checks passed
@transfix
transfix deleted the feat/nav-stats-scorecard-reader branch September 26, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant