-
Notifications
You must be signed in to change notification settings - Fork 0
feat(core,cli,web): persist near-duplicate link in ChunkMeta (schema v8) (#76) #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3b09acc
54f70c5
18fd624
1a310e3
62739f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ use serde::{Deserialize, Serialize}; | |
|
|
||
| use crate::complement::AxisScores; | ||
| use crate::gesture::GestureStats; | ||
| use crate::novelty::PhraseDuplicate; | ||
| use crate::structure::{ComplexityProfile, StructureMetrics}; | ||
|
|
||
| /// Current corpus schema version. | ||
|
|
@@ -36,14 +37,19 @@ use crate::structure::{ComplexityProfile, StructureMetrics}; | |
| /// `rights` key) keep loading and re-serialize losslessly. Rights status is | ||
| /// not derivable from content, so it is captured at curation time and cannot | ||
| /// be backfilled. | ||
| /// - v8 — persisted near-duplicate link (#76): `ChunkMeta` gains optional | ||
| /// [`PhraseDuplicate`] under the same pattern; pre-v8 records (no `duplicate` | ||
| /// key) keep loading and re-serialize losslessly. It records which earlier | ||
| /// split phrase a later one repeats — a curation signal previously surfaced | ||
| /// only in the UI/CLI and dropped on download. | ||
| /// | ||
| /// Tag taxonomy is intentionally *not* versioned here: [`SwancoreTag`] grows | ||
| /// additively (e.g. `let_ring`, #75) and `SCHEMA_VERSION` tracks structural | ||
| /// `ChunkMeta` changes (the optional-field, forward-compatible pattern above), | ||
| /// not the tag set — a new tag only breaks readers that hard-reject unknown | ||
| /// variants, a curation-tooling concern, not a corpus-structure one | ||
| /// (decisions 2026-06-19). | ||
| pub const SCHEMA_VERSION: u32 = 7; | ||
| pub const SCHEMA_VERSION: u32 = 8; | ||
|
|
||
| // ── identifiers ─────────────────────────────────────────────────────────────── | ||
|
|
||
|
|
@@ -354,6 +360,14 @@ pub struct ChunkMeta { | |
| /// as `null` — when unmeasured, so pre-v6 files round-trip byte-identically. | ||
| #[serde(default, skip_serializing_if = "Option::is_none")] | ||
| pub complexity: Option<ComplexityProfile>, | ||
| /// Near-duplicate link (schema v8, #76): the earlier split phrase this one | ||
| /// verbatim-quotes (transposition-aware) and by how much, or absent when the | ||
| /// phrase is distinct or was captured outside a split. `of` indexes the | ||
| /// phrase within the same split run — it pairs with the `_p<N>` id suffix. | ||
| /// Skipped — not written as `null` — when absent, so pre-v8 files round-trip | ||
| /// byte-identically. | ||
| #[serde(default, skip_serializing_if = "Option::is_none")] | ||
| pub duplicate: Option<PhraseDuplicate>, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a split-generated chunk carrying Useful? React with 👍 / 👎.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch — fixed in Generated by Claude Code |
||
| /// Style cohort (schema v4). Absent in pre-v4 records — unlabeled; the | ||
| /// key is skipped when unset, so older files round-trip byte-identically. | ||
| #[serde(default, skip_serializing_if = "Option::is_none")] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
/workspace/griffAGENTS.md TDD workflow says “Never commit newpub fn/pub structimplementation in the same commit as the tests that cover it” and that reviewers must judge the commit sequence. This single commit adds the publicChunkMeta.duplicateschema field and its covering tests together, so the required failing-test commit is absent; please split the history into a red test commit followed by the implementation commit.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reads the flattened PR diff rather than the commit sequence — the history is already red→green, as AGENTS.md asks reviewers to judge:
3b09acctest(core,cli): red— adds the covering testchunk_meta_persists_and_skips_the_near_duplicate_link(and the CLI persistence assertion). It does not compile:error[E0609]: no field 'duplicate' on type 'ChunkMeta'.54f70c5feat: green— addspub duplicate: Option<PhraseDuplicate>and makes that test pass.Evidence:
git log -G 'pub duplicate: Option' -- core/src/corpus.rs→ only54f70c5git log -G 'chunk_meta_persists_and_skips' -- core/tests/corpus_schema.rs→ only3b09accThe failing-test-first commit is present and precedes the implementation; the "single commit" is the squashed-diff view, not the branch history.
Generated by Claude Code