feat(profiles): DEFAULT stamps commons' O2 generated, V1 executed

Commons ratified V1 2026-08-02 and executed it at `54e0ec7`; verified
against their tree rather than taken on report. ingest-spec.md:217 now
defines `generated` as `{ by: process:okf-ingest, at: <ingested_at> }`,
unquoted, `at` repeating `ingested_at` verbatim. `generated: true` no
longer appears in the spec.

`DEFAULT` states commons' §5 layer, so its stamp is theirs to decide.
`DEFAULT.ownership` gains the actor; the four goldens this repo's plan
named in advance were regenerated by RUNNING the materializer, each on
its own case's `ingested-at.txt`. The v0.2 golden was untouched, as
predicted -- it has carried the O2 form since D5.

Not a migration onto OKF v0.2: `DEFAULT` stays v0.1 on every axis
upstream owns and still emits no `sources`. Commons' spec and the Google
version are independent axes, and comments that narrated them as one
were rewritten rather than left to mislead. README and CLAUDE.md said
the additive rule without that boundary, which would have told a
consumer their DEFAULT bytes can never move; both now state it.

V-A3 is amended, not dropped. `DEFAULT` must OWN the mapping it now
writes -- a profile refusing its own output fires the collision gate on
files its own previous run wrote -- while a mapping naming a foreign
actor, or §7's `human:` actor on curated content, stays unowned. That
half is what carried the safety and it is asserted directly.

§11's stamp-integrity condition moved with the value: the forgeable
stamp was `true` and is now the mapping naming the ingest actor. The
defence was never the value -- the §3 scan globs `ingest-*.md`, so a
Door C import is unreachable however well it forges. Second spoof test
added; both were hand-mutated (glob widened to `*.md`) to confirm they
can fail.

The characterization test derived its foreign-stamp fixture from the
literal `generated: true`, which V1 leaves without a referent -- a
silent no-op waiting to happen. It now derives the needle from the
profile and asserts the substitution occurred.

Door B is deliberately untouched: not the ingest-spec's, marker is
`generated` + `source_file`, disjoint from Door A's `ingest_manifest`,
and the divergence predates V1.

Nothing released or notified. The pilot set pins `v0.5.0a2`, not `main`,
so this is invisible to portfolio-optimiser's freeze and demo; the
consumer exposure report is owed at the release that carries this.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VwcjUXbKySLbEG5WqTNkta
This commit is contained in:
Kjell Tore Guttormsen 2026-08-09 12:29:05 +02:00
commit 8318605e34
15 changed files with 280 additions and 50 deletions

View file

