Skip to content

docs(spec): align adaptation component validation with root themes - #6139

Merged
imdreamrunner merged 2 commits into
mainfrom
feat/theme-adaptation-validation-spec
Sep 8, 2026
Merged

imdreamrunner merged 2 commits into
mainfrom
feat/theme-adaptation-validation-spec

Conversation

@imdreamrunner

@imdreamrunner imdreamrunner commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • require adaptation component writes to use the same target, axis, value-domain, and extension validation as root components
  • explicitly allow built-in values and values accepted by authoritative open primitive domains to appear only in an adaptation rule, without a matching root style declaration
  • reserve effective-root presence for custom values whose validity comes from theme enrollment
  • carry unresolved shared-validation results into adaptations unchanged, so future root-validator improvements tighten adaptations automatically rather than leaving a permanent exception
  • record the owner decision as AST-012 DEC-5 and align the component-theming architecture invariant

Responsibility boundary

Adaptations own conditions, ordering, cascade, and the additional no-conditional-enrollment rule. They do not own a separate visual-prop resolver, allowlist, or inference path.

The effective root is not a registry of every valid component value. A root entry is required only when it is the enrollment evidence that makes a custom value valid. Independently valid built-ins and open primitive values need no dummy root CSS.

Why this is separate

This isolates the validation contract from the implementation in #5543. Shared root/adaptation value-domain improvements may land independently; adaptation behavior remains monotonic because it always consumes the shared root result.

Relevant discussion:

Test plan

  • pnpm check:knowledge
  • commit hooks: sync, knowledge, package-boundary, changeset, CLI-structure, portable-script, i18n, fixture, and setup-contract checks
  • verified the branch changes only docs/specs/AST-012/spec.md and docs/architecture/component-theming-surface.md

Stack

Predecessor to #5543. No implementation changes are included here.

… domains

AST-012's FR4/IR3 said a rule may style an existing component visual-prop
value but MUST NOT introduce a new one, and read as an unconditional
fail-closed rule. Build tooling cannot honor that unconditionally: it
enumerates a prop's domain from the component docs, and some public prop
types are opaque aliases rather than literal unions, so their finite
domain is not resolvable. Stated as written, the contract promised
enforcement that no validator can deliver, and the honest alternative —
rejecting every value on an unenumerable axis — would fail correct themes.

The contract now says what is actually enforceable, in both directions:

- When tooling CAN resolve a prop's finite built-in domain, it MUST reject
  a rule-only value that is neither built in nor present on the effective
  root component surface. Resolvable domains stay fail-closed.
- When the domain is an opaque alias the validator cannot enumerate, the
  rule MAY retain the same pass-through behavior root-theme validation
  already has. That is a named validation limitation, NOT an extension
  point: accepting such a value does not make the axis extensible, and the
  conditional-API invariant still governs it.

`component-theming-surface` mirrors the same boundary, because it owns
INV15 (conditional styling does not create conditional API) and the
verification row that evidences it, and records the alias-backed gap under
its known conformance and verification gaps.

Spec-only: no runtime, tooling, or release changes. The implementation
that satisfies this contract follows in its own change.

@imdreamrunner
@vercel

vercel Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Sep 8, 2026 6:51pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 7, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Sep 7, 2026
github-actions Bot added a commit that referenced this pull request Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes an accepted release contract rather than documenting implementation detail. AST-012 currently says adaptation rules are not an enrollment surface for component values; allowing opaque alias-backed values to pass through lets a closed axis emit unreachable CSS with no diagnostic or type augmentation. That is the exact failure the current #5543 review blocks.

Please do not weaken the accepted contract to fit the current validator. Either resolve alias-backed finite domains in shared root/adaptation validation (the intended role of #6061), or defer the adaptations API until that can be done safely. If the owner wants the pass-through limitation instead, that needs an explicit new owner decision before this spec can become current.

@imdreamrunner
imdreamrunner marked this pull request as ready for review September 8, 2026 01:02
@github-actions
github-actions Bot requested a review from cixzhang September 8, 2026 01:03
@imdreamrunner imdreamrunner changed the title docs(spec): scope adaptation value validation to resolvable domains docs(spec): align adaptation component validation with root themes Sep 8, 2026
github-actions Bot added a commit that referenced this pull request Sep 8, 2026

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. This now makes adaptation component writes reuse root component validation and keeps enrollment and future tightening owned by the root contract; adaptations add no parallel policy.

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Sep 8, 2026
@imdreamrunner
imdreamrunner merged commit e6229f1 into main Sep 8, 2026
30 checks passed
@github-actions
github-actions Bot deleted the feat/theme-adaptation-validation-spec branch September 9, 2026 06:23

This branch was successfully deployed

1 active deployment
Preview — ca600912 Deployed Sep 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants