Skip to content

fix: migrate to comark-content 0.4 single-source API - #36

Merged
atinux merged 4 commits into
mainfrom
fix/comark-content-0.4
Sep 3, 2026
Merged

fix: migrate to comark-content 0.4 single-source API#36
atinux merged 4 commits into
mainfrom
fix/comark-content-0.4

Conversation

@atinux

@atinux atinux commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Written by an AI agent on behalf of @atinux, who has reviewed it.

Why

comark-content 0.4 (comarkdown/comark-content#120) gives each instance exactly one source and a name. sources: { … } is no longer an option.

It is dropped silently rather than rejected, so the layer built an instance with no source at all: /api/content/navigation returned [] and every page 404'd, with no error in the logs. Running the comark-content docs site against the 0.4 branch is what surfaced it.

What changed

Before After
sources: { content: … } source: … (instance name becomes default)
content.list(['content']) content.list()
content.manifest.items (await content.manifest()).items

manifest is now an async producer returning saveable data, not a live property.

Nothing in the layer reads the source name — no meta.source checks, no content/… key literals — so cache namespaces, route shapes and the webhook payloads are unchanged.

The type annotations

ComarkContent's instance name is a type parameter that reaches get()'s argument type, so ComarkContent (name widened to string) is not a supertype of a concrete instance: assigning one fails under strictFunctionTypes. The five annotations now use a local DocsContent = ComarkContent<Record<string, unknown>, 'default'>.

That is a workaround for an upstream ergonomics problem, as far as I can tell — the obvious annotation cannot hold any real instance. Worth raising on the comark-content side; this PR does not depend on the outcome either way.

Dependency

comark-content now points at the 0.4 preview build pkg.pr.new/comark-content@7da031b, since the API this PR targets is not released yet.

Verification

All five CI steps were run locally against that build: lint (0 errors, 4 pre-existing warnings), test (154 passed), dev:prepare, typecheck, build.

test/content-contract.test.ts needed updating — it is the file that pins this surface, and it caught both breaks. It now asserts against source:, await content.manifest(), and the default:index.md cache key.

Beyond CI: the comark-content docs site was served against this branch with the 0.4 build, and every page, navigation, search-sections and /raw/**.md answered with no request errors. The layer's own playground was checked the same way in dev.

The GitHub-source paths (production getProdContent, previews, the revalidate webhook) were not exercised — they need a token and live commits. revalidate.post.ts is a two-line change to the manifest read, but it is the least covered part of this PR.

comark-content 0.4 gives each instance exactly one source and a name.
`sources: { … }` is no longer an option, so it was silently ignored and the
layer built an instance with no source: navigation returned `[]` and every
page 404'd, with no error anywhere.

- `sources: { content: … }` -> `source: …`, so the instance name is `default`
- `content.list(['content'])` -> `content.list()`
- `content.manifest.items` -> `(await content.manifest()).items`, the manifest
  being an async producer rather than a live property
- annotate instances as `DocsContent` (`ComarkContent<…, 'default'>`): the
  instance name is a type parameter reaching `get()`'s argument, so the bare
  `ComarkContent` is not a supertype of a concrete instance
- update the contract test, which pins this exact surface
- point the comark-content dependency at the 0.4 preview build

Nothing reads the source name, so no cache keys or route shapes change.
@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
comark-docs-layer Ready Ready Preview Sep 3, 2026 10:01am UTC

@pkg-pr-new

pkg-pr-new Bot commented Aug 31, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/comarkdown/comark-docs@36

commit: 82b0129

`ComarkContent` is the unnarrowed shape: its instance-name parameter drives the
conditional types behind `get()` and `list()`, so a concrete instance is not
assignable to it and annotating with it widens (or fails).

Deriving from the factory keeps every narrowing comark-content generates, and
drops the type import entirely.
@coldtea-pr-lens

coldtea-pr-lens Bot commented Sep 3, 2026

Copy link
Copy Markdown

◈ PR Lens

🟢 +0 new · 🟠 ~6 changed · 🔴 -0 removed · 1 flow · 8 files · commit 82b0129


Architecture

Architecture diagram for comarkdown/comark-docs at 82b0129

6 components touched across 5 lanes.

Open full size


Data flow

Data flow diagram for comarkdown/comark-docs at 82b0129

Content Revalidation & Manifest Diffing

Open full size


Drill down
Server Routes & APIs — 2 components
🟡 CHANGED Revalidate Webhook

Compares before and head commit manifests via asynchronous manifest() calls to compute diffs and warm the cache.

🟡 CHANGED Raw Markdown Route

Renders raw markdown files using the narrowed DocsContent instance type.

Content Engine — 3 components
🟡 CHANGED comark-content Engine

Configures comarkContent with single-source options and derives the strongly-typed DocsContent instance type.

🟡 CHANGED Preview Registry

Maintains an in-memory LRU cache of preview DocsContent instances keyed by basePath and commit SHA.

🟡 CHANGED Search Indexer

Indexes document headings and content sections using parameterless content.list() and DocsContent.

Cache & Datastores — 1 component
🟡 CHANGED Vercel Runtime Content Cache

Caches parsed document ASTs and manifests under the v3 parser namespace and default: prefix.


View

  • Architecture lens
  • Data flow lens
  • Expand every detail
  • Show unchanged neighbours

Tip

The diagrams follow your GitHub theme, so dark mode gets the dark render and light mode the light one, and the moving dots show this pull request's data in motion.

🪧 More tips
  • Run PR Lens on your own machine: npx skills add coldteadotai/pr-lens installs the agent skill. Then tell your coding agent: "Diagram the change you just made with PR Lens and attach it to the pull request."
  • Draw a diff before it is even a pull request: npx @coldtea/pr-lens-cli analyze --base origin/main reads the diff with your own model key, and npx @coldtea/pr-lens-cli render .pr-lens/graph.json draws the same lenses on your machine.
  • The boxes under View are live. Tick Architecture lens or Data flow lens to choose which diagrams appear, or Expand every detail to open every drill-down at once. The comment redraws in place a few seconds later.
  • Show unchanged neighbours lists the components this change did not touch alongside the ones it did, so the drill-down shows what the changed code sits next to.
  • GitHub will not let you zoom an image in a comment. The link under each diagram opens it full size on a page of its own, where you can.
  • The CLI's render picks up .github/pr-lens.yml automatically and applies your corrections (renames, exclusions, lane pins) at draw time.
  • Would you rather run it from CI on a key of your own? Add .github/workflows/pr-lens.yml with coldteadotai/pr-lens/packages/action@v0 and a model key in your repository secrets, say GEMINI_API_KEY. The Action asks Gemini by default, or OpenAI and any endpoint speaking /chat/completions through its provider input.
  • PR Lens is free for open source. A star on the repository is what keeps it going.
  • Push a new commit and the whole comment re-renders for the new head. An older run never overwrites a newer one, so a slow render cannot put a stale diagram back.

◈ Rendered by PR Lens · crafted with ❤️ by the Coldtea team · Something drawn wrong?

@atinux
atinux merged commit a13042a into main Sep 3, 2026
6 checks passed
@atinux
atinux deleted the fix/comark-content-0.4 branch September 3, 2026 10:30
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