test(okf): add running n-way per-file parity gate + adversarial corpus (STEG 3)
Make OKF §3 checker parity a RUNNING per-file red/green signal instead of a
stale one-shot claim. The catalog and okr checkers provably diverge on the same
input (catalog walks everything + no BOM/CRLF norm; okr skips innboks/dot-dirs +
normalizes); this gate turns that divergence into a monitored, tested fact.
- scripts/check-okf-parity.mjs: n-way runner, zero-dep. Normalizes each impl's
existing checkBundle(root) return to {conceptCount, untyped[], okfVersion} and
compares per file over default read-mode. Impl registry is availability-guarded
so a catalog-only checkout degrades gracefully; a documented subprocess seam
awaits llm-ingestion-okf's Python checker (fase 2) + Node port (fase 4).
- test/okf-parity-corpus/: committed byte-exact adversarial corpus + manifest.
Red-proof fixtures (expected: diverge) the gate MUST go red on — byte axis
(BOM+CRLF) and tree axis (innboks, dot-dir) each carry one; canon = both.
.gitattributes -text pins the BOM/CRLF bytes. Green fixtures pin agreement
incl. a SHARED gap (both descend into node_modules).
- check-okf-parity.test.mjs: 8/8. Corpus assertions + byte-tracking red-proof +
runtime-materialized symlink/NFC-NFD meta-tests + graceful-skip seam.
Honest scope: only 2 impls expose a runnable per-file checker today, so the gate
runs 2-way and is architected n-way — no faked third impl, no cross-repo code.
spec §7 + log.md updated (no self-certified parity; fixes stay upstream-first).
Verified: parity 8/8, CLI exit 0; regression 33/33; check-versions 10 OK.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NeK9hkxrU9wFPBYGYnSV1V
This commit is contained in:
parent
3be4321a79
commit
09521f8f2d
31 changed files with 531 additions and 10 deletions
4
test/okf-parity-corpus/.gitattributes
vendored
Normal file
4
test/okf-parity-corpus/.gitattributes
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# Parity corpus fixtures are byte-exact adversarial inputs (BOM, CRLF, LF).
|
||||
# Disable ALL git EOL/text conversion here so a contributor with core.autocrlf=true
|
||||
# cannot mangle the CRLF/BOM bytes the byte-axis fixtures depend on.
|
||||
* -text
|
||||
3
test/okf-parity-corpus/green-baseline/index.md
Normal file
3
test/okf-parity-corpus/green-baseline/index.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
okf_version: 0.1
|
||||
|
||||
# Bundle root
|
||||
8
test/okf-parity-corpus/green-baseline/profile.md
Normal file
8
test/okf-parity-corpus/green-baseline/profile.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
type: Profile
|
||||
title: A concept
|
||||
description: A typed concept file.
|
||||
resource: about
|
||||
timestamp: 2026-07-23
|
||||
---
|
||||
# Profile
|
||||
3
test/okf-parity-corpus/green-dupname/a/index.md
Normal file
3
test/okf-parity-corpus/green-dupname/a/index.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# a
|
||||
|
||||
Directory enumeration (no frontmatter).
|
||||
8
test/okf-parity-corpus/green-dupname/a/note.md
Normal file
8
test/okf-parity-corpus/green-dupname/a/note.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
type: NoteA
|
||||
title: A concept
|
||||
description: A typed concept file.
|
||||
resource: about
|
||||
timestamp: 2026-07-23
|
||||
---
|
||||
# NoteA
|
||||
3
test/okf-parity-corpus/green-dupname/b/index.md
Normal file
3
test/okf-parity-corpus/green-dupname/b/index.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# b
|
||||
|
||||
Directory enumeration (no frontmatter).
|
||||
8
test/okf-parity-corpus/green-dupname/b/note.md
Normal file
8
test/okf-parity-corpus/green-dupname/b/note.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
type: NoteB
|
||||
title: A concept
|
||||
description: A typed concept file.
|
||||
resource: about
|
||||
timestamp: 2026-07-23
|
||||
---
|
||||
# NoteB
|
||||
3
test/okf-parity-corpus/green-dupname/index.md
Normal file
3
test/okf-parity-corpus/green-dupname/index.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
okf_version: 0.1
|
||||
|
||||
# Bundle root
|
||||
3
test/okf-parity-corpus/green-hierarchical/index.md
Normal file
3
test/okf-parity-corpus/green-hierarchical/index.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
okf_version: 0.1
|
||||
|
||||
# Bundle root
|
||||
10
test/okf-parity-corpus/green-hierarchical/sub/child.md
Normal file
10
test/okf-parity-corpus/green-hierarchical/sub/child.md
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
type: Child
|
||||
title: Child concept
|
||||
description: Links up a level.
|
||||
resource: child
|
||||
timestamp: 2026-07-23
|
||||
---
|
||||
# Child
|
||||
|
||||
See [top](../top.md).
|
||||
3
test/okf-parity-corpus/green-hierarchical/sub/index.md
Normal file
3
test/okf-parity-corpus/green-hierarchical/sub/index.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# sub
|
||||
|
||||
Directory enumeration (no frontmatter).
|
||||
8
test/okf-parity-corpus/green-hierarchical/top.md
Normal file
8
test/okf-parity-corpus/green-hierarchical/top.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
type: Top
|
||||
title: A concept
|
||||
description: A typed concept file.
|
||||
resource: about
|
||||
timestamp: 2026-07-23
|
||||
---
|
||||
# Top
|
||||
3
test/okf-parity-corpus/green-nodemodules/index.md
Normal file
3
test/okf-parity-corpus/green-nodemodules/index.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
okf_version: 0.1
|
||||
|
||||
# Bundle root
|
||||
4
test/okf-parity-corpus/green-nodemodules/node_modules/dep.md
generated
vendored
Normal file
4
test/okf-parity-corpus/green-nodemodules/node_modules/dep.md
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: dep, no type
|
||||
---
|
||||
# dep
|
||||
8
test/okf-parity-corpus/green-nodemodules/typed.md
Normal file
8
test/okf-parity-corpus/green-nodemodules/typed.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
type: Note
|
||||
title: A concept
|
||||
description: A typed concept file.
|
||||
resource: about
|
||||
timestamp: 2026-07-23
|
||||
---
|
||||
# Note
|
||||
56
test/okf-parity-corpus/manifest.json
Normal file
56
test/okf-parity-corpus/manifest.json
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
"_doc": "Expected per-fixture parity outcome for check-okf-parity.mjs. The runner COMPARES actual vs this expectation; it does not judge the fasit. 'diverge' fixtures are the red-proof: the gate MUST go red on them, else the gate itself is broken. Axes are catalog-owned (trinn F D4), spec-adversarial, defined over DEFAULT read-mode (strictIngest OFF).",
|
||||
"fixtures": {
|
||||
"green-baseline": {
|
||||
"axis": "baseline",
|
||||
"expected": "agree",
|
||||
"note": "Clean UTF-8/LF conforming bundle. Sanity anchor: proves the gate is not red-on-everything."
|
||||
},
|
||||
"red-byte-bom": {
|
||||
"axis": "byte",
|
||||
"expected": "diverge",
|
||||
"note": "Concept file with UTF-8 BOM + CRLF that HAS type: -> catalog's /^---\\n/ fence misses the BOM (falsely untyped), okr normalizes (frontmatter.mjs:23) and reads the type. Diverges on the untyped-set with an IDENTICAL count (the 'agree OK / disagree on members' case)."
|
||||
},
|
||||
"red-tree-innboks": {
|
||||
"axis": "tree",
|
||||
"expected": "diverge",
|
||||
"note": "innboks/ drop-zone with a raw frontmatter-less file -> catalog walks it and counts it a concept, okr skips innboks (okf-check.mjs:37-39). Diverges on conceptCount + untyped-set."
|
||||
},
|
||||
"red-tree-dotdir": {
|
||||
"axis": "tree",
|
||||
"expected": "diverge",
|
||||
"note": ".hidden/ dot-dir with an untyped .md -> catalog descends, okr skips dot-dirs. Diverges on conceptCount + untyped-set."
|
||||
},
|
||||
"red-combined": {
|
||||
"axis": "byte+tree",
|
||||
"expected": "diverge",
|
||||
"note": "The record's canon fixture (svar-catalog.local.md:48): a BOM+CRLF typed concept AND an innboks/ raw file in one bundle -> catalog FAIL(2 untyped) vs okr OK(0 untyped), opposite exit codes. Byte and tree axes each carry their own red proof."
|
||||
},
|
||||
"green-hierarchical": {
|
||||
"axis": "tree-hierarchical",
|
||||
"expected": "agree",
|
||||
"note": "okr's added requirement (trinn-e-analyse:277): subdir pointers, per-level index.md, a cross-level body relation. No adversarial trigger -> both walk the hierarchy identically. Guards against a corpus that is accidentally flat."
|
||||
},
|
||||
"green-nodemodules": {
|
||||
"axis": "tree",
|
||||
"expected": "agree",
|
||||
"note": "SHARED GAP, pinned deliberately: an untyped .md inside node_modules/. BOTH catalog and okr descend into it (okr's isWalkableDir skips only dot-dirs + innboks, not node_modules). They agree today; flagged here for future hardening of both walkers."
|
||||
},
|
||||
"green-dupname": {
|
||||
"axis": "tree",
|
||||
"expected": "agree",
|
||||
"note": "Same basename (note.md) at two sibling levels -> both impls key on the full relative path, no basename-collapse. Guards the path.name-collapses-hierarchy class."
|
||||
}
|
||||
},
|
||||
"coveredByRuntimeTests": {
|
||||
"_doc": "These axes are git/FS-hostile as committed files on macOS, so they live as runtime-materialized meta-tests in check-okf-parity.test.mjs (temp dir), not in this committed corpus.",
|
||||
"symlink": "Symlinked .md, symlinked dir, and a symlink loop -> both impls skip symlinks (Dirent isFile/isDirectory are false), no crash/hang. Materialized because a committed symlink degrades to a plain path-string file where core.symlinks=false.",
|
||||
"nfc-nfd-filename": "Precomposed (NFC) vs combining (NFD) filename bytes. platform-sensitive + soft-gated: git core.precomposeunicode normalizes NFD->NFC on macOS checkout, so the divergence cannot be pinned as a committed filename. The test logs if the FS normalized it away and does not hard-fail on this axis alone."
|
||||
},
|
||||
"withdrawn": {
|
||||
"verbatim-trailing-newline": "Trinn E §1 (svar-catalog.local.md:742) withdrew it: linkedin-studio's newline-free serializer applies to ingest/published/, which is excluded from the OKF bundle by design; brain/ files DO get \\n. Re-classified a writer-parameter, not a form axis."
|
||||
},
|
||||
"outOfScope": {
|
||||
"sti-former": "Path-forms (~-expansion, Windows separators, plugin-root anchoring). Trinn E (authoritative over STATE) does not re-list it in the D4 axis enumeration; folded into the §1.2 resolution-order spec text -> STEG 5 discovery convention, not the STEG 3 parity corpus."
|
||||
}
|
||||
}
|
||||
5
test/okf-parity-corpus/red-byte-bom/bom.md
Normal file
5
test/okf-parity-corpus/red-byte-bom/bom.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
type: Note
|
||||
title: BOM concept
|
||||
---
|
||||
# BOM
|
||||
3
test/okf-parity-corpus/red-byte-bom/index.md
Normal file
3
test/okf-parity-corpus/red-byte-bom/index.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
okf_version: 0.1
|
||||
|
||||
# Bundle root
|
||||
4
test/okf-parity-corpus/red-combined/bom.md
Normal file
4
test/okf-parity-corpus/red-combined/bom.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
type: Note
|
||||
---
|
||||
# BOM
|
||||
3
test/okf-parity-corpus/red-combined/index.md
Normal file
3
test/okf-parity-corpus/red-combined/index.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
okf_version: 0.1
|
||||
|
||||
# Bundle root
|
||||
1
test/okf-parity-corpus/red-combined/innboks/raw.md
Normal file
1
test/okf-parity-corpus/red-combined/innboks/raw.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
raw file, no frontmatter
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: hidden untyped
|
||||
---
|
||||
# no type
|
||||
3
test/okf-parity-corpus/red-tree-dotdir/index.md
Normal file
3
test/okf-parity-corpus/red-tree-dotdir/index.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
okf_version: 0.1
|
||||
|
||||
# Bundle root
|
||||
8
test/okf-parity-corpus/red-tree-dotdir/typed.md
Normal file
8
test/okf-parity-corpus/red-tree-dotdir/typed.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
type: Note
|
||||
title: A concept
|
||||
description: A typed concept file.
|
||||
resource: about
|
||||
timestamp: 2026-07-23
|
||||
---
|
||||
# Note
|
||||
3
test/okf-parity-corpus/red-tree-innboks/index.md
Normal file
3
test/okf-parity-corpus/red-tree-innboks/index.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
okf_version: 0.1
|
||||
|
||||
# Bundle root
|
||||
1
test/okf-parity-corpus/red-tree-innboks/innboks/raw.md
Normal file
1
test/okf-parity-corpus/red-tree-innboks/innboks/raw.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
raw drop-zone file, no frontmatter
|
||||
8
test/okf-parity-corpus/red-tree-innboks/typed.md
Normal file
8
test/okf-parity-corpus/red-tree-innboks/typed.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
type: Note
|
||||
title: A concept
|
||||
description: A typed concept file.
|
||||
resource: about
|
||||
timestamp: 2026-07-23
|
||||
---
|
||||
# Note
|
||||
Loading…
Add table
Add a link
Reference in a new issue