Skip to content

Share one manifest contract between Standard.site writer and reader#189

Merged
lukebennett88 merged 1 commit into
mainfrom
refactor/standard-site-manifest-contract
Jun 15, 2026
Merged

Share one manifest contract between Standard.site writer and reader#189
lukebennett88 merged 1 commit into
mainfrom
refactor/standard-site-manifest-contract

Conversation

@lukebennett88

Copy link
Copy Markdown
Owner

Problem

The generated manifest (src/generated/standard-site.json) had its shape and the publication URI declared independently in two places: the writer (scripts/sync-standard-site.ts, with its own PUBLICATION_URI constant and hand-built JSON) and the reader (src/lib/standard-site.ts, with the Zod schema). Nothing proved the writer emitted a shape the reader would accept — skew would only surface at runtime, in production.

Solution

src/lib/standard-site.ts becomes the single contract module. It now exports StandardSiteManifestSchema, the StandardSiteManifest type, and serializeStandardSiteManifest(documentsBySlug), which validates through the schema before producing the JSON. The writer imports standardSitePublicationUri and the serializer, dropping its duplicate constant and inline JSON construction. The publication URI is now declared once.

Serializer output is byte-identical to the previous inline writer (same sort order, 2-space indent, trailing newline), so standard-site.json will not churn. The file-path resolution on each side is left as-is.

Verification

  • pnpm --filter @lukebennett/web test:standard-site — 21 tests pass (added serializer round-trip + formatting tests; existing buildDocumentRecord site assertion unchanged).
  • pnpm --filter @lukebennett/web check — clean.

Part of an architecture review pass; sibling PRs cover the AT Protocol module, Cloud Image preview, and renderer registry.

Export StandardSiteManifestSchema, the StandardSiteManifest type, and a
new serializeStandardSiteManifest from src/lib/standard-site.ts so the
sync script serialises through the same schema it validates on read. The
script drops its duplicate PUBLICATION_URI constant and inline manifest
builder in favour of standardSitePublicationUri and the shared serializer.
@netlify

netlify Bot commented Jun 15, 2026

Copy link
Copy Markdown

Deploy Preview for lukebennett ready!

Name Link
🔨 Latest commit 048cba3
🔍 Latest deploy log https://app.netlify.com/projects/lukebennett/deploys/6a2fa2cc28ceeb0008419e5e
😎 Deploy Preview https://deploy-preview-189--lukebennett.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@lukebennett88 lukebennett88 merged commit 2660465 into main Jun 15, 2026
5 checks passed
@lukebennett88 lukebennett88 deleted the refactor/standard-site-manifest-contract branch June 15, 2026 07:04
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.

1 participant