GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — okfctl/docs/specs/2026-11-26-okf-v0.3-gap-analysis.md at main · cwest/okfctl

Expand file tree

/

2026-11-26-okf-v0.3-gap-analysis.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
192 lines (164 loc) · 23.5 KB
/

2026-11-26-okf-v0.3-gap-analysis.md

Copy path

File metadata and controls

192 lines (164 loc) · 23.5 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

okfctl—OKF v0.3 gap analysis

Status: Complete (map for the v0.3 move; every gap closed, see Status) · Owner: Casey West · License: Apache-2.0 Source of truth: OKF v0.3 SPEC.md (version line **Version 0.3** confirmed; SPEC.md last changed 2026-11-18) · Code baseline: main at 314105d

Status

Every gap below is closed on main. This section is the tick list; the tables further down stay as they were written at 314105d, as the record of what each change had to fix.

Owner Closed by
W1 links and path fields per §6, with the §12.1 fallback (B1, C8a–C8c, C9, C10, A1 edge) #223
W2 §8.1 bundle metadata and extension keys on the root index.md (A2, A3, C4e root index) #222
W3 §5 timestamp, verified, status, superseded_by (B2, C5a, C5c, C6, C7b, C14d verified, A1) #225
W4 v0.3 as the target version; migrate v0.2 → v0.3 (C4c, C15) this change: SpecVersion = "0.3", bundle init declares okf_version: "0.3" on the root index.md, and migrate rewrites fallback-only bare paths to /-rooted, respells offset-bearing §5 timestamps, reports no-offset ones as judgment items, and keeps a later or unknown declared version (§12)
G1 type-less .md is not a concept (C3a, C14a) #226
G2 dot-paths are not part of the bundle (C3c) #226
G3 no symlink read outside the root (C3d, C8b) #221
G4 §11.2 null and single-item values (C6 null, C14b, C14c) #220
G5 node writers splice instead of re-encoding (C4e) #224
G6 warn on a sources entry without resource (C14d) #220
G7 staleness only from stale_after (§5.2, §11.2) #219

Q3 was settled as written in W1: the root index.md declaration wins, the .okf sidecar is a fallback, and "undeclared" is its own state, so the §12.1 fallback keys on the declared version and survives the SpecVersion bump.

Purpose

OKF v0.3 shipped upstream in open-knowledge-format/open-knowledge-format. The earlier home, GoogleCloudPlatform/open-knowledge-format, is deprecated and frozen at v0.2. okfctl still targets v0.2 (SpecVersion = "0.2" at internal/okf/reserved.go:23, TargetOkfVersion = "0.2" at internal/okf/migrate.go:49).

This document goes through v0.3 §13 ("Changes from v0.2") one item at a time. Each item gets a classification, the code that decides it, and the follow-up work that owns any gap. It is the map the v0.3 implementation work runs from. It does not change behavior.

Classifications:

  • Compliant—okfctl already does what v0.3 says.
  • Gap—okfctl does something v0.3 forbids, or skips something v0.3 requires. Each gap names its owner.
  • N/A—the item does not apply to okfctl's surface (for example, editorial text, or a runtime okfctl does not implement).

Owners:

Code Work item
W1 Resolve links and path fields per v0.3 §6, with the §12.1 bundle-root fallback
W2 Accept v0.3 §8.1 bundle metadata and extension keys on the root index.md
W3 Implement v0.3 §5 timestamp, verified, status, and superseded_by semantics
W4 Make v0.3 the target version and migrate v0.2 bundles forward
NEW Not covered by W1–W4. Listed under Gaps no work item covers

File:line references are against 314105d. Probe results came from a binary built from that commit and run against throwaway bundles. The real-corpus figures come from ~/src/knowledge-base/bundles/knowledge (380 .md files): validate 4 findings, lint --strict 49 findings.

§13.1 Breaking changes

# v0.3 change Class Evidence Owner
B1 A path field (or link) without a leading / resolves from the directory of its file (§6, §6.2). §12.1 fallback: bundles that declare ≤0.2 or no version MAY try the bundle root. Gap Every resolver tries the bundle root first and the file's directory second. That is the reverse of v0.3, and it applies to every bundle regardless of version: internal/okf/mutate.go:92 (scanNodeLinks, used by buildEdges at bundle.go:225), internal/okf/analyze.go:384 (danglingTargets), plus the root-relative forms in promote.go. Probe: sub/x.md linking [y](y.md) with both y.md and sub/y.md present gets the edge sub/x.md → y.md. Under v0.3 it is sub/y.md. Path fields are not resolved at all (see C10). W1
B2 Only current verification events (verified[].at ≥ generated.at, or no generated) count toward the trust tier (§5.3). Gap TrustTier (internal/okf/provenance.go:186) counts every event and never reads generated.at. A human sign-off made before an agent rewrite still reports human-reviewed. W3