@ -136,8 +136,20 @@ def test_okf_latest_still_means_v0_1_until_ga() -> None:
# --- ownership ------------------------------------------------------------
def test_the_default_profile_still_stamps_the_v0_1_literal() -> None:
assert DEFAULT.ownership.stamp(INGESTED_AT) == "true"
def test_the_default_profile_stamps_the_form_commons_ratified() -> None:
"""V1, executed by commons 2026-08-09 (`54e0ec7`). `DEFAULT` states commons'
ingest-spec §5 layer, so the shape of its `generated` is theirs to decide
and they moved it off the v0.1 literal onto the O2 mapping. ingest-spec §7
defines the value as `{ by: process:okf-ingest, at: <ingested_at> }`,
unquoted, because frontmatter is parsed line-oriented and a quote would be a
character IN the value rather than syntax a parser strips.
`DEFAULT` and `OKF_V0_2` therefore agree on the stamp and on nothing else:
the profiles still differ in their index root frontmatter, their
type-conditional requirements and their `sources` derivation. The stamp
converging is the point of V1, not a sign the two profiles merged.
"""
assert DEFAULT.ownership.stamp(INGESTED_AT) == V0_2_STAMP
def test_the_v0_2_stamp_is_a_flow_mapping_whose_at_is_the_argument_exactly() -> None:
@ -170,14 +182,38 @@ def test_the_v0_2_predicate_also_accepts_the_v0_1_stamp(tmp_path: Path) -> None:
assert _is_ingest_owned(path, "manifest", profile=OKF_V0_2) is True
def test_the_default_predicate_still_refuses_the_v0_2_stamp(tmp_path: Path) -> None:
"""Recognition is one-way, which is what preserves V-A3. `DEFAULT` meeting a
v0.2 file refuses the run rather than replacing the file."""
def test_the_default_predicate_owns_the_stamp_v1_made_it_write(tmp_path: Path) -> None:
"""V-A3 as V1 leaves it. Before V1 this asserted the opposite — `DEFAULT`
refused the O2 mapping outright and that reading died the moment commons
made `DEFAULT` WRITE that mapping: a profile that will not own its own
output fires the §3 collision gate on the files its own previous run wrote.
The emitter and the predicate are coupled through `OwnershipPolicy`
precisely so they cannot part company here.
What V-A3 protected is unchanged and is asserted below: ownership binds the
ACTOR, not the shape. A mapping is owned when it names this profile's actor
and refused when it names any other.
"""
path = tmp_path / "ingest-orders.md"
path.write_bytes(_stamped_concept(V0_2_STAMP))
assert _is_ingest_owned(path, "manifest") is False
assert _is_ingest_owned(path, "manifest", profile=DEFAULT) is False
assert _is_ingest_owned(path, "manifest") is True
assert _is_ingest_owned(path, "manifest", profile=DEFAULT) is True
def test_the_default_predicate_refuses_a_foreign_actor(tmp_path: Path) -> None:
"""The half of V-A3 that survives V1 intact, and the one that carries the
safety: another implementation's bundle, and §7's `human:` actor on curated
content, both stay unowned under `DEFAULT`. Presence of the key proves
nothing upstream writes `generated` on hand-authored files too.
"""
foreign = tmp_path / "ingest-orders.md"
foreign.write_bytes(_stamped_concept(f"{{ by: process:some-other-tool, at: {INGESTED_AT} }}"))
curated = tmp_path / "ingest-products.md"
curated.write_bytes(_stamped_concept(f"{{ by: human:jsmith@acme, at: {INGESTED_AT} }}"))
assert _is_ingest_owned(foreign, "manifest", profile=DEFAULT) is False
assert _is_ingest_owned(curated, "manifest", profile=DEFAULT) is False
def test_a_foreign_v0_2_actor_is_never_ingest_owned(tmp_path: Path) -> None:
@ -249,10 +285,14 @@ def test_sources_follows_generated_in_the_emitted_block() -> None:
]
def test_the_default_profile_emits_neither_sources_nor_a_v0_2_generated() -> None:
"""V-A6 at the unit level: the seven-key v0.1 block, byte for byte. The
golden suite proves the same thing end to end; this one localizes a failure
to the renderer rather than to a fixture diff.
def test_the_default_profile_emits_no_sources_and_the_o2_generated() -> None:
"""V-A6 at the unit level, as V1 amends it: the seven-key block byte for
byte. `generated` now carries commons' O2 mapping, and `sources` — which is
upstream v0.2's, not commons' is still absent. That pairing is the whole
point of keeping the two contracts on separate axes.
The golden suite proves the same end to end; this one localizes a failure to
the renderer rather than to a fixture diff.
"""
rendered = _concept(FileSource(id="golden-catalogue", root="fixture"), profile=DEFAULT)
@ -264,11 +304,12 @@ def test_the_default_profile_emits_neither_sources_nor_a_v0_2_generated() -> Non
"source_query: orders.csv\n"
f"ingested_at: {INGESTED_AT}\n"
f"ingest_manifest: {STAMP}\n"
"generated: true\n"
f"generated: {{ by: process:okf-ingest, at: {INGESTED_AT} }}\n"
"---\n"
"\n"
"Body.\n"
)
assert "sources:" not in rendered
def test_the_http_credential_reference_never_reaches_the_frontmatter() -> None: