Repository navigation
feat(training): derived snapshots from replayed vitals and modelset-v1 manifests - #27
Merged
Merged
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 54 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
ng
force-pushed
the
feat/locked-holdout
branch
3 times, most recently
from
November 16, 2026 00:07
2aff58c to
d9f18ac
Compare
ng
force-pushed
the
feat/derived-snapshot
branch
from
November 16, 2026 00:16
6fee71f to
3f88bf5
Compare
3 of 4 tasks
ng
force-pushed
the
feat/derived-snapshot
branch
from
November 16, 2026 00:22
3f88bf5 to
d9e4227
Compare
6 tasks done
…set-v1 so stage models train on one pinned engine and profile Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ut of derived snapshots so a bad replay never trains a model Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…has no contract for its features Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sses, and pin core's golden stage hash, so derived snapshots never train on replays that miss the stored rows Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ent models and trial hashes can never disagree with core differently Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ng
force-pushed
the
feat/derived-snapshot
branch
from
November 16, 2026 00:37
d9e4227 to
4acfc52
Compare
6 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Plan C5 (training side,
training-12) and themodelset-v1writer fromdocs/plans/model-graph-plan.md. Based on main (the locked holdout, #26, is merged).scripts/derive_snapshot.pyingest REPLAY_DIRcaches core'spnpm biometrics:local-fit replay --archive …readings by (night, engine, profile) asdata/cache/vitals/<night>-<engine12>-<profile12>.json. The file is the readings verbatim, with a.source.jsonbeside it. Nights core skipped get a.skipped.jsonwith core's reason. The cache is write-once: replaying the same engine and profile with different bytes is refused.derive SOURCE.db --out NEW.dbcopies the archive database (SQLite backup). For each replayed night and side, it replaces thevitalsandvitals_qualityrows inside the night's in-bed window, found with core's noon-to-noonnightOf. Other sides, other nights and all other tables are unchanged. Inserted rows point at areplayprocessing run when the schema hasbiometric_processing_runs.derived_snapshottable records per night: source database SHA-256, engine manifest hash, resolved profile hash, readings SHA-256,replay.jsonSHA-256, the window, and the counts of removed and inserted rows.read_readings) andreplay.jsonin another (read_replay). The code followsscripts/biometrics-local-fit/replay.tson core branchfeat/local-fit-archive-replay, which is still being written.scripts/modelset.pyhash,checkandwrite RUNforRUN/model/set.json, the shape in the plan.finite-binary64-json-v1) is ported exactly: UTF-16 key order, exact binary64 decimal expansion,JSON.stringifyescaping, node, depth, string and byte budgets.nodes.stage.sha256is computed as core's upload validator computes it (stage-model-set.tsstageModelSha256):dataHash(the 2M-node budget), applied afterstageModelSchema.parsesetsepochSecondsto 300.configHashis exported too.problems()reproduces core's strictmodelSetSchemaandmodelSetProblemchecks, plustraining.inputs ∈ {replayed, live}.scripts/canonical-vectors.tscomputes the vectors with core's own code. It was run withpnpm exec tsxin sleepypod-core-archivefc40624cand in the stage-model-set worktree1fd2a784; both gave identical output, now pinned intest_modelset.py.nights[].parity.trainingGateispass, fromreplay --compare-stored.--allow-ungatedalso accepts nights core could not judge (not_gated_*,no_heart_rate_to_compare, no comparison at all), and records that per night; afailis never used. Every other night keeps its stored rows.derived_snapshotrecords each night's verdict, core's check values and the reason. The thresholds are read from core's verdict, never recomputed here, and the README notes they rest on two nights. The gate is one function (training_gate) passed toderive, so a different gate is a one-place change.test_modelset.pypins core #930's golden forest,6fe42238…7906, next to the earlier vectors.scripts/canonical_json.pyis now the only Python implementation.modelset.py,movement_portable.py(feat(training): export the movement model as a portable JSON forest #24, movement body sha256: unbounded, asverify-movement.tshashes it) and the trial'smodel_sha256instage-backtest.py(feat(training): weekly trial scoring of pod model id 3 (live) vs id 2 (preview) #29) all import it. Their pinned tests still pass: the movement.json sha256 checked byverify-movement.ts, and golden6fe42238…7906in bothtest_stage_backtest.pyandtest_modelset.py. Key order is now UTF-16 everywhere, where movement used code-point order; the two agree on the ASCII keys those documents use.make-synthetic-inputs.pygains--nights Nand--replay DIR, which writes a synthetic replay in core's layout. Synthetic databases also gain avitals_qualitytable.Test plan
uv run --locked python -m unittest discover -s scripts -p 'test_*.py'(261 tests):export-runtime-features.ts→stage-backtest.py.github/workflows/validate.yml).replay --archivelands and the archive is populated: derive the 24 raw nights and check the C5 parity gate inreplay.json.No real health data in git or CI; never contacts a pod.
🤖 Generated with Claude Code