feat(corpus): v10 canonical song identity + fail-closed song holdout (PR D) - #165
Conversation
📝 WalkthroughWalkthroughCorpus schema v10 adds canonical song identities to source references and manifests, introduces fail-closed song holdout validation, updates CLI/UI construction paths, and expands schema round-trip and refusal tests. ChangesSong identity schema and holdout validation
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant CorpusManifest
participant song_holdout_preflight
participant SourceRef
participant SongHoldoutRefusal
CorpusManifest->>song_holdout_preflight: validate songs and source mappings
song_holdout_preflight->>SourceRef: inspect sha256 and song_id labels
song_holdout_preflight->>SongHoldoutRefusal: collect validation refusals
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 764f2fa526
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Tests only, ahead of any implementation (per AGENTS.md per-commit TDD and the corpus_schema.rs "fail to compile until implemented" precedent). This commit does not compile until the v10 types land in the GREEN commit. Drives schema v10 (ADR-0031, Accepted #164): - schema-version assertion bumped to 10; - SourceRef.song_id round-trip + both pre-v10 lossless characterizations (SPEC hard rule 5); - CorpusManifest.songs as Option (absent None vs present-empty Some({}) are distinct — a songs_manifest round-trip plus a regression asserting an explicitly-empty manifest still demands every labelled source); - six song_holdout_preflight cases: accept-clean, refuse uncurated / unidentified (no sha256) / file-split-across-songs, and both manifest bidirectional checks. The cockpit web-test manifest assertion is updated to schema v10 here so it fails against the still-v9 producer, and passes once GREEN bumps it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012T7SRMiXmZe5v1imtrKMPi
Implement the v10 types and preflight so the RED tests pass.
- SongId(String) — curator-assigned Work identity above the sha256
Manifestation (ADR-0031).
- SourceRef.song_id: Option<SongId> — optional/skip-if-none; pre-v10 records
round-trip byte-identically.
- CorpusManifest.songs: Option<BTreeMap<SongId, Vec<String>>> — presence
preserving: absent (None) skips the cross-check, while an explicitly
present map (even {}) triggers the bidirectional agreement check, so a
present-empty manifest must still account for every labelled source.
- SCHEMA_VERSION 9 -> 10.
- song_holdout_preflight + SongHoldoutRefusal, corpus-wide fail-closed, via
three small helpers: refuse unidentified (no sha256), uncurated (no
song_id, strict default), a sha256 split across >=2 SongIds, and manifest
disagreement in either direction. Refusals collected deterministically.
18 struct-literal construction sites across core/cli/ui-core carry the
additive fields (song_id: None / songs: None). The cockpit web-test producer
now emits schema v10, satisfying the assertion updated in the RED commit.
40 corpus_schema tests green; clippy (all/pedantic/nursery/cargo denied) and
rustfmt clean on core/cli/ui-core; pattern/swang build clean. Audio crates
construct neither struct.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012T7SRMiXmZe5v1imtrKMPi
764f2fa to
7268b4d
Compare
REQUEST CHANGES addressed (force-pushed, head
|
What
Implement schema v10 (ADR-0031, Accepted in #164) — the canonical Work identity that makes song-level holdout implementable fail-closed. Implementation-only, RED→GREEN.
SongId(String)newtype — curator-assigned, opaque, above thesha256Manifestation level.SourceRef.song_id: Option<SongId>— optional/skip-if-none; pre-v10 records load asNoneand round-trip byte-identically.CorpusManifest.songs: Option<BTreeMap<SongId, Vec<String>>>— presence-preserving: absent (None) skips the cross-check, while present (Some, even{}) triggers the bidirectional agreement check, so a present-empty manifest must still account for every labelled source.SCHEMA_VERSION9 → 10.song_holdout_preflight+SongHoldoutRefusaltyped refusals — corpus-wide, fail-closed:sha256) → refuse;song_id, strict-refusal default) → refuse;sha256split across ≥2SongIds (chunk-level leakage) → refuse;songsmanifest must agree with per-source labels both ways.Tests (RED → GREEN, genuine tests-only RED)
301e8bfRED — the schema/preflight tests + the cockpit browser assertion only; introduces no production API and fails to compile in isolation (the v10 types/fields are absent), per thecorpus_schema.rs"fail to compile until implemented" precedent.7268b4dGREEN — the v10 types, preflight, and construction-site ripple.core/tests/corpus_schema.rscovers: schema-version bump,song_id+songs-map round-trip, both pre-v10 lossless characterizations (SPEC hard rule 5), a present-empty-manifest regression ("songs": {}+ labelled source ⇒ManifestLabelMissing), and six preflight cases (accept-clean; refuse uncurated / unidentified / file-split; both manifest bidirectional checks). 40 tests, all green.Ripple
18 struct-literal construction sites across
core/cli/ui-corecarry the additive fields (song_id: None/songs: None). Audio crates (cockpit/plugin/preview) construct neither struct, so the change is source-compatible for them; the cockpit web-test producer now emits schema v10.Verification
Exact-head CI fully green (
check,cockpit-web-test,msrv, fuzz matrix, CodeRabbit). Locally:clippy(all/pedantic/nursery/cargo denied) +rustfmtclean oncore/cli/ui-core;griff-corefull suite green;pattern/swangbuild clean.Out of scope (per the PR D contract)
song_id curation/backfill · production corpus cutover ·
track_indexrecovery · title-based grouping · any generation/scoring change.🤖 Generated with Claude Code
https://claude.ai/code/session_012T7SRMiXmZe5v1imtrKMPi