Real-corpus exposure for B1: 437 bare body links resolve file-relative, and 0 resolve only through the bundle root (counted with a shell walk of every ](…) target outside log.md). 39 of the 48 non-URL resource: values are /-rooted. The other 9 are prose scope descriptors (see Q2). So the v0.3 rule is not expected to change body-link counts on this corpus. A v0.2 corpus with root-relative bare links would see changes, which is why the fallback matters.

§13.2 Clarifications and errata

# v0.3 item Class Evidence Owner
C1 §2: defines bundle root, producer, consumer, asset, path field, extension key. N/A Definitions only. okfctl treats the directory it is given as the bundle root. The §2 rule that a frontmatter-bearing root index.md marks the bundle root inside a larger repo is a discovery rule okfctl does not need, because the user names the root. none
C2 §2, §6.1: only the directory tree defines parent/child. A link is an untyped, directed relationship. Compliant GraphEdge (internal/okf/graph.go) is {from, to} with no type. Neighborhood comes from the directory (graph export neighborhood). none
C3a §3.2 rule 1–2: a .md file with no frontmatter or no type is not a concept. Consumers skip it, it does not affect conformance, and validators SHOULD warn. Gap (over-conformance). Closed by G1: ClassifyMarkdown (internal/okf/classify.go) routes it to Bundle.NonConcepts, and validate warns. Validate fails any non-reserved .md without type (internal/okf/validate.go:58). Probe: a bundle-local README.md and a title-only file each produce FAIL … missing or empty required field: type, and validate exits 1. v0.3 permits both, and names README.md/AGENTS.md/SKILL.md explicitly. These files also become graph nodes, orphans, and lint subjects (bundle.go:206 place puts every non-reserved .md into Nodes). The corpus has none today: every non-reserved .md opens with frontmatter. NEW
C3b §3.2 rule 3: non-.md files are assets, MAY be link/path-field targets, and are never concepts. Compliant The loader reads only .md (bundle.go:151). Link scanners only make edges to loaded nodes. danglingTargets ignores non-.md targets. none
C3c §3.2 rule 4: files and directories whose names start with . are not part of the bundle. Gap. Closed by G2: ClassifyPath/IsDotPath prune every dot-path in the walk, with or without --no-ignore. The walk skips only the DefaultSkipDirs list (bundle.go:142; .git, .venv, .cache, …). Any other dot-path is loaded. Probe: .draft.md appeared as a graph node, and .hidden/x.md with broken YAML made validate fail. NEW
C3d §3.2 rule 5: read only files under the bundle root, and do not follow symlinks that leave it. Gap filepath.WalkDir does not descend symlinked directories, but os.ReadFile follows a symlinked file (bundle.go Load). Probe: linked.md → /outside/secret.md was loaded, and its outside type and body appeared in graph export. This also breaks the §11.2 MUST NOT about reading outside the bundle root. NEW
C4a §4: frontmatter syntax. File starts with exactly ---, block ends at the next exact ---, YAML 1.2 core-schema mapping. Compliant splitFrontmatter (internal/okf/frontmatter.go:68) requires an exact --- first line and an exact --- closing line (CRLF-tolerant). gopkg.in/yaml.v3 is a YAML 1.2 parser. none
C4b §4: producers MUST NOT write duplicate keys. Consumers MAY reject them. Compliant yaml.v3 rejects duplicate keys, so validate reports unparseable frontmatter (probe dup.md). Rejecting is allowed. okfctl's writers edit through yaml.Node and never add a second copy of a key (setScalar, frontmatter_edit.go). none
C4c §4: producers SHOULD quote values that look like numbers or booleans (okf_version: "0.3"). Gap (producer) Scaffold writes the .okf sidecar unquoted (okf_version: 0.2, reserved.go:49), and bumpOkfSidecar writes it unquoted too (migrate.go:486). The root-index.md marker is quoted (reserved_lifecycle.go:215). The sidecar is an okfctl file, not an OKF one, so this is a SHOULD for okfctl's own output only. W4
C4d §4: producers SHOULD NOT use custom YAML tags. Compliant okfctl never writes tags. A consumer has no obligation here. Probe tag: !custom foo loads cleanly. none
C4e §4: a producer that modifies a file SHOULD NOT re-serialize values it did not change. Gap TouchModifiedFile (frontmatter_edit.go:42, encoder at :75), the migrator (migrate.go:306), and bumpRootIndexMarker (migrate.go:532) re-encode the whole mapping through yaml.v3. Probe: node refresh changing only modified also rewrote generated: { by: "human:a", at: 2026-06-20 10:00:00 } to {by: "human:a", at: '2026-06-20 10:00:00'}, collapsed title: "Spaced", and reflowed a trailing comment. W2 covers the root index.md. The node writers are not covered. W2 (root index), NEW (node writers, migrator)
C4f §4.2: the body is CommonMark with GFM tables and [^label] footnotes. Compliant okfctl parses bodies for links and citations only. Footnotes are read as citation markers (analyze.go citationCount). How links are recognized is under C9. none
C5a §5: timestamp keys (generated.at, verified[].at, stale_after, sources[].last_modified, usage_window.from/to) are an RFC 3339 date-time with offset or a date only (start of that day in UTC). Consumers accept quoted and native values. A date-time with no offset is invalid. Gap frontmatterTimeLocal (internal/okf/drift.go:46) parses quoted values with time.RFC3339 or 2006-01-02. A quoted no-offset value is silently treated as unparseable. A native no-offset value is accepted: yaml.v3 decodes 2026-06-20 10:00:00 into a UTC time.Time, so generated.at counted as a valid basis in the probe. Nothing reports either case. sources[].last_modified and usage_window are kept as raw strings and never checked (provenance.go Sources, parseUsageWindow). W3
C5b §5.2: generated.at means the last meaningful change, and a trivial edit does not move it. Compliant okfctl never writes generated.at on an edit. node refresh/edit touch only okfctl's own modified (timestamps.go). The migrator sets generated only when converting a legacy timestamp. none
C5c §5.2: a verified event requires both by and at. Consumers ignore an event without both. Gap parseVerification (provenance.go:254) keeps an event that has either field (by == "" && !dated is the only rejection, :257). An at-less human event still yields human-reviewed. W3
C6 §5.4: an unknown status value is not stable, and current-knowledge filters exclude it. Gap (partial) lintStatusLifecycle (internal/okf/lint_lifecycle.go:31) flags any out-of-enum value under lint --strict, worded as a defect. §11.2 rule 4 makes that a MAY-warn, and §5.4 defines the meaning. Status() (provenance.go:200) returns the raw value, so nothing treats it as not-stable. okfctl has no current-knowledge filter today, so the "exclude" half is latent. A null status: is reported as status "<nil>", but §11.2 rule 1 says null equals absent, which is stable. W3 (null case: see G4)
C7a §5.5: stale means "check again," not "false." N/A Wording. none
C7b §5.5: a stale_after value that does not parse is never fresh, and SHOULD be shown as malformed. Gap IsStale (provenance.go:234) returns false (fresh) when StaleAfter fails to parse. Nothing reports the malformed value. W3
C8a §6: one resolution rule for links and path fields. URI scheme means absolute. Leading / means bundle root. Anything else resolves from the file's directory. Consumers MUST resolve both in-bundle forms. Gap Same root-first order as B1. Scheme detection is only http:///https:// (mutate.go:74, analyze.go danglingTargets), so mailto:a.md shows up as a dangling concept link (probe). W1
C8b §6: a value that resolves outside the bundle root is external, and MUST NOT be read from the local file system. Gap (latent) Link targets are only looked up in the in-memory Nodes map, so ../ escapes never touch the disk. They are reported as dangling, not external. C3d is the real out-of-root read. W1 (classification), NEW (C3d)
C8c §6: targets are RFC 3986 URI references (percent-encoded), and paths are case-sensitive. Gap Targets are never percent-decoded. Probe: [c](sub/c%20d.md) with sub/c d.md present is reported dangling. Case-sensitivity is compliant: lookups are exact matches against the walked file names, so Foo.md never resolves to foo.md. W1 (percent-decoding)
C9 §6.1: a link refers to a concept when its target, without #fragment, resolves to a concept file. Reference-style links are links. [[wikilinks]] are not. Gap scanNodeLinks does not strip #fragment (probe: [f](sub/y.md#sec) makes no edge, though danglingTargets strips it). The inline-only regex (bundle.go mdLinkRe) misses reference-style links (probe: [r][ref] + [ref]: sub/x.md makes no edge). The wikilink rule is compliant: [[x]] is never treated as a link. W1
C10 §6.4: path fields that resolve to a concept are graph edges. Gap BuildGraph (graph.go:46) emits body-link edges only (OutboundLinks, :68). No path field (resource, sources[].resource, computation, executor.resource, attester.resource, superseded_by) becomes an edge. W1
C11 §7: general <scheme>:<id> actors with team:. Other schemes are accepted and non-human. sources[].author uses the actor convention. Compliant Actor.IsHuman (provenance.go:55) is a human: prefix test, so team:, process:, and unknown schemes are all non-human. sources[].author is kept verbatim. none
C12 §9: log.md has no frontmatter. Compliant validateReservedLog rejects a frontmatter block (internal/okf/validate_log.go:52). none
C13a §10.2: parameters entries require name and type, and required defaults to false. N/A okfctl does not interpret Attested Computation contracts. No code reads runtime, parameters, executor, or attester, and unknown keys pass. The path fields among them are part of C10/W1. none
C13b §10.3: the locator rule for the inline computation. N/A okfctl does not locate or run computations. none
C13c §10.5: discovery by frontmatter scan. A verdict has ok and an optional reason. N/A Runtime protocol. okfctl never shows a value as attested, so the §10.2/§11.2 MUST NOT holds trivially. none
C14a §11: conformance does not require frontmatter in every .md. Gap (over-conformance). Closed with C3a. Same root cause as C3a: validate.go:58. NEW
C14b §11.2 rule 1: null, empty string, and empty list mean absent. Gap (partial) Mostly holds, because readers test for non-empty strings (Status, stringField). It fails for null status (C6). G4
C14c §11.2 rule 2: list fields (tags, sources, verified, parameters) accept one item as a one-item list. A scalar tags is one tag and is not split at commas. Gap (partial) tags: compliant (nodeTags, analyze.go:669). verified: compliant (bare mapping handled, provenance.go:156). sources: gap. Sources() requires a YAML list (provenance.go:101), so sources: { id: s, resource: "https://x" } is dropped and the node is reported uncited (probe srcmap.md). parameters: N/A (C13a). NEW (sources)
C14d §11.2 rule 3: ignore a family entry missing its REQUIRED key, and SHOULD warn. Gap (partial) sources entries without resource are ignored (provenance.go, Sources) but no warning is shown. verified events missing a field are not ignored (C5c). W3 (verified), NEW (warning)
C14e §11.2 rule 4: an out-of-vocabulary value is kept, and the consumer MAY warn. Compliant (except status) Unknown type and unknown keys pass validate. status is under C6. W3
C15 §12: a pre-1.0 versioning policy. A consumer that does not know the declared version SHOULD try best-effort consumption. Compliant Probe: a bundle declaring okf_version: "9.9" (sidecar and root index) passes validate, and migrate --dry-run writes an empty plan. Nothing refuses it. See Q3 for how the version is read. W4 (keep it that way)
C16 Editorial: the examples quote timestamps, use relative links, and use a leading / in path fields. references/ is no longer external-only. N/A Spec text. okfctl has no references/ special case. none

§13.3 Additive changes

# v0.3 addition Class Evidence Owner
A1 superseded_by on deprecated concepts, plus retire/move guidance (§5.4). Gap No code reads superseded_by. A dangling target is not reported, and the field is not a graph edge. node mv (mutate.go PlanMove) rewrites inbound links but does not leave a deprecated stub with superseded_by. The informative guidance makes that optional. The corpus has 4 deprecated nodes and no superseded_by. W3 (semantics, dangling), W1 (path field, edge)
A2 Bundle metadata on the root index.md: title, description, license (§8.1). Producers that regenerate index.md MUST keep this frontmatter. Gap (over-conformance) validateReservedIndex allows only okf_version (internal/okf/validate.go:104, message at :124). index build emits only an okf_version block (reserved_lifecycle.go:215), so any other root key is lost on regeneration. W2
A3 Extension keys are allowed at every level, and future versions will not define x- keys (§4.1). Compliant on concepts, Gap on the root index Concept frontmatter: unknown keys pass validate, and yaml.Node writers keep them. Root index.md: rejected, same code as A2. W2

Gaps no work item covers

These need their own issue or card. None of them is in the scope of W1–W4 as written.

Code Gap §13 rows Direction
G1 A .md file without frontmatter or without type fails validate and becomes a graph/lint node. v0.3 says it is not a concept, does not affect conformance, and validators SHOULD warn. C3a, C14a Over-conformance (a bundle v0.3 calls conformant fails validate)
G2 Dot-paths (.draft.md, .hidden/…) are loaded unless listed in DefaultSkipDirs. C3c Under-conformance
G3 A symlinked .md file pointing outside the bundle root is read and loaded. C3d, C8b Under-conformance on a §11.2 MUST NOT. Security-relevant for connect/registry bundles from remote sources.
G4 §11.2 rule 1 and rule 2 holes: null status: reports "<nil>" instead of meaning stable, and a single-mapping sources is dropped, which marks the node uncited. W3 may absorb the status half. C6, C14b, C14c Over-conformance (a finding where the spec defines a value)
G5 The node writers (node refresh/edit, the migrator's per-node edit) re-serialize unchanged frontmatter values. C4e SHOULD (diff noise)
G6 sources entries missing resource are dropped silently. v0.3 says SHOULD warn. C14d SHOULD
G7 analyze's "Freshness—stale" section ages a node from verified/generated/modified and calls it stale past 180 days (analyze.go analyzeFreshness). §5.2 says "only stale_after decides freshness," and §11.2 says staleness SHOULD come only from stale_after. IsStale (the stale_after reader) is not called by any command. §5.2, §11.2 (C5b, C7b context) SHOULD. The heuristic may stay as a differently named advisory. See Q5.

Ambiguities to settle before implementing

These are open questions, not decisions. Each one should be settled in the PR that implements it.

  • Q1 (§3.2 rule 2, "validators SHOULD warn"). validate reports only failures (exit 1), with no warning channel. Is the warning for a type-less .md a validate warning (new non-failing output), or a lint finding? v0.3 forbids the current failure either way.
  • Q2 (§5.1/§6.2, scope descriptor vs path). sources[].resource "can be a scope descriptor… In that case, it is not a path." The spec gives no test that tells them apart. The corpus has 9 prose descriptors, some containing /. W1's path-field broken-link check needs a rule (for example: no scheme, not /-rooted, and contains whitespace means descriptor) that is not over-conformant.
  • Q3 (§12.1, "declares no version"). okfctl reads the declared version from its own .okf sidecar (readOkfVersion, bundle.go:199). It does not read the root index.md okf_version that §8.1/§12 define, and it falls back to SpecVersion when there is no sidecar. The real corpus has no .okf and no root-index.md frontmatter, so it declares no version, but okfctl reports it as 0.2. Once W4 bumps SpecVersion, an undeclared bundle reads as 0.3, and a fallback keyed on Bundle.OkfVersion turns off for exactly the bundles §12.1 lets it cover. W1 and W4 need one answer: which declaration wins, and is "undeclared" a distinct state from the build's default?
  • Q4 (§5, native timestamps). "Consumers MUST accept … a YAML-native timestamp," and "a date-time without an offset stays invalid." yaml.v3 decodes a native no-offset value to UTC and drops the fact that there was no offset. Rejecting native no-offset values means looking at the yaml.Node source text, not the decoded time.Time.
  • Q5 (§5.2/§11.2, freshness). Is analyze's age-based "stale" list a violation of the §11.2 SHOULD, or an advisory that only needs renaming ("aged," "revalidate") so it does not claim §5.5 staleness? This decides whether G7 is a fix or a relabel.
  • Q6 (§11.2 rule 4 vs lint --strict). For an unknown status, the spec allows a MAY-warn. lint --strict turns lint findings into a failing exit. W3 should decide whether status-lifecycle stays in the strict set.

Non-findings worth recording

  • Real corpus and the v0.3 resolution rule. 0 of 437 bare body links depend on bundle-root resolution, so W1 should leave corpus validate/lint/analyze counts unchanged. A moved count is a W1 regression signal, not an expected shift.
  • Unknown okf_version. Already handled best-effort (C15). W4 must keep it that way.
  • v0.1 fallbacks. v0.3 §12.1 keeps the Appendix B fallbacks (timestamp, # Citations). Generated() (provenance.go:138) and SourceCitations() keep working and MUST stay.
You are visitor 01402860 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.