Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 2.33 KB

File metadata and controls

34 lines (24 loc) · 2.33 KB

Implementation log — issue-377 artifact-reader (Codex P1/P2 fix)

Entry 1 — Codex P1/P2: add readArtifactSafe; fix diagnostic callers

Commit: 2b167db Date: 2026-05-14 Spec reference: Codex P1/P2 findings on PR-515; root cause: readArtifactOrNull throws ZodError inside diagnostic collectors.

Files changed

File Lines affected Change
scripts/lib/artifact-reader.ts 62–75 (new function) Add readArtifactSafe<T> that catches ZodError and returns null
scripts/lib/agent-artifacts.ts 5, 49, 74 Replace readArtifactOrNull import and calls with readArtifactSafe at both diagnostic call sites
scripts/lib/release-package-contract.ts 5, 217 Replace readArtifactOrNull import and call with readArtifactSafe in checkDocsAreStubs
scripts/lib/quality-metrics.ts 4, 637, 724 Replace readArtifactOrNull import and calls with readArtifactSafe in readWorkflowMetric and safeExtractFrontmatter
scripts/lib/release-stubify.ts 86–87 Replace StubifyFrontmatterSchema.parse() with safeParse(); use {} typed fallback on failure
scripts/sync-backlog.ts 305–309 Treat empty frontmatterRaw as corruption with console.error rather than silently skipping
scripts/lib/roadmaps.ts 5, 209–214, 235–239, 432–436 Replace import; simplify two try/catch blocks and one try/catch in validateRoadmapStateFile to readArtifactSafe calls
scripts/check-token-budget.ts 4, 48–52 Replace try/catch wrapping readArtifactOrNull with readArtifactSafe
docs/scripts/lib/artifact-reader/README.md full regen Regenerated by npm run fix:script-docs to include readArtifactSafe
docs/scripts/lib/artifact-reader/functions/readArtifactSafe.md new file Generated API doc for new export

Outcome

done

Deviation from spec

None. The validateRoadmapStateFile ZodError path previously emitted "frontmatter has invalid field types"; after the change it emits "is missing YAML frontmatter" (the !artifact branch). The behavior difference is acceptable: both surface a diagnostic; the message difference is minor and the schema (RoadmapStateFrontmatterSchema) uses all-optional fields making ZodError effectively unreachable in practice.

Verify result

npm run verify — ok in 145.5s. 537 tests passed, 63 test files.