Skip to content

Phase 2 (#63): consume summary.readme.content from schema 1.1 - #68

Merged
neuromechanist merged 2 commits into
feature/issue-66-epic-cold-paintfrom
feature/issue-63-readme-inline-from-summary
May 26, 2026
Merged

neuromechanist merged 2 commits into
feature/issue-66-epic-cold-paintfrom
feature/issue-63-readme-inline-from-summary

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

Wires the website to consume the inline README content that nemar-cli#616 will start emitting under schema 1.1 of summary.json. The current cold-paint path on /api/dataset/<id>/readme always pays a synchronous raw.githubusercontent.com RTT for the actual README body, even when summary.json already resolved the path. After this PR, when summary.readme.content is present and truncated !== true, the route returns immediately from the inline markdown.

The change is intentionally back-compat with schema 1.0 docs: every new field is optional, the new helper returns null when content is absent, and Steps 1–4 of the existing resolver are untouched. Means the website can deploy this PR independently of the CLI side; the fast path lights up automatically as nemar-cli#616's backfill rolls out.

Reuses kind = "manifest" for the inline branch — the renderer's "manifest" branch already produces banner-less output, which is the correct affordance for content the dataset itself owns. No new ReadmeSourceKind value needed.

Closes #63
Part of epic #66

Test plan

  • bun run typecheck — 0 errors
  • bun run lint — clean
  • bun run test — 375/375 (was 370; 5 new tests for findReadmeContentInSummary covering schema 1.0, 1.1, truncated:true, empty-string content, and missing readme object)
  • Post-deploy (current state, schema 1.0 datasets): /api/dataset/on005505/readme?v=1.0.0 still resolves via Step 1 GitHub fast path (unchanged behavior)
  • Post-deploy after nemar-cli#616 backfills: same endpoint serves in < 200 ms cold isolate (Step 0.5 short-circuit; zero outbound fetches)

Notes

  • Files touched: src/lib/data-api.ts (additive type + helper), src/pages/api/dataset/[id]/readme.ts (Step 0.5 + resolution-order comment), src/lib/data-api.test.ts (5 new tests).
  • No changes to render-readme.ts, markdown.ts, or any other endpoint.
  • Page-bundle endpoint consumer (nemar-cli#617) is intentionally out of scope; that's a follow-up website issue.

Extends SummaryReadme with the schema 1.1 fields nemar-cli#616 will
emit (content, content_bytes, sha256, truncated; all optional) and
inserts a Step 0.5 in /api/dataset/<id>/readme that returns the
inlined markdown directly. Eliminates the synchronous GitHub raw
fetch on the cold-paint path once the upstream backfill completes.
Back-compat: schema 1.0 docs miss the new branch and fall through
to the unchanged Step 1-4 resolver.

Closes #63
Part of epic #66
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 26, 2026 •

Copy link
Copy Markdown

Four findings from the parallel sonnet review pass:

- pr-test-analyzer: whitespace-only inline content would slip past
  the length-check, render to empty HTML, and get cached with
  PUBLISHED_CACHE for the full SWR window. Switch the guard to
  trim().length === 0; add tests for the whitespace case and for
  preserving leading whitespace inside otherwise-valid markdown.

- type-design-analyzer: declared `content?: string` but the docstring
  said the generator emits `content: null` on truncation. Align the
  type to `string | null`. Add a test for the explicit-null case.

- comment-analyzer: clarify "leaves content null" in the interface
  comment now that the type matches; note that nemar-cli#616 is
  still open so the 256 KB cap is proposed, not enforced.

- comment-analyzer: soften the Step 0.5 "abstraction surface tight"
  rationale and add a forward pointer for the case where a future
  ReadmeSourceKind needs to distinguish inline vs presigned at
  render time.

378/378 tests pass (was 375 before this commit).
@neuromechanist
neuromechanist merged commit 1bde6d8 into feature/issue-66-epic-cold-paint May 26, 2026
1 check passed
@neuromechanist
neuromechanist deleted the feature/issue-63-readme-inline-from-summary branch June 21, 2026 22:50
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