Skip to content

fix: tolerate optional OKF index metadata#376

Merged
Colin Francis (colifran) merged 3 commits into
langchain-ai:mainfrom
Eijnewgnaw:agent/tolerate-okf-optional-metadata
Jul 17, 2026
Merged

fix: tolerate optional OKF index metadata#376
Colin Francis (colifran) merged 3 commits into
langchain-ai:mainfrom
Eijnewgnaw:agent/tolerate-okf-optional-metadata

Conversation

@Eijnewgnaw

Copy link
Copy Markdown
Contributor

Summary

  • tolerate non-string or blank optional title and description values while generating directory indexes
  • fall back to the filename for an unusable title and omit an unusable description
  • add regression coverage for scalar, list, and mapping metadata values

Why

OKF v0.1 requires a parseable frontmatter block and non-empty type; optional display metadata should not prevent a consumer from indexing the rest of a bundle. Index generation now uses only optional values that can be rendered safely.

Validation

  • pnpm exec prettier --check src/agent/index-middleware.ts test/index-middleware.test.ts
  • pnpm exec vitest run test/index-middleware.test.ts
  • pnpm run typecheck

Related to #84.

Treat non-string or blank optional title and description metadata as unavailable when rendering indexes, falling back to the filename and omitting the description.
Verify index rendering falls back when optional OKF title and description values cannot be displayed as non-empty strings.
@Eijnewgnaw
WangWenJie (Eijnewgnaw) marked this pull request as ready for review July 17, 2026 06:32
if (title !== undefined && typeof title !== "string") {
throw new Error(`${filePath} YAML title must be a string.`);
}
const usableDescription = usableString(description);

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 - i like this. makes sense to not fail here.

@colifran
Colin Francis (colifran) merged commit b1f24bc 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