feat(web): consolidate canonical URN model — component entity + componentUrn#10
Merged
Merged
Conversation
…ponentUrn
Close the BASE/CANONICAL identity task. The closed `Entity` union now covers
all four engine entities and the model exposes both stored and type-level
identity factories.
- `Entity` gains `component` (additive, ThemeName precedent) → `urn:component:{uid}`
- add pure `componentUrn(uid)` factory + tests (`buildUrn` already covered)
- `blockKey` now returns `Urn<string>` (was plain `string`): the COMPUTED
identity keeps its brand while staying a valid React key — no call site
widened to plain string
- BlockRenderer's unknown-component dev warning cites the canonical
`urn:component:…` form (+ test)
- drop the now-redundant canonical-urn plan doc (CLAUDE.md is the living ref)
- wire/CMS contract untouched: a urn is never sent or stored by press-cms
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Closes the BASE / CANONICAL MODEL DATA PATTERN MVP task — consolidates the
web-side canonical identity (URN) model. The closed
Entityunion now covers allfour engine entities, and the model exposes both stored and type-level
identity factories. Interface + factory, no classes — a urn stays a plain string
across the RSC boundary.
DONE criteria
Entity = page | site-setting | plugin | componenturn.tsbuildUrn/componentUrnwith testsurn.test.ts(6 tests)stringblockKeynow returnsUrn<string>packages/cmschangeChanges
Entitygainscomponent(additive — theThemeName"additive, not breaking"precedent) →
urn:component:{uid}.componentUrn(uid)factory (exported from the package root) + tests.blockKeyreturn type tightenedstring→Urn<string>: the COMPUTEDper-instance key keeps its urn brand while staying a valid React
key. Thiscloses the one remaining "widened to string" call site and aligns code with the
docs.
BlockRenderer's unknown-component dev warning now cites the canonicalurn:component:…form (+ regression test).docs/superpowers/plans/2026-07-04-canonical-urn.md—
CLAUDE.md("Canonical identity (URNs)") is the living reference.Three identity classes (each wired to a real consumer)
Canonical<E>):Page(urn:page:{documentId}),ResolvedPressConfig(urn:site-setting:default),PressPlugin(
urn:plugin:{id}).componentUrn):BlockRendererunknown-component warning.blockKey): dynamic-zone React keys —urn:{__component}:{id},never stored.
Not in this PR (deliberately separate)
The working branch also carries two unrelated frontiers kept out of this commit to
keep concerns separate: the engine
plugincontent-type and the cookie-consentfindings. Those ship on their own.
Verification
pnpm --filter @ogs-tech/press-web test→ 213/213 ✅pnpm --filter @ogs-tech/press-web typecheck→ clean ✅🤖 Generated with Claude Code