Skip to content

ui-sdk: define the content-renderer seam and its light/dark/print conformance suite #2081

Closed

Description

@schlessera

Part of #2079. Decision: docs/decisions/module-renderers.md. Design: docs/plans/module-renderers.md.

Stack A (renderers), layer 1 of 6. Branch feat/2081-content-renderer-seam. Parent: main. Next layer: #2082. Plan: #2079 § Stack plan.

Context

Tool calls have a client seam (export interface ToolRenderer, packages/ui-sdk/src/client/renderers.ts:49-71; export function registerToolRenderers, packages/ui-sdk/src/client/renderers.ts:171). Markdown content has none. Mermaid is hard-wired in brain-markdown-code.tsx:22-31 and file-viewer.tsx:82-89.

The plan's "The seam" section defines the content renderer:

  • a claim on fence languages and file extensions
  • a client component taking { source, path?, mode, theme }
  • a static toStatic(source, { theme, path? }) → Promise<string> with a needsBrowser flag

Scope

  • In @schlessera/brain-ui-sdk/client:
    • the ContentRenderer, ContentRendererPack and ContentRendererRegistry types
    • registerContentRenderers
    • a default registry with lookup by fence language and by file extension
    • pack-identity dedupe, the same as the tool-renderer registry
  • A server-safe @schlessera/brain-ui-sdk/render entry, with no DOM and no React, carrying the StaticRenderer type and a staticRendererFor(language|extension) lookup over registered static entries.
  • The theme contract (plan § The theme contract): theme is light, dark or print, and contentRendererConformance(pack, fixtures) is exported from a testing entry. It renders each fixture in all three themes and asserts:
    • every theme renders
    • the print ground equals the document paper (#ffffff)
    • no colour literal sits outside the token block
    • no alpha fill appears in print
    • static output carries no <script>, no on* attribute and no external URL
  • All marked @experimental.
  • A seam row in docs/extending/README.md, and a docs/extending/content-renderers.md written in the style of the other seam pages.

Out of scope

Acceptance criteria

  • Registering two packs that claim the same fence language resolves deterministically: first registration wins, and a test shows it. A duplicate registration of one pack is a no-op.
  • contentRendererConformance fails a fixture pack that paints a translucent fill in print, and one that emits <script>. Both are shown failing, and a compliant pack passes.
  • @schlessera/brain-ui-sdk/render imports nothing from React or the DOM. A test imports it under Bun with no DOM globals.
  • The public-export checks (docs/decisions/public-export-boundary.md) pass with the new entries, and docs/integration-contract/package-api.md lists them as experimental.
  • A test covering this fails on the tree before the change and passes after.

Verification

bun run test
bun run typecheck
bun run lint
bun run check:pr --base origin/main

Contract impact

  • This touches the integration contract (package-api.md), so it needs the contract label, a CONTRACT: commit prefix and the doc updated in the same commit.
  • This changes a published package's behaviour, so it needs a changeset.

Merge verification — 2026-10-16

The implemented seam and independent review repairs remain in PR #2133. The maintainer explicitly authorized retaining passing tests and merging without full refreshes solely for main advancement, with related failures handled after merge. This supersedes this session's dependency on #2111. Existing 45 Chromium cases, 62 focused tests, mutation receipts and 864-test preflight retain their actual tested identities. The approved decision record #2080 / PR #2102 has now landed. The actual package API documentation conflict was resolved by preserving both the seam entries and stable hosted application roster; product source is unchanged from the recorded passing seam proof.

2026-10-16: added the stack position and parent-based verification (stacked PRs, #1997). The #2137 option A selection/owner-refresh/merger-closure rules now apply; they do not establish candidate qualification for this issue.

2026-10-16 #2137 reconciliation: Under #2137 option A, a blocked upper layer is selectable only after every remaining open blocker is verified as an open, non-draft lower PR in this epic's declared stack with complete passing selected proof for its current parent/head candidate. Verify actual membership and the immediate parent before claiming and again before checkout creation; start from that verified head. Any genuine needs: label, non-stack blocker or unavailable/failed/cancelled/unexpectedly skipped proof rejects selection. Preserve canonical Blocked by lines and blocked for open dependencies; a merged parent uses ordinary reconciliation and fetched main. Each layer owner refreshes their own layer bottom-up after parent changes, with explicit ownership handoff when absent. The stack merger verifies each included issue's delivered identities, acceptance/proof and release milestones and closes only completed issues. Native-stack candidate qualification remains separately subject to #2141.

Activity

  1. added
    type: feat
    area: ui-sdk
    priority: p1
    agent-ready
    contract
    on Oct 16, 2026
  2. added this to the 0.44.0 milestone on Oct 16, 2026
  3. self-assigned this
    on Oct 16, 2026
  4. schlessera commented on Oct 16, 2026

    @schlessera
    OwnerAuthor

    Claiming this task via the work-issue workflow. Claim token: p1-2081-content-seam-1016. Intended branch: feat/2081-content-renderer-seam-1016. I will verify the approved module-renderer ruling, implement the scoped SDK seam and conformance proof, and hand the draft to the coordinating worker for current-candidate CI.

  5. schlessera commented on Oct 16, 2026

    @schlessera
    OwnerAuthor

    Implementation is available in draft PR #2133 at ab5de6ea9a5be38e4eb1ed4013964831de2d373c. Local proof includes 62 focused tests, 14 real Chromium cases using the public testing entry, named first-wins/alpha/script mutation failures with restored passing runs, and committed-head preflight (862 tests, zero failures). Build, types, lint, public export/signature and changeset checks pass. The PR carries the exact receipts and remaining verification.

    The coordinating worker has assumed the existing claim p1-2081-content-seam-1016 for shared-file reconciliation, current-candidate hosted CI, release milestone checks, review and merge. The draft and assignment are retained for that continuation. The approved record in #2102 remains separate and will be integrated before the seam ships; no acceptance criterion is silently deferred to another implementation.

  6. added
    blocked
    on Oct 16, 2026
  7. schlessera commented on Oct 16, 2026

    @schlessera
    OwnerAuthor

    Independent review repairs are pushed to draft PR #2133 at 9a02ad253d7424a845a4f67e5b0c20e3ef766b0a, integrating main 3fc6fea5e22304df2810348074c32b1983fbea46. Public-import Chromium proof first reproduced 22 guard failures. The repaired suite passes all 45 cases, with paint-inventory and compound-colour mutations producing 18 and 8 expected assertion failures respectively, then restored passing runs. Focused proof passes 62 tests; types/API and committed preflight pass (864 tests, zero failures). The PR carries detailed receipts.

    Blocked by #2111
    Blocked by #2080

    The issue body now names the remaining coordination and approved-record prerequisites and exact resumption evidence. PR #2133 remains draft with Refs. Claim p1-2081-content-seam-1016 is released for resumption; agent-ready remains because only declared dependencies block the fully scoped task. No complete hosted qualification or merge is claimed.

  8. schlessera commented on Oct 16, 2026

    @schlessera
    OwnerAuthor

    Resuming PR #2133 integration under the maintainer session instruction to retain passing proof without full refreshes solely for main advancement. Claim token: p1-resume-2081-1016-root. The approved renderer decision record #2080 remains a prerequisite to merge.

  9. removed
    blocked
    on Oct 16, 2026
  10. schlessera commented on Oct 16, 2026

    @schlessera
    OwnerAuthor

    Merged PR #2133 as 7eedcebc58f9062f4489063e0b87bd587a96af45. Issue closure, squash ancestry on main, and release milestone 0.44.0 on both issue and PR are verified. Existing passing test/mutation receipts were retained under the explicit session instruction; actual integration resolutions are recorded in the PR. Automatic main CI remains queued at this readback, so integrated hosted green is not claimed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyarea: ui-sdkcontractpriority: p1type: feat

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions