Skip to content

fix: align okf output with google v0.1#373

Merged
Colin Francis (colifran) merged 3 commits into
langchain-ai:mainfrom
ruanbarroso:fix/google-okf-v0.1-conformance
Jul 17, 2026
Merged

fix: align okf output with google v0.1#373
Colin Francis (colifran) merged 3 commits into
langchain-ai:mainfrom
ruanbarroso:fix/google-okf-v0.1-conformance

Conversation

@ruanbarroso

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #345 and #84 that aligns OpenWiki with the canonical Google OKF v0.1 specification.

  • accept the optional timestamp field and producer-defined extension fields
  • require only a non-empty type for concepts
  • treat index.md and log.md as reserved documents, not concepts
  • emit okf_version: "0.1" only in the root index and no frontmatter in nested indexes
  • preserve extension fields in agent and migration guidance
  • remove contradictory prompt requirements for title, description, and tags
  • document the supported OKF behavior

Tests

  • pnpm run format:check
  • pnpm run lint:check
  • pnpm run typecheck
  • pnpm run test — 338 tests passed across 32 files
  • pnpm run build
  • strict validation of openwiki/ with an independent OKF v0.1 validator — 7 concepts, 0 errors, 0 warnings
  • generated end-to-end fixture — 2 concepts, 0 errors, 0 warnings

@colifran Colin Francis (colifran) changed the title fix: align OKF output with Google v0.1 fix: align okf output with google v0.1 Jul 17, 2026

const OKF_STRING_FIELDS = ["type", "title", "description", "resource"];
const OKF_FIELDS = new Set([...OKF_STRING_FIELDS, "tags"]);
const OKF_STRING_FIELDS = [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we losing tags here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, tags is still validated — it just isn't part of the OKF_STRING_FIELDS list because it's a list, not a string. It has its own dedicated check further down (unchanged by this PR):

if (
  Object.hasOwn(fields, "tags") &&
  (!Array.isArray(fields.tags) ||
    fields.tags.some((tag) => typeof tag !== "string" || !tag.trim()))
) {
  issues.push(issue("invalid_tags", "Field `tags` must be a YAML list of non-empty strings."));
}

What went away is the old OKF_FIELDS allowlist that produced the unsupported_field error. That removal is intentional: OKF v0.1 permits producer-defined extension fields, so we can no longer reject unknown keys.

One conscious trade-off worth flagging: without the allowlist, a typo in a standard field (e.g. descriptoin:) now passes silently as an "extension" instead of erroring. Erroring would violate the spec, so I left it as-is — happy to open a follow-up issue for a heuristic "did you mean" warning if you think it's worth it.

const LOG_FILE = "log.md";
const EXCLUDED_FILES = new Set([
INDEX_FILE,
LOG_FILE,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice - good catch.

.filter(Boolean)
.join("\n\n");
return `---\ntype: Documentation Index\ntitle: ${JSON.stringify(title)}\ndescription: ${JSON.stringify(`Files and subdirectories in ${title}.`)}\n---\n\n${sections}\n`;
const version = isRoot ? '---\nokf_version: "0.1"\n---\n\n' : "";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also a great catch.

@colifran Colin Francis (colifran) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great and thank you! I have one question about tags before we merge.

…-conformance

# Conflicts:
#	openwiki/index.md

@colifran Colin Francis (colifran) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this Ruan Barroso (@ruanbarroso)!

@colifran
Colin Francis (colifran) merged commit c55573f into langchain-ai:main Jul 17, 2026
9 checks passed
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.

2 participants