Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

spec: API reports cover declarations, custom properties, theme targets and public attributes; undeclared rows go to a human (#9199)

Cindy Zhangc39a5b1604c2
diff --git a/docs/architecture/interaction-modality.md b/docs/architecture/interaction-modality.md
index a0cd3ffc85..47d021b3cf 100644
--- a/docs/architecture/interaction-modality.md
+++ b/docs/architecture/interaction-modality.md
@@ -233,7 +233,9 @@ control sizing, sticky behavior, caller-owned layout, and new visual representat
remain with their direct current owner unless evidence proves that exact mechanism is
necessary to restore the invariant and representative unaffected paths remain
unchanged. A separable delta is removed or split before this interaction restoration
-is asked to carry a new decision.
+is asked to carry a new decision, except an undeclared public API row, which goes
+to human review for an owner's decision rather than being removed or split by
+review (`architecture:knowledge-contracts` change coupling step 6).
## Change coupling
diff --git a/docs/architecture/knowledge-contracts.md b/docs/architecture/knowledge-contracts.md
index f327e793a9..a4e7768ed2 100644
--- a/docs/architecture/knowledge-contracts.md
+++ b/docs/architecture/knowledge-contracts.md
@@ -204,7 +204,9 @@ Every record is either:
separable delta that violates current authority or requires a new human decision
is removed or split before review asks the primary change to carry new authority.
A specification is the path for an intentional durable decision, not the default
- remedy for unrelated scope discovered during review.
+ remedy for unrelated scope discovered during review. An added or changed public
+ API row that no current record decides is the exception: it goes to human
+ review for an owner's decision instead (change coupling step 6).
- **INV16 — Specs govern; generated review context only informs.** Committed current
component, module, family, design, theme, architecture, and system records own
intended product behavior. Reviewer-generated summaries, sections, checklists,
@@ -553,7 +555,12 @@ Before any component, module, family, design, theme, or architecture record beco
Review may request that contraction without deciding the tagalong's semantics,
then continue reviewing the remaining change. A `novel-human` delta enters a
private human hold only when it is the primary intent, is inseparable from it,
- or the author or owner explicitly chooses to pursue it.
+ or the author or owner explicitly chooses to pursue it. An added or changed
+ row of a pull request's public API changes
+ (`architecture:public-component-api` INV24) that is `novel-human` instead
+ sends the pull request to human review with that row listed, whether or not
+ it is separable; an owner of that record accepts, splits, or removes it, and
+ review never requests changes for that row alone.
7. A bug fix is `preserves` only when it restores existing current authority
without changing public API or public behavior beyond that contract. Any
separable API, visual, layout, or interaction tagalong follows step 5 or 6
@@ -584,8 +591,11 @@ Review and build should converge on the smallest ideal change that can land:
specification unless changing policy is itself an intentional, separately
reviewable goal.
4. For an unsettled but separable delta, remove or split it. Continue the primary
- change without asking the contributor to solve adjacent system design.
-5. Escalate only a surviving, intentional `novel-human` delta. Record only the
+ change without asking the contributor to solve adjacent system design. An
+ undeclared public API row is the exception: it goes to human review for an
+ owner to accept, split, or remove (change coupling step 6).
+5. Escalate only a surviving, intentional `novel-human` delta or an undeclared
+ public API row. Record only the
exact decision needed for that delta; adjacent module behavior may stay
uncontracted.
@@ -600,7 +610,9 @@ contraction. It does not merely report that authority is missing.
specification.
2. A reviewer or agent applies the contraction path above. Only a surviving,
intentional `novel-human` question proceeds; the contributor does not invent
- the answer or specify unrelated adjacent behavior.
+ the answer or specify unrelated adjacent behavior. An undeclared public API
+ row also proceeds, as change coupling step 6 describes, rather than being
+ removed or split by review.
3. An authorized owner answers in the pull-request review.
4. A maintainer or agent records that ruling in the canonical owning record.
- Prefer a commit in the same pull request when maintainers can update the
@@ -803,7 +815,7 @@ authority.
When an otherwise reviewable change carries a separable contradiction or unsettled
decision, remove or split that delta and keep the primary intent moving. Recommend
a specification only when the surviving delta is intentionally pursued as durable
-behavior, not because review discovered adjacent incompleteness.
+behavior, not because review discovered adjacent incompleteness. An undeclared public API row is the exception: change coupling step 6 sends it to human review for an owner's decision, and review does not remove or split it.
Rejected: turning every uncontracted tagalong into a specification project, because
that makes a narrow repair absorb unrelated design work and leaves the contributor
diff --git a/docs/architecture/public-component-api.md b/docs/architecture/public-component-api.md
index 584b8fc2b1..916e0c6a33 100644
--- a/docs/architecture/public-component-api.md
+++ b/docs/architecture/public-component-api.md
@@ -59,7 +59,9 @@ deciding_specs:
"INV8",
"INV9",
"INV12",
- "INV16"
+ "INV16",
+ "INV24",
+ "INV25"
]
}
}
@@ -247,6 +249,27 @@ guidance owns the process used to propose and test APIs.
among them Theme, MediaTheme, `reset.css`, `generateThemeRules.ts`, the CLI
theme build, AspectRatio, the Chat composer, the press and menu-press hooks,
and the edge-compensation styles, and the lint rule allows their names.
+- **INV24 — Each published package's public surface has a generated API
+ report.** `pnpm api:report` generates one committed report per published
+ package from its built declarations and stylesheet, with a section for each
+ entry point. A report lists exports, component props with their types, hook
+ signatures, supporting types, public CSS custom properties and theme targets,
+ and the public `data-astryx-*` attributes INV23 names. A reachable member tagged internal
+ appears (INV12); Core's `./internal/*` subpaths and unpublished packages,
+ including Lab, do not. A member inside a canonical experimental boundary
+ appears marked experimental (`spec:AST-017` FR21). The pull-request report
+ lists the API changes between the merge base's report and one generated from
+ the head's build: added, changed, and removed rows, each with its signature
+ and a usage example, and flags a committed report that differs from the head's
+ build as stale. The report and its changes are evidence: they fail no check
+ and decide no acceptance (INV13).
+- **INV25 — Undeclared public API goes to a human.** Review compares each added
+ or changed row of a pull request's API changes with current records. A row
+ that a record current at the merge base, or a record change in the same pull
+ request, decides needs no further step. A row that no current record decides,
+ including a reachable member tagged internal, goes to human review with that
+ row listed, for an owner of this record, as `architecture:knowledge-contracts`
+ change coupling step 6 describes. A removed or renamed row follows INV9.
This record applies to stable public packages, and INV23 also applies to Lab
source. Lab components are not stable public promises until promotion.
@@ -258,9 +281,12 @@ source. Lab components are not stable public promises until promotion.
intentional observable contract triggers public-API review. A top-level export
need not change for a reachable supporting contract to change.
- Each review compares declarations and reachable exports from merge-base to head
- and from current main to the synthetic merge. The generated surface manifest
- inventories evidence and maps each row to its canonical component, family,
- architecture, or system owner; it does not decide acceptance.
+ and from current main to the synthetic merge. The API changes from the
+ generated reports (INV24) inventory that evidence and map each row to its
+ canonical component, family, architecture, or system owner; they do not decide
+ acceptance.
+- A pull request that changes a published package's public surface regenerates
+ its API reports with `pnpm api:report`; a stale report is flagged, not failed.
- After the generated surface inventory identifies the exact API and behavior
delta and its canonical owner, route it under
`architecture:knowledge-contracts`. This record does not redefine review results
@@ -339,6 +365,8 @@ copy the component matrix.
| INV21 | Public-API review against existing props, components, hooks, and factories | A new API that shares a job with an existing one that is not being deprecated in its favor |
| INV22 | Public-API review of each public gesture, press, drag, or motion hook against its `create…` factory | A public interaction hook with no public factory taking the same options and returning `destroy()`, outside the listed exemptions |
| INV23 | `@astryx/no-raw-private-attribute` lint with its baseline (test files exempt), plus public-API review of the public list | A `data-astryx-*` name or selector written outside its owner module, a test, or the public list; a `dataAttr()` call that names a private attribute; an owner module that exports its raw name or a selector; a package that imports another package's owner module; a caller that sets a property an owner style it spreads also sets; a private attribute in a public export, `.doc.mjs`, or Changeset; a baseline entry added; a public data attribute changed without INV9 evidence |
+| INV24 | API report generator tests over representative entry points, plus the pull-request report's API changes | A promised export, prop, hook, type, custom property, theme target, or public attribute is missing from a report; a reachable internal-tagged member is missing; an `./internal/*` or Lab member appears; a stale committed report is not flagged; the check fails a pull request |
+| INV25 | Public-API review routing against the pull request's API changes | A row that no current record decides does not reach human review; a row a current record decides is held for a human; an undeclared row alone draws a request for changes |
| Consumer-doc projection | `docPropReferences.test.ts` and `docPropLiterals.test.ts` | Docs name a nonexistent prop or omit public literal choices |
Known verification gaps:
@@ -354,10 +382,11 @@ Known verification gaps:
- The passthrough lint is warning-only while known violations remain.
- The current source-to-doc completeness matcher still looks for old prefixed
props interfaces, so it does not yet prove full prop coverage.
-- No checked-in generated manifest currently proves the complete reachable public
- delta across supporting types, context members, hook returns, utility signatures,
- defaults, CLI schemas, and observable behavior for both the branch and synthetic
- merge. Reviews must build that inventory explicitly until enforcement exists.
+- INV24: `pnpm api:report` and the committed reports do not exist yet, so
+ reviews build the reachable public inventory explicitly. The reports cover
+ declarations, CSS custom properties, theme targets, and public attributes;
+ context-member behavior, undeclared defaults, CLI schemas, and observable
+ behavior for both the branch and synthetic merge still need explicit review.
- INV18: shipped content slots that their anatomy does not name yet include
PowerSearch's `startIcon` and `endContent`, SideNav's `topContent`,
`footer`, and `footerIcons`, Tokenizer's `startIcon`, DropdownMenu's
diff --git a/docs/contributing/pull-requests.md b/docs/contributing/pull-requests.md
index 7055a23344..ae304bc09a 100644
--- a/docs/contributing/pull-requests.md
+++ b/docs/contributing/pull-requests.md
@@ -71,7 +71,7 @@ Review should produce the smallest ideal change that can land:
1. Apply current component, module, family, design, theme, architecture, and system authority to each delta.
2. If a delta violates current authority, conform or remove it. Do not propose changing the specification merely to rescue the implementation.
-3. If a delta is unsettled but separable, remove or split it and keep reviewing the primary intent.
+3. If a delta is unsettled but separable, remove or split it and keep reviewing the primary intent, except an undeclared public API row, which goes to human review for an owner's decision rather than being removed or split (`architecture:knowledge-contracts` change coupling step 6).
4. Propose a specification only for a surviving, intentional durable decision the team wants to pursue.
A current record governs only its explicit claims inside its ownership boundary. It does not imply that the whole named component or module is fully specified.
diff --git a/docs/specs/AST-002/spec.md b/docs/specs/AST-002/spec.md
index 3ffd21ba71..e4caeca100 100644
--- a/docs/specs/AST-002/spec.md
+++ b/docs/specs/AST-002/spec.md
@@ -172,11 +172,14 @@ A public API proposal is admitted only when it passes both gates:
behavior without changing public API or behavior beyond current authority MUST do
so. Any additional public delta follows `architecture:knowledge-contracts`
independently. A separable contradictory or unsettled tagalong MUST be removed or
- split before review asks the repair to carry a new owner decision. Existing current
- authority may settle an intentional remaining delta; only a surviving, intentional
- gap requires owner judgment. Implementation convenience, removal of an internal
- wrapper, or exposure of existing internal fields is not evidence that an API should
- exist.
+ split before review asks the repair to carry a new owner decision, except an
+ undeclared public API row, which goes to human review for an owner's decision
+ rather than being removed or split by review (`architecture:knowledge-contracts`
+ change coupling step 6). Existing current authority may settle an intentional
+ remaining delta; only a surviving, intentional gap, or an undeclared public API
+ row, requires owner judgment. Implementation convenience, removal of an internal
+ wrapper, or exposure of existing internal fields is not evidence that an API
+ should exist.
- **FR20 — Callsite impact and decision burden are explicit.** A public API change
shows representative before and after callsites, including defaults and
compatibility, and names every new choice the caller must understand or make. That
@@ -432,7 +435,10 @@ its API and behavior within that contract. Any additional public primitive or
observable behavior follows `architecture:knowledge-contracts`: first conform,
remove, or split a separable contradiction or unsettled tagalong; then reuse an
existing current decision when one settles an intentional surviving delta. Ask the
-owner only for a surviving decision the team actually wants to pursue.
+owner only for a surviving decision the team actually wants to pursue. An
+undeclared public API row is the exception: change coupling step 6 of
+`architecture:knowledge-contracts` sends it to human review for an owner's
+decision, and review does not remove or split it.
Rejected: promoting internal focus targets, gesture memory, DOM slots, timers, or
other existing fields merely because removing an internal wrapper or fixing one