Skip to content

fix(okf): accept the v0.2 generated mapping, retire the v0.1 timestamp - #15

Merged
opendpp-node merged 1 commit into
mainfrom
opendpp-node/okf-v02-validator
Jul 26, 2026
Merged

fix(okf): accept the v0.2 generated mapping, retire the v0.1 timestamp#15
opendpp-node merged 1 commit into
mainfrom
opendpp-node/okf-v02-validator

Conversation

@opendpp-node

Copy link
Copy Markdown
Member

What

Teach validate.mjs the OKF v0.2 frontmatter contract:

  • generated replaces timestamp. SPEC §5.2 moved provenance into a generated: { by, at } mapping and retired v0.1's bare timestamp. REQUIRED still demanded timestamp, so the first v0.2 sync failed on all 213 concepts.
  • generated gets a block check. It's a mapping, so its indented children are unreachable by the scalar key: value probe. The new check mirrors the upstream contract (opendpp-node:src/okf/validate.ts): by is a non-empty actor, at is an ISO 8601 instant.
  • A leftover top-level timestamp is 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.
  • One correctness fix in passing: the scalar probe moves from \s*\S to [ \t]*\S. \s matches newlines, so it stepped onto the following line and read an empty title: as populated.

Why

The bundle emitter moved to OKF v0.2 upstream (opendpp-node #1155). This repo owns validate.mjs — it is excluded from the rsync --delete mirror — 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:

Injected Reported
generated block removed missing "generated" mapping (SPEC §5.2)
by: emptied "generated.by" is required and must be a non-empty actor
at: yesterday "generated.at" must be an ISO 8601 datetime
legacy timestamp: re-added legacy v0.1 "timestamp" key — use "generated.at"
title: emptied missing non-empty "title"

The last case is the one the old \s*\S probe would have passed.

…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.
@opendpp-node
opendpp-node marked this pull request as ready for review July 26, 2026 21:33
@opendpp-node
opendpp-node merged commit 1cd73bc into main Jul 26, 2026
3 checks passed
@opendpp-node
opendpp-node deleted the opendpp-node/okf-v02-validator branch July 26, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant