Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Metadata version conformance fixtures (#9095)

The conformance fixture set for the Metadata schema v1 + evolution
doctrine specified in [`../note.md`](../note.md). Acceptance item 4 of
#9095: *metadata at every historical version parses and is usable by
the current reader*, in the fixture-family practice of #8525–#8528 —
hand-authored cases with recorded expectations, consumed by tests in
the crates that own the readers.

Only one version of each surface has ever been published (PM
`pm_meta: 1`; Atlas `schema_version: 1`), so "every historical
version" is v1 in all of its historical *shapes*: the canonical form,
the pre-doctrine producer shapes still carried by live data, and the
doctrine edge cases those shapes must survive.

## Files

- **`pm-metadata-v1.json`** — PM issue/PR Metadata cases. Each case
carries a full issue body, a `reader_parse` expectation (`ok` /
`reject`), and the top-level keys the reader must preserve.
Asserted executably by the fleet crate conformance test
(`pkgs/fleet/crates/fleet/src/gh_metadata.rs`,
`pm_metadata_version_conformance_fixtures`), which runs every case
through `parse_metadata_block` and the stamp assembly round-trip.
- **`atlas-metadata-v1.json`** — Atlas corpus metadata cases. Cases
marked `executable: true` carry a `stage_row` and are asserted by
the atlas-core conformance test
(`pkgs/atlas-search/crates/atlas-core/tests/metadata_conformance.rs`):
the row is inserted into a provisioned `atlas_stage` v1 database
and read back through `list_staged_items`; `meta` must round-trip
byte-exact and the database schema version must be 1.
- **`digest-vectors.json`** — exact-byte identity vectors for the
design §2 rule (`sha256:` + lowercase hex of the SHA-256 of the
exact metadata bytes). Each vector records its input bytes and the
expected artifact ID, so any implementation can pin the rule
byte-exactly.

## Doctrine-projection cases

Some cases carry a `doctrine_projection` (Atlas cases with
`executable: false`, PM cases with the field present). These record
the expected *projection* under the doctrine — extras relocation,
lossless-only coercion, fail-closed sensitivity fallback,
unknown-closed-enum preservation (§3.1–3.2 of the design). No current
reader projects; projection is design §7 slice 2/6 work. These cases
are the oracle those implementations must satisfy. They are
deliberately **not** asserted against today's readers, whose
conforming behavior is parse-and-preserve (PM) and byte-exact
round-trip (Atlas staging).

## Rules for this set

- **Additive-only, like the schema.** A new schema version appends
new case files (`pm-metadata-v2.json`, …) and new cases; historical
cases are never edited or removed. If a case's expectation must
change, that is a doctrine event: record it in the design note's
change record and in the PR that changes it.
- Every case names its `historical_source` — the real shape, test, or
doctrine rule it comes from. Synthetic cases with no source do not
belong here.
- Rejection cases are part of conformance: a block with no version
key, or a version newer than the reader, must fail closed.

## CEN-04 conformance

This set introduces no persisted field and writes no store, so it
needs no new field-admission row under CEN-04 §5
(`doc/2026-11-23T13-51-45Z_design_cen04_schema_owner_migration_compatibility/`).
The facts it exercises already have owners there: the pm-metadata
block in the GitHub body is the record and `pm_metadata_items` is its
rebuildable projection (CEN-04 §3.10); Atlas staging rows are owned
by the Atlas producer profile (design §3.1). Fixtures are test data
about those facts, not a new home for them.
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
{
"fixture_set": "atlas-metadata-version-conformance",
"issue": "developing-today/code#9095",
"surface": "atlas",
"version_key": "schema_version",
"current_version": 1,
"source_design": "doc/2026-11-21T17-56-24Z_design_atlas_metadata_schema_v1/note.md",
"notes": "Cases with executable=true and a stage_row are asserted by the atlas-core conformance test (pkgs/atlas-search/crates/atlas-core/tests/metadata_conformance.rs): the row is inserted into a provisioned atlas_stage v1 database and read back through list_staged_items; meta must round-trip byte-exact and the database schema version must be 1. Cases with executable=false carry doctrine_projection: the recorded oracle for the projection behavior in design section 7 slices 2 and 6, not asserted against any current reader.",
"cases": [
{
"id": "atlas-stage-v1-producer-meta",
"historical_source": "The meta bag atlas_core::stage::stage_artifact writes today (atlas_stage v1, pkgs/atlas-search/schema/atlas_stage_v1.sql): an unversioned open JSON bag. This is the historical shape every staged item in the wild carries; the staging reader returns it byte-exact.",
"object": {
"repo": "developing-today/code",
"path": "pkgs/atlas-search/README.md",
"commit_sha": "0123456789abcdef0123456789abcdef01234567",
"kind": "prose",
"language": "md",
"unit": "whole-file",
"embedded_at": "2026-11-04T00:00:00Z",
"chunks": 3
},
"stage_row": {
"unit_id": "fixture-9095",
"kind": "prose",
"source": "developing-today/code:pkgs/atlas-search/README.md@0123456789abcdef0123456789abcdef01234567",
"sensitivity": "internal",
"text": "fixture body text",
"meta": "{\"chunks\":3,\"commit_sha\":\"0123456789abcdef0123456789abcdef01234567\",\"embedded_at\":\"2026-11-04T00:00:00Z\",\"kind\":\"prose\",\"language\":\"md\",\"path\":\"pkgs/atlas-search/README.md\",\"repo\":\"developing-today/code\",\"unit\":\"whole-file\"}"
},
"executable": true
},
{
"id": "atlas-v1-item-envelope",
"historical_source": "The doctrine v1 envelope (design section 2) for a corpus item: identity, content hash, source, chunking, provenance, extras. Rides the staging items.meta bag until the Atlas producer profile adopts it natively.",
"object": {
"schema_version": 1,
"fields": {
"identity": "sha256:1111111111111111111111111111111111111111111111111111111111111111",
"content_hash": "sha256:2222222222222222222222222222222222222222222222222222222222222222",
"source": "developing-today/code:pkgs/atlas-search/README.md@0123456789abcdef0123456789abcdef01234567",
"kind": "prose",
"sensitivity": "internal",
"chunking": {
"strategy": "boundary-safe",
"chunk_count": 3
},
"provenance": {
"producer": "atlas-stage",
"staged_at": "2026-11-21T00:00:00Z"
}
},
"extras": {}
},
"stage_row": {
"unit_id": "fixture-9095",
"kind": "prose",
"source": "developing-today/code:pkgs/atlas-search/README.md@0123456789abcdef0123456789abcdef01234567",
"sensitivity": "internal",
"text": "fixture body text",
"meta": "{\"extras\":{},\"fields\":{\"chunking\":{\"chunk_count\":3,\"strategy\":\"boundary-safe\"},\"content_hash\":\"sha256:2222222222222222222222222222222222222222222222222222222222222222\",\"identity\":\"sha256:1111111111111111111111111111111111111111111111111111111111111111\",\"kind\":\"prose\",\"provenance\":{\"producer\":\"atlas-stage\",\"staged_at\":\"2026-11-21T00:00:00Z\"},\"sensitivity\":\"internal\",\"source\":\"developing-today/code:pkgs/atlas-search/README.md@0123456789abcdef0123456789abcdef01234567\"},\"schema_version\":1}"
},
"executable": true
},
{
"id": "atlas-v1-embed-record",
"historical_source": "Per-embed record (issue scope: identity, content hash, source, chunking, embedder identity + model revision). The model named is the promotion-time embedder of record (atlas-stage book reference).",
"object": {
"schema_version": 1,
"fields": {
"item": "sha256:1111111111111111111111111111111111111111111111111111111111111111",
"content_hash": "sha256:2222222222222222222222222222222222222222222222222222222222222222",
"chunk": {
"index": 0,
"of": 3
},
"embedder": {
"id": "atlas-aggregator",
"model": "Snowflake/snowflake-arctic-embed-m-v2.0",
"model_revision": "v2.0"
},
"dims": 1024,
"provenance": {
"embedded_at": "2026-11-21T00:00:00Z"
}
},
"extras": {}
},
"stage_row": {
"unit_id": "fixture-9095",
"kind": "prose",
"source": "developing-today/code:pkgs/atlas-search/README.md@0123456789abcdef0123456789abcdef01234567",
"sensitivity": "internal",
"text": "fixture body text",
"meta": "{\"extras\":{},\"fields\":{\"chunk\":{\"index\":0,\"of\":3},\"content_hash\":\"sha256:2222222222222222222222222222222222222222222222222222222222222222\",\"dims\":1024,\"embedder\":{\"id\":\"atlas-aggregator\",\"model\":\"Snowflake/snowflake-arctic-embed-m-v2.0\",\"model_revision\":\"v2.0\"},\"item\":\"sha256:1111111111111111111111111111111111111111111111111111111111111111\",\"provenance\":{\"embedded_at\":\"2026-11-21T00:00:00Z\"}},\"schema_version\":1}"
},
"executable": true
},
{
"id": "atlas-v1-classification-record",
"historical_source": "Classification record per workstream D: the strict core enums kind/area/group/sensitivity with a ladder sensitivity value (shareable < personal < local-only < secret-bearing).",
"object": {
"schema_version": 1,
"fields": {
"item": "sha256:1111111111111111111111111111111111111111111111111111111111111111",
"kind": "prose",
"area": "atlas",
"group": "ingest",
"sensitivity": "local-only",
"classifications": [
{
"scheme": "workstream-d",
"label": "documentation"
}
],
"provenance": {
"classifier": "atlas-classify",
"classified_at": "2026-11-21T00:00:00Z"
}
},
"extras": {}
},
"stage_row": {
"unit_id": "fixture-9095",
"kind": "prose",
"source": "developing-today/code:pkgs/atlas-search/README.md@0123456789abcdef0123456789abcdef01234567",
"sensitivity": "internal",
"text": "fixture body text",
"meta": "{\"extras\":{},\"fields\":{\"area\":\"atlas\",\"classifications\":[{\"label\":\"documentation\",\"scheme\":\"workstream-d\"}],\"group\":\"ingest\",\"item\":\"sha256:1111111111111111111111111111111111111111111111111111111111111111\",\"kind\":\"prose\",\"provenance\":{\"classified_at\":\"2026-11-21T00:00:00Z\",\"classifier\":\"atlas-classify\"},\"sensitivity\":\"local-only\"},\"schema_version\":1}"
},
"executable": true
},
{
"id": "atlas-v1-invalid-sensitivity",
"historical_source": "A typo'd sensitivity token from a producer ('secrit'). Doctrine rule 5 / design section 3.1: sensitivity is safety-critical and closed; an invalid value resolves to the most restrictive ladder value and the original is retained in extras for correction.",
"object": {
"schema_version": 1,
"fields": {
"kind": "prose",
"sensitivity": "secrit"
},
"extras": {}
},
"executable": false,
"doctrine_projection": {
"fields": {
"kind": "prose",
"sensitivity": "secret-bearing"
},
"extras": {
"sensitivity": "secrit"
},
"reason": "unknown-enum"
}
},
{
"id": "atlas-v1-coercion",
"historical_source": "Type-directed handling (doctrine rule 4 / design section 3.2): an integer array offered to a string-array field converts losslessly; a string array that does not fully convert to an integer array relocates to extras unchanged. Partial conversion is forbidden.",
"object": {
"schema_version": 1,
"fields": {
"tags": [
1,
2,
3
],
"counts": [
"10",
"x"
]
},
"extras": {}
},
"executable": false,
"doctrine_projection": {
"fields": {
"tags": [
"1",
"2",
"3"
]
},
"extras": {
"counts": [
"10",
"x"
]
},
"reason": "unconvertible"
}
},
{
"id": "atlas-v1-unknown-closed-enum",
"historical_source": "An unknown value in the closed kind enum. Doctrine rule 5 / design section 3.1: preserve the original in extras with its source path and report unclassified; never substitute a guessed category.",
"object": {
"schema_version": 1,
"fields": {
"kind": "hologram",
"sensitivity": "personal"
},
"extras": {}
},
"executable": false,
"doctrine_projection": {
"fields": {
"sensitivity": "personal"
},
"extras": {
"kind": "hologram"
},
"reason": "unknown-enum"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"fixture_set": "metadata-digest-vectors",
"issue": "developing-today/code#9095",
"rule": "MetadataArtifactId = \"sha256:\" + lowercase_hex(SHA-256(exact_metadata_bytes)) (design section 2). For a PM block, the exact bytes are the JSON object text between the pm-metadata markers with one opening fence line and its closing fence line removed and leading/trailing ASCII whitespace trimmed. For a metadata file, the exact bytes are the file bytes unchanged.",
"vectors": [
{
"id": "pm-v1-canonical-block",
"body": "Issue text.\n\n<!-- pm-metadata:start -->\n```json\n{\n \"pm_meta\": 1,\n \"direct_parent\": null,\n \"links\": [],\n \"lineage\": {\n \"design\": null,\n \"roadmap_item\": null,\n \"priority\": null\n },\n \"provenance\": {},\n \"extras\": {}\n}\n```\n<!-- pm-metadata:end -->\n",
"extracted_bytes": "{\n \"pm_meta\": 1,\n \"direct_parent\": null,\n \"links\": [],\n \"lineage\": {\n \"design\": null,\n \"roadmap_item\": null,\n \"priority\": null\n },\n \"provenance\": {},\n \"extras\": {}\n}",
"artifact_id": "sha256:a07878cdef9194e25ff2e44bff15c347e06aa2774d0a062e7fc25101f7515c44"
},
{
"id": "atlas-v1-item-envelope-file",
"file_bytes": "{\"extras\":{},\"fields\":{\"chunking\":{\"chunk_count\":3,\"strategy\":\"boundary-safe\"},\"content_hash\":\"sha256:2222222222222222222222222222222222222222222222222222222222222222\",\"identity\":\"sha256:1111111111111111111111111111111111111111111111111111111111111111\",\"kind\":\"prose\",\"provenance\":{\"producer\":\"atlas-stage\",\"staged_at\":\"2026-11-21T00:00:00Z\"},\"sensitivity\":\"internal\",\"source\":\"developing-today/code:pkgs/atlas-search/README.md@0123456789abcdef0123456789abcdef01234567\"},\"schema_version\":1}",
"artifact_id": "sha256:ba9fb0c1c49930908593c7917fe9a5dc26b3bd5d75092ae93ab76fb73923e078"
}
]
}
Loading