fix(okf): accept the v0.2 generated mapping, retire the v0.1 timestamp - #15
Merged
Conversation
…tamp`
The bundle emitter moved to OKF v0.2, where SPEC §5.2 replaced the bare
`timestamp` frontmatter key with a `generated: { by, at }` mapping. This
validator still required `timestamp`, so the first v0.2 sync failed CI on
all 213 concepts.
Mirror the upstream contract (opendpp-node:src/okf/validate.ts): `by` is a
non-empty actor, `at` is an ISO 8601 instant, and a leftover top-level
`timestamp` is now itself an error — a bundle carrying both shapes is
half-migrated, and accepting it here would hide exactly that drift.
`generated` is a mapping, so its indented children are out of reach of the
scalar `key: value` probe and get their own block check. That probe also
moves from `\s*\S` to `[ \t]*\S`: `\s` matches newlines, so it stepped onto
the following line and read an empty `title:` as populated.
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.
What
Teach
validate.mjsthe OKF v0.2 frontmatter contract:generatedreplacestimestamp. SPEC §5.2 moved provenance into agenerated: { by, at }mapping and retired v0.1's baretimestamp.REQUIREDstill demandedtimestamp, so the first v0.2 sync failed on all 213 concepts.generatedgets a block check. It's a mapping, so its indented children are unreachable by the scalarkey: valueprobe. The new check mirrors the upstream contract (opendpp-node:src/okf/validate.ts):byis a non-empty actor,atis an ISO 8601 instant.timestampis now an error. A bundle carrying both shapes is half-migrated — consumers would read a field the producer no longer maintains. Upstream rejects it, so accepting it here would hide precisely that drift.\s*\Sto[ \t]*\S.\smatches newlines, so it stepped onto the following line and read an emptytitle:as populated.Why
The bundle emitter moved to OKF v0.2 upstream (opendpp-node #1155). This repo owns
validate.mjs— it is excluded from thersync --deletemirror — so the sync can never update it, and it stayed pinned to v0.1 semantics. CI has been red since the first v0.2 bundle landed (chore: sync OKF bundle from opendpp-node@86bab15).Verification
Reproduced locally against the real synced bundle (213 errors →
✓ OKF bundle valid (223 concepts)), then confirmed the validator is not passing vacuously — each failure mode was injected into a scratch copy and re-run:generatedblock removedmissing "generated" mapping (SPEC §5.2)by:emptied"generated.by" is required and must be a non-empty actorat: yesterday"generated.at" must be an ISO 8601 datetimetimestamp:re-addedlegacy v0.1 "timestamp" key — use "generated.at"title:emptiedmissing non-empty "title"The last case is the one the old
\s*\Sprobe would have passed.