@reqvire-org/ads 0.3.24 → 0.3.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/dist/behaviors.mjs +6 -4
- package/dist/bootstrap-ds/ADS.md +28 -30
- package/dist/bootstrap-ds/README.md +6 -6
- package/dist/bootstrap-ds/design-system/assets/brand/README.md +3 -2
- package/dist/boundaries.mjs +0 -3
- package/dist/check.mjs +15 -22
- package/dist/config.mjs +3 -7
- package/dist/contract-migration.mjs +3 -3
- package/dist/contracts.d.mts +2 -3
- package/dist/declarative-flow.mjs +144 -0
- package/dist/design-values.mjs +81 -0
- package/dist/evidence.mjs +1 -1
- package/dist/mcp/catalog.mjs +4 -2
- package/dist/mcp/context.mjs +3 -3
- package/dist/mcp/prompts.mjs +4 -4
- package/dist/mcp/reports.mjs +101 -0
- package/dist/mcp/server.mjs +38 -3
- package/dist/paint-contracts.mjs +4 -5
- package/dist/preview-resources.mjs +1 -2
- package/dist/runtime-contracts.mjs +26 -37
- package/dist/scenario-trace.mjs +47 -18
- package/dist/scenarios.mjs +15 -15
- package/dist/skills/README.md +7 -3
- package/dist/skills/ads-break-ui/SKILL.md +24 -13
- package/dist/skills/ads-break-ui/references/atomic-styles.md +9 -2
- package/dist/skills/ads-break-ui/references/behaviors.md +393 -0
- package/dist/skills/ads-break-ui/references/captures.md +1 -1
- package/dist/skills/ads-break-ui/references/contracts.md +61 -40
- package/dist/skills/ads-break-ui/references/design-data.md +91 -0
- package/dist/skills/ads-break-ui/references/evidence.md +4 -0
- package/dist/skills/ads-break-ui/references/guarded-editing.md +7 -11
- package/dist/skills/ads-break-ui/references/reporting.md +101 -0
- package/dist/skills/ads-break-ui/references/scenarios.md +9 -15
- package/dist/skills/ads-designer/SKILL.md +26 -15
- package/dist/skills/ads-designer/assets/bootstrap-ds/ADS.md +28 -30
- package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +6 -6
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/README.md +3 -2
- package/dist/skills/ads-designer/references/atomic-styles.md +9 -2
- package/dist/skills/ads-designer/references/behaviors.md +393 -0
- package/dist/skills/ads-designer/references/captures.md +1 -1
- package/dist/skills/ads-designer/references/contracts.md +61 -40
- package/dist/skills/ads-designer/references/design-craft.md +1 -1
- package/dist/skills/ads-designer/references/design-data.md +91 -0
- package/dist/skills/ads-designer/references/evidence.md +4 -0
- package/dist/skills/ads-designer/references/guarded-editing.md +7 -11
- package/dist/skills/ads-designer/references/mobile.md +1 -1
- package/dist/skills/ads-designer/references/reporting.md +101 -0
- package/dist/skills/ads-designer/references/scenarios.md +9 -15
- package/dist/skills/ads-import/SKILL.md +29 -17
- package/dist/skills/ads-import/references/atomic-styles.md +9 -2
- package/dist/skills/ads-import/references/behaviors.md +393 -0
- package/dist/skills/ads-import/references/branding.md +1 -1
- package/dist/skills/ads-import/references/captures.md +1 -1
- package/dist/skills/ads-import/references/contracts.md +61 -40
- package/dist/skills/ads-import/references/design-data.md +91 -0
- package/dist/skills/ads-import/references/evidence.md +4 -0
- package/dist/skills/ads-import/references/guarded-editing.md +7 -11
- package/dist/skills/ads-import/references/implementation.md +3 -2
- package/dist/skills/ads-import/references/reporting.md +101 -0
- package/dist/skills/ads-import/references/scenarios.md +9 -15
- package/dist/skills/ads-import/references/tokens.md +11 -9
- package/dist/skills/ads-motion/SKILL.md +23 -12
- package/dist/skills/ads-motion/references/atomic-styles.md +9 -2
- package/dist/skills/ads-motion/references/behaviors.md +393 -0
- package/dist/skills/ads-motion/references/captures.md +1 -1
- package/dist/skills/ads-motion/references/contracts.md +61 -40
- package/dist/skills/ads-motion/references/design-data.md +91 -0
- package/dist/skills/ads-motion/references/evidence.md +4 -0
- package/dist/skills/ads-motion/references/guarded-editing.md +7 -11
- package/dist/skills/ads-motion/references/reporting.md +101 -0
- package/dist/skills/ads-motion/references/scenarios.md +9 -15
- package/dist/skills/{ads-migrate → ads-port}/SKILL.md +59 -31
- package/dist/skills/ads-port/agents/openai.yaml +4 -0
- package/dist/skills/{ads-migrate → ads-port}/references/atomic-styles.md +9 -2
- package/dist/skills/ads-port/references/behaviors.md +393 -0
- package/dist/skills/{ads-migrate → ads-port}/references/captures.md +1 -1
- package/dist/skills/{ads-migrate → ads-port}/references/contracts.md +61 -40
- package/dist/skills/ads-port/references/design-data.md +91 -0
- package/dist/skills/{ads-migrate → ads-port}/references/evidence.md +4 -0
- package/dist/skills/{ads-migrate → ads-port}/references/guarded-editing.md +7 -11
- package/dist/skills/{ads-migrate → ads-port}/references/lint-and-docs.md +5 -0
- package/dist/skills/{ads-migrate → ads-port}/references/native-implementation.md +49 -15
- package/dist/skills/ads-port/references/reporting.md +101 -0
- package/dist/skills/{ads-migrate → ads-port}/references/scenarios.md +9 -15
- package/dist/skills/{ads-migrate → ads-port}/references/testing.md +11 -1
- package/dist/source-values.mjs +3 -3
- package/dist/tokens.mjs +5 -8
- package/dist/unit-contracts.mjs +24 -12
- package/docs/ADS.md +42 -73
- package/docs/ARCHITECTURE.md +54 -20
- package/docs/BEHAVIORS.md +46 -36
- package/docs/CHANGELOG.md +34 -0
- package/docs/CONTRACTS.md +67 -39
- package/docs/GUIDE.md +21 -13
- package/docs/MCP.md +67 -11
- package/package.json +1 -1
- package/dist/scoped-tokens.mjs +0 -68
- package/dist/skills/ads-migrate/agents/openai.yaml +0 -4
- /package/dist/skills/{ads-migrate → ads-port}/references/cli.md +0 -0
- /package/dist/skills/{ads-migrate → ads-port}/references/layers.md +0 -0
- /package/dist/skills/{ads-migrate → ads-port}/references/review.md +0 -0
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
# Controllers and behavioral verification
|
|
2
|
+
|
|
3
|
+
Controllers own reusable UI behavior: state, subscriptions, DOM measurements and
|
|
4
|
+
lifecycle coordination. A controller may be a class, function, hook, state
|
|
5
|
+
machine or context provider. Linaria and tokens own its consumers' visual design.
|
|
6
|
+
|
|
7
|
+
Private controllers stay inside their component/pattern mutation unit. Shared
|
|
8
|
+
controllers use `design-system/controllers/<Name>/` with an `index` entry or a
|
|
9
|
+
runtime file matching the directory name. The unit ID is `controllers/<Name>`.
|
|
10
|
+
Its implementation, tests and guides can change together, including only its own
|
|
11
|
+
required public re-exports. A shared controller needs no artificial visual preview.
|
|
12
|
+
Consumers normally create separate instances; sharing implementation does not
|
|
13
|
+
implicitly share state.
|
|
14
|
+
|
|
15
|
+
Use the project's `framework` from `ds.config.json` for framework-specific APIs.
|
|
16
|
+
Plain TypeScript, browser APIs and local behavior helpers remain supported.
|
|
17
|
+
Declare external dependencies in the project package. ADS does not install them
|
|
18
|
+
or assume a renderer/library supplied by an MCP host. The framework field selects
|
|
19
|
+
compilation/mounting; controller checks also validate runtime imports. Type-only
|
|
20
|
+
UI references are allowed, but shared controllers cannot import component/pattern
|
|
21
|
+
runtime implementations. Keep business data in application adapters. Measured
|
|
22
|
+
style writes retain exact `boundaries.styleWrites` properties; they do not allow
|
|
23
|
+
shared-token overrides or an extra styling layer.
|
|
24
|
+
These gates inspect supported direct imports, markup and style boundaries.
|
|
25
|
+
External package internals and delegated DOM behavior still require source,
|
|
26
|
+
build and browser review; declaring a dependency does not prove it is headless.
|
|
27
|
+
|
|
28
|
+
Register owner behavior in `<Owner>.ads.contract.ts` with actual API and
|
|
29
|
+
implementation references. The
|
|
30
|
+
[contract reference](contracts.md) covers static authoring, `.ads.behavior.spec.ts`,
|
|
31
|
+
declarative `exercises`, required browser checks and guarded migration.
|
|
32
|
+
A contract declaration alone is not passing evidence. Use
|
|
33
|
+
`auditBehaviorPaints(frame)` after relevant binding updates to repeat the current
|
|
34
|
+
App's generic paint audit, in addition to assertions for the named guarantee.
|
|
35
|
+
|
|
36
|
+
## Development boundary
|
|
37
|
+
|
|
38
|
+
Production includes real components, controllers, tokens and compiled styles.
|
|
39
|
+
Scenarios and fixtures are included only in previews. Behavior manifests and test
|
|
40
|
+
files are development/tooling inputs. Runtime imports and public re-exports of
|
|
41
|
+
those inputs are rejected, including dynamic imports and aliases.
|
|
42
|
+
|
|
43
|
+
## Register guarantees
|
|
44
|
+
|
|
45
|
+
An optional `<Owner>.ads.contract.ts` belongs to one unit. Owners without a
|
|
46
|
+
behavior declaration have no implied behavioral verification. ADS reads the
|
|
47
|
+
contract statically; it does not execute these imports or a project command:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import type { UnitContract } from "@reqvire-org/ads/contracts";
|
|
51
|
+
import { ScrollerController } from "./scroller-controller";
|
|
52
|
+
import { useMessageScroller } from "./MessageScroller";
|
|
53
|
+
|
|
54
|
+
export default {
|
|
55
|
+
schemaVersion: 1,
|
|
56
|
+
behavior: {
|
|
57
|
+
subjects: {
|
|
58
|
+
controller: { implementation: ScrollerController },
|
|
59
|
+
"scroll-api": { api: useMessageScroller },
|
|
60
|
+
},
|
|
61
|
+
guarantees: [{
|
|
62
|
+
id: "prepend-anchor",
|
|
63
|
+
description: "Prepending history preserves the visible anchor after layout settles.",
|
|
64
|
+
subjects: ["controller", "scroll-api"],
|
|
65
|
+
checks: ["prepend-anchor"],
|
|
66
|
+
}],
|
|
67
|
+
checks: {
|
|
68
|
+
"prepend-anchor": {
|
|
69
|
+
file: "./MessageScroller.ads.behavior.spec.ts",
|
|
70
|
+
case: "prepend-anchor",
|
|
71
|
+
scenario: "components/MessageScroller",
|
|
72
|
+
profile: "widget",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
} satisfies UnitContract;
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Names above are illustrative project choices. A subject identifies a public API
|
|
80
|
+
or an implementation symbol owned by the unit. Private subjects do not become
|
|
81
|
+
public API. A guarantee references known subjects and checks. Each check names a
|
|
82
|
+
colocated test/spec file, stable case ID, registered profile and optional
|
|
83
|
+
discovered scenario. Several guarantees may reference one check. Repeated
|
|
84
|
+
execution identities use the same check ID.
|
|
85
|
+
|
|
86
|
+
Private subjects default to the headless controller role. For an intentionally
|
|
87
|
+
visual internal renderer or binding producer, declare `role: "implementation"`
|
|
88
|
+
alongside its `implementation` reference in the contract. Its source ownership and normal runtime gates
|
|
89
|
+
still apply; registration does not make it public API. Shared `controllers/`
|
|
90
|
+
source remains headless regardless of subject metadata. See the
|
|
91
|
+
[owner contract](contracts.md#a-contract-uses-actual-implementation-references).
|
|
92
|
+
|
|
93
|
+
Static validation establishes registration and ownership, not that the guarantee
|
|
94
|
+
is true. README prose is not automatically certified. Link specific guarantees
|
|
95
|
+
when describing the evidence available for a behavior.
|
|
96
|
+
|
|
97
|
+
## Link a public API to a demonstration
|
|
98
|
+
|
|
99
|
+
Scenario `covers` retains its existing render-reference contract. Optional
|
|
100
|
+
`exercises` identifies public behavioral APIs:
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
export const scenario = {
|
|
104
|
+
title: "Message scrolling",
|
|
105
|
+
covers: ["MessageScroller", "MessageScrollerViewport"],
|
|
106
|
+
exercises: ["useMessageScroller", "useMessageScrollerScrollable"],
|
|
107
|
+
};
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Call hooks in a rendered local scenario adapter. Calls/construction are matched by
|
|
111
|
+
resolved symbol, not a `use*` naming convention. An unused import, dead adapter or
|
|
112
|
+
metadata string does not count. Dynamically passed behavior references produce a
|
|
113
|
+
review advisory when a direct call cannot be established; verify those through
|
|
114
|
+
registered execution checks rather than changing the API for the analyzer.
|
|
115
|
+
|
|
116
|
+
Callable exports may be functions, callable objects with attached methods, or
|
|
117
|
+
factory results. ADS uses their TypeScript call/construct signatures, including
|
|
118
|
+
the project's library declarations; it does not execute modules or maintain a
|
|
119
|
+
list of recognized factory names. The fast source guard resolves ambiguous public
|
|
120
|
+
values lazily and shares that type discovery within the check. Untyped `any`
|
|
121
|
+
values and objects containing methods do not establish a callable API.
|
|
122
|
+
An invalid `exercises` entry names the offending value and fails validation while
|
|
123
|
+
retaining independent render evidence for `covers`.
|
|
124
|
+
Calls to a callable's attached methods also exercise that public receiver,
|
|
125
|
+
including statically named member calls inside reachable event-handler closures.
|
|
126
|
+
Aliases, namespace access and re-exports retain the receiver identity. Reading a
|
|
127
|
+
method or defining an unused callback does not establish an invocation.
|
|
128
|
+
|
|
129
|
+
Public APIs appear in `ads_catalog` with `apiKind: "ui"` or `"behavior"` and their
|
|
130
|
+
scenario links. `ads_behaviors` joins contracts to demonstrations and evidence.
|
|
131
|
+
A demonstrated API is not automatically a verified guarantee.
|
|
132
|
+
|
|
133
|
+
## Register execution profiles
|
|
134
|
+
|
|
135
|
+
Profiles are explicit trusted development commands in `ds.config.json`. They use
|
|
136
|
+
literal executable/argument arrays, no shell interpolation or model-supplied
|
|
137
|
+
command. For a project with an installed Playwright test runner:
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"mcp": {
|
|
142
|
+
"behaviorProfiles": {
|
|
143
|
+
"widget": {
|
|
144
|
+
"runner": "playwright",
|
|
145
|
+
"command": "npm",
|
|
146
|
+
"args": ["run", "test:behavior", "--"],
|
|
147
|
+
"mode": "browser",
|
|
148
|
+
"timeoutMs": 60000
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Here `test:behavior` invokes the project's local `playwright test`. Its Playwright
|
|
156
|
+
configuration must discover colocated spec files. Configure browser installation
|
|
157
|
+
and any required test setup in that project. The ADS tooling host gains no
|
|
158
|
+
framework or browser dependency from a profile.
|
|
159
|
+
|
|
160
|
+
The Playwright adapter appends selected file paths and case-tag filtering, its
|
|
161
|
+
reporter and a generated artifact directory. Unselected cases in the same spec
|
|
162
|
+
do not run. It preserves the project's worker configuration.
|
|
163
|
+
|
|
164
|
+
`timeoutMs` bounds the complete runner process for one profile, including runner
|
|
165
|
+
startup, hooks, retries and all selected cases. It is not a per-test timeout.
|
|
166
|
+
Playwright's own test/hook timeouts remain separate project settings. Set the
|
|
167
|
+
profile budget from measured suite durations with headroom; increasing it does
|
|
168
|
+
not repair a stalled assertion or cleanup.
|
|
169
|
+
|
|
170
|
+
Independent specs can use multiple Playwright workers against the same managed
|
|
171
|
+
candidate host. Each check needs its own page/context and state; avoid fixed ports,
|
|
172
|
+
shared mutable fixtures and test-order dependencies. Start with a small worker
|
|
173
|
+
count and measure on the target machine. Files normally run in parallel; tests
|
|
174
|
+
within one file normally remain sequential. ADS does not force parallelism or
|
|
175
|
+
change verification policy. See [Playwright parallelism](https://playwright.dev/docs/test-parallel).
|
|
176
|
+
Prefer readiness/assertion polling over arbitrary sleeps. Timer-only guarantees
|
|
177
|
+
may use [Playwright's clock](https://playwright.dev/docs/clock); retain real time
|
|
178
|
+
when browser motion, pointer gestures or layout timing are what the check verifies.
|
|
179
|
+
|
|
180
|
+
An ordinary test-failure exit (code 1) with a complete report and actual failing
|
|
181
|
+
cases preserves independent case outcomes: passing checks stay `passed`, failed
|
|
182
|
+
checks stay `failed`, and overall verification still blocks the mutation. The
|
|
183
|
+
report must account for every selected check, with no active cases or suite errors.
|
|
184
|
+
The same rule supports older custom reports without an explicit `complete` field
|
|
185
|
+
after normal process completion. An unexplained nonzero exit cannot certify a
|
|
186
|
+
pass, even if all reported cases claim success. Results retain `reportedStatus`
|
|
187
|
+
and `runnerExitCode` and explain the overall failure. Suite-level browser errors and
|
|
188
|
+
bounded runner output appear in diagnostics. `openBehaviorScenario` includes the
|
|
189
|
+
scenario ID and failed browser requests in startup failures; App resource errors
|
|
190
|
+
identify the resource URI. The ADS showcase retries only `resources/read` fetch
|
|
191
|
+
transport failures, with at most three attempts and 200/800 ms backoff. Recovered
|
|
192
|
+
startup reads appear in `startupDiagnostics` with retry counts and failed browser
|
|
193
|
+
requests; each retry is also logged in the browser console. This does not retry a
|
|
194
|
+
tool call, assertion, check or complete startup. HTTP/protocol/content errors,
|
|
195
|
+
integrity failures and cancellations do not retry. Persistent loading failures
|
|
196
|
+
still fail the check and block mutations. External hosts control their own
|
|
197
|
+
transport recovery.
|
|
198
|
+
|
|
199
|
+
`net::ERR_NETWORK_CHANGED` reports Chrome's network-change error, not proof that
|
|
200
|
+
the MCP endpoint restarted or that a particular interface changed. To investigate
|
|
201
|
+
an intermittent failure, correlate the saved case timestamps with Chrome's
|
|
202
|
+
network log, server availability and live interface monitoring (for example,
|
|
203
|
+
`ip -ts monitor link address route` on Linux). Interfaces being present, or stable
|
|
204
|
+
after a failure, does not establish the cause. Preserve the draft and original
|
|
205
|
+
diagnostic; do not change a component API, reference example or verification
|
|
206
|
+
policy to compensate for a resource-loading failure.
|
|
207
|
+
|
|
208
|
+
The reporter atomically publishes partial snapshots at test start/end. While a
|
|
209
|
+
run is active, `ads_status.behaviors.progress` exposes the profile, runner budget,
|
|
210
|
+
elapsed time, completed/active/pending counts, worker count when available and
|
|
211
|
+
case identities/timings. Candidate mutation verification exposes the same data at
|
|
212
|
+
`ads_status.mutations.progress`. Clients requesting MCP progress receive updates
|
|
213
|
+
and a heartbeat during the runner phase; client-side request timeouts still apply.
|
|
214
|
+
`durationMs` records completed case execution, including attempts, separately from
|
|
215
|
+
the suite's wall time. Parallel case durations can sum to more than wall time.
|
|
216
|
+
|
|
217
|
+
After a deadline, valid completed outcomes remain visible through `reportedStatus`
|
|
218
|
+
and durations, alongside active and unstarted case identities. A passed case from
|
|
219
|
+
an interrupted run has blocking status `incomplete`; real assertion failures retain
|
|
220
|
+
their own messages. No incomplete run can accept a mutation or certify a guarantee.
|
|
221
|
+
Reports and artifacts stay under the live project's `.ds/verification/` even after
|
|
222
|
+
the candidate copy is removed. This is diagnostic output, not passing live-source
|
|
223
|
+
evidence. Old/custom runners without incremental progress use `not_reported` for
|
|
224
|
+
cases whose execution state cannot be established.
|
|
225
|
+
|
|
226
|
+
Use native test tags for stable case identity:
|
|
227
|
+
|
|
228
|
+
```ts
|
|
229
|
+
import { test, expect } from "@playwright/test";
|
|
230
|
+
import { openBehaviorScenario } from "@reqvire-org/ads/verification";
|
|
231
|
+
|
|
232
|
+
test("history preserves the visible anchor", { tag: "@ads:prepend-anchor" }, async ({ page }) => {
|
|
233
|
+
const frame = await openBehaviorScenario(page, "prepend-anchor");
|
|
234
|
+
// Perform real interactions and assert the project's guarantee here.
|
|
235
|
+
await expect(frame.getByRole("region", { name: "Messages" })).toBeVisible();
|
|
236
|
+
});
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
The shown assertion is only a harness example; it does not establish anchoring.
|
|
240
|
+
Write meaningful assertions for the registered guarantee. The helper waits for
|
|
241
|
+
the current selected scenario inside the real sandboxed MCP App. It uses `load`
|
|
242
|
+
and explicit readiness, not `networkidle`: MCP keeps event connections open.
|
|
243
|
+
|
|
244
|
+
Compare reference and candidate under equivalent framing. In a reported Chrome
|
|
245
|
+
comparison, `content-visibility` initially used placeholder geometry inside a
|
|
246
|
+
cross-origin App iframe for both ADS and the upstream reference; the same content
|
|
247
|
+
measured differently as a top-level page. This is an observed browser/layout
|
|
248
|
+
condition, not evidence of an ADS defect. App readiness does not imply that every
|
|
249
|
+
off-screen item has rendered. For geometry assertions, bring the relevant content
|
|
250
|
+
into view and wait for its measured layout to settle. Record the framing and
|
|
251
|
+
visibility state; test initial placeholder behavior separately when it matters to
|
|
252
|
+
the guarantee. Wait for focus and positioning readiness before normal keyboard
|
|
253
|
+
comparisons, and test rapid input separately rather than hiding it behind delays.
|
|
254
|
+
|
|
255
|
+
`mode: "browser"` starts an isolated managed showcase on an automatic port. Test
|
|
256
|
+
requests contain its scenario URLs, and cleanup closes its host/compiler tree.
|
|
257
|
+
Mutation candidates use their own source, generated graph and server; a passing
|
|
258
|
+
test against an older fixed-port live showcase cannot validate a candidate.
|
|
259
|
+
|
|
260
|
+
Use `mode: "strict"` only for React with a project development harness that mounts
|
|
261
|
+
the relevant API in StrictMode. The production MCP App does not replay development
|
|
262
|
+
effects. This profile does not receive a production showcase URL from the helper.
|
|
263
|
+
For Preact, register its actual lifecycle tests without claiming React StrictMode.
|
|
264
|
+
The profile names record the chosen environment; ADS does not infer that a test's
|
|
265
|
+
assertions cover every lifecycle condition.
|
|
266
|
+
|
|
267
|
+
Other runners use `runner: "protocol"` (the default). ADS provides
|
|
268
|
+
`ADS_VERIFY_REQUEST` and `ADS_VERIFY_REPORT` absolute paths. Read the request's
|
|
269
|
+
`schemaVersion`, unique `runId`, `projectRoot`, `framework`, `profile`, `mode`,
|
|
270
|
+
selected `checks` and optional `scenarios` URLs. Write a bounded JSON report:
|
|
271
|
+
|
|
272
|
+
```json
|
|
273
|
+
{
|
|
274
|
+
"schemaVersion": 1,
|
|
275
|
+
"runId": "<the request's runId>",
|
|
276
|
+
"cases": [
|
|
277
|
+
{
|
|
278
|
+
"id": "prepend-anchor",
|
|
279
|
+
"file": "design-system/components/MessageScroller/MessageScroller.ads.behavior.spec.ts",
|
|
280
|
+
"status": "passed"
|
|
281
|
+
}
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Case statuses are `passed`, `failed` or `skipped`, with optional `message` and
|
|
287
|
+
`durationMs`. Protocol runners may atomically publish intermediate reports with
|
|
288
|
+
`complete:false` and an `active` list of `{id,file,startedAt,workerIndex?}`, then
|
|
289
|
+
publish `complete:true` at completion. Older final reports without `complete`
|
|
290
|
+
remain supported after normal process completion. An explicitly incomplete report
|
|
291
|
+
cannot pass even with exit code zero. Partial reports retain the same schema/run
|
|
292
|
+
identity and size limits as final reports.
|
|
293
|
+
Cases may optionally include `failure: {category,phase,code,certainty?}`,
|
|
294
|
+
`source: {file,line,column}`, `failingStep`, `viewport`/`viewportSource`, and
|
|
295
|
+
`artifacts: [{name,mimeType,path}]`. Artifact paths are relative to the report
|
|
296
|
+
directory and must remain under that run's `artifacts/` directory. The built-in
|
|
297
|
+
Playwright reporter supplies these from actual step/startup/attachment evidence.
|
|
298
|
+
Older protocol runners can omit them; ADS preserves that lack of classification
|
|
299
|
+
instead of treating an arbitrary thrown message as an assertion.
|
|
300
|
+
`file` is project-relative. Nonzero process exit, missing cases, skipped cases,
|
|
301
|
+
wrong run IDs and unavailable reports do not pass. Test commands are trusted
|
|
302
|
+
project code; an adapter cannot prove the quality or honesty of their assertions.
|
|
303
|
+
|
|
304
|
+
## Execute and inspect evidence
|
|
305
|
+
|
|
306
|
+
Use `ads_behaviors` for bounded discovery; request an exact unit for its contract.
|
|
307
|
+
General listings return counts and short API/guarantee/scenario summaries. Exact
|
|
308
|
+
owner requests return the registered details; source reads remain available for
|
|
309
|
+
bounded inspection of large contracts. No full guide or test body is injected
|
|
310
|
+
into discovery results.
|
|
311
|
+
Call `ads_verify({unit, checks?})` for selected registered checks. Read
|
|
312
|
+
`ads://project/behaviors` for current evidence or `ads://guides/behaviors` for this
|
|
313
|
+
guide. CLI/CI equivalents are:
|
|
314
|
+
|
|
315
|
+
```sh
|
|
316
|
+
ads behaviors . --json
|
|
317
|
+
ads verify . --unit controllers/ScrollFollow
|
|
318
|
+
ads verify . --unit components/MessageScroller --check prepend-anchor --json
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
Execution has bounded output, a configured timeout, cancellation and process-tree
|
|
322
|
+
ownership. Evidence records case/profile identity, source/dependency revision,
|
|
323
|
+
completion time, report path and the available preview revision. Later input
|
|
324
|
+
changes mark results stale; changes during execution prevent a current pass.
|
|
325
|
+
Guarantees report passing only when all their checks have current passing evidence.
|
|
326
|
+
Passing applies to those cases and profiles, not every application state.
|
|
327
|
+
|
|
328
|
+
Results expose structured `failure` boundaries and explicit `acceptance` scope.
|
|
329
|
+
MCP execution replies contain counts, bounded acceptance, at most three failure
|
|
330
|
+
previews and a `resultId` (4 KiB UTF-8 JSON maximum). Use `ads_results` to read
|
|
331
|
+
selected `outcomes`, `checks`, `diagnostics` or other sections without execution.
|
|
332
|
+
Pages default to 10 rows, allow at most 20 and stay within 8 KiB; follow
|
|
333
|
+
`nextCursor` with identical selection/status. Truncated records provide
|
|
334
|
+
`recordIndex` for exact `offset`/`chars` ranges. Only the latest verification and
|
|
335
|
+
mutation snapshots are retained, independently, at most 8 MiB each. Replaced IDs
|
|
336
|
+
fail explicitly. Validation still uses complete internal outcomes.
|
|
337
|
+
|
|
338
|
+
Use `ads_investigate({unit,check,runId})` with an outcome's exact IDs for its compact
|
|
339
|
+
summary (4 KiB maximum); details, requests, browser errors and artifact metadata are separate
|
|
340
|
+
paged sections (8 KiB maximum). Truncated records support exact text ranges with
|
|
341
|
+
the recorded run ID. Saved outcomes describe completion time; compare current
|
|
342
|
+
`ads_behaviors` revisions for freshness. It includes isolated dry runs; `ads://project/investigations` lists available entries. Exact
|
|
343
|
+
input and observed preview revisions, failing step/source, startup viewport,
|
|
344
|
+
failed startup requests and available project-recorded artifacts keep diagnosis
|
|
345
|
+
separate from an inferred component defect. No artifact is invented or test
|
|
346
|
+
retried. Each check retains one latest bundle; old artifact resource access is
|
|
347
|
+
superseded. Candidate bundles remain distinct from passing live-source evidence.
|
|
348
|
+
Read the portable [evidence reference](evidence.md)
|
|
349
|
+
for category meanings, collection limits and artifact policy.
|
|
350
|
+
|
|
351
|
+
Revisions include owned files, literal import dependencies, local CSS imports and
|
|
352
|
+
asset URLs, token foundation, project/runner configuration, lockfiles and tooling.
|
|
353
|
+
Computed module selection conservatively includes all ADS owners. Environment,
|
|
354
|
+
network and other unregistered external inputs remain the runner's responsibility;
|
|
355
|
+
an evidence record is not a proof about arbitrary external state.
|
|
356
|
+
|
|
357
|
+
For named imports through simple re-export barrels, ADS follows selected bindings
|
|
358
|
+
and retains dependencies with declared side effects. This narrowing requires a
|
|
359
|
+
package `sideEffects:false` or a supported simple `sideEffects` glob array; preserve
|
|
360
|
+
CSS/global effects in that policy. Unknown policies/patterns, wildcard exports and
|
|
361
|
+
computed imports remain conservative. Barrel source changes still invalidate
|
|
362
|
+
dependents. ADS caches source parsing, resolution and digests within an inspection
|
|
363
|
+
only; later runs read current source again.
|
|
364
|
+
|
|
365
|
+
Guarded mutations execute affected registered behavior contracts after core,
|
|
366
|
+
Oxlint and configured project checks, before writing source. Imported shared
|
|
367
|
+
controller changes also select dependent contracts conservatively. Rejected and
|
|
368
|
+
dry-run patches publish no source changes. Verification output stays under `.ds/`.
|
|
369
|
+
To check a prepared draft, request its diff and pass the returned `patchFile` to
|
|
370
|
+
`ads_apply_patch` with `dryRun:true`. This checks the isolated candidate, including
|
|
371
|
+
affected behavior contracts and its configured browser preview. Candidate evidence
|
|
372
|
+
is not persisted as passing evidence for live source. `ads_verify` selects checks
|
|
373
|
+
for current source and has no draft argument.
|
|
374
|
+
|
|
375
|
+
## Packaging and performance
|
|
376
|
+
|
|
377
|
+
Controllers follow normal component/scenario imports into the project's compiled
|
|
378
|
+
resource graph. Their framework dependencies are bundled by the project compiler
|
|
379
|
+
and served through MCP resources inside the App iframe; external hosts install
|
|
380
|
+
nothing. The selected scenario loads its dependency closure. Shared modules are
|
|
381
|
+
cached within that App instance, and each separately opened App has its own runtime.
|
|
382
|
+
|
|
383
|
+
Keep ESM modules and explicit imports. Avoid an eagerly imported controller
|
|
384
|
+
registry. Tree shaking and shared chunks follow the project bundler: class methods,
|
|
385
|
+
side effects, global CSS and dynamic maps can retain extra code. Inspect emitted
|
|
386
|
+
resources instead of assuming a controller produces a minimal bundle.
|
|
387
|
+
|
|
388
|
+
Development-only `review/<Owner>` units may register the same guarantee/check
|
|
389
|
+
contracts for review presentation and controls. Subjects can name that owner's
|
|
390
|
+
separate review API or local headless helpers; checks still run registered project
|
|
391
|
+
profiles and can refer to an existing real scenario. This grants no production
|
|
392
|
+
API, catalogue entry, `covers` credit or runtime import permission. See the
|
|
393
|
+
[portable review guide](review.md).
|
|
@@ -59,7 +59,7 @@ export const scenario = {
|
|
|
59
59
|
};
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
Use attributes/selectors already owned by the real UI or its
|
|
62
|
+
Use attributes/selectors already owned by the real UI or its development-only review helper.
|
|
63
63
|
Scenarios keep their existing styling/control rules. A target is not permission
|
|
64
64
|
to add demo-only product props, custom CSS or synthetic native controls. Each
|
|
65
65
|
selector is scoped to the App iframe and must match exactly one visible element.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Static owner contracts and development files
|
|
2
2
|
|
|
3
|
-
Use one optional `<Owner>.ads.contract.ts` for
|
|
3
|
+
Use one optional `<Owner>.ads.contract.ts` for constrained
|
|
4
4
|
paint inputs, scoped runtime bindings, declarative parts and behavioral checks.
|
|
5
5
|
The import `import type { UnitContract } from "@reqvire-org/ads/contracts"` supplies
|
|
6
6
|
development typing. ADS reads its AST and resolves real symbols without importing
|
|
@@ -15,12 +15,9 @@ components/Plot/
|
|
|
15
15
|
renderer.tsx production consumer
|
|
16
16
|
paints.ts production binding producer
|
|
17
17
|
types.ts production prop types
|
|
18
|
-
tokens.css optional production token definitions
|
|
19
18
|
Plot.ads.contract.ts static tool declaration
|
|
20
19
|
Plot.ads.scenario.tsx demonstration
|
|
21
20
|
Plot.ads.fixture.ts demonstration data
|
|
22
|
-
Tokens.ads.scenario.tsx real owner-token samples
|
|
23
|
-
Tokens.ads.fixture.ts sample bindings/probes
|
|
24
21
|
Plot.ads.behavior.spec.ts registered browser checks
|
|
25
22
|
Plot.ads.test.tsx optional unit tests
|
|
26
23
|
Plot.ads.helpers.ts development-only adapters
|
|
@@ -56,7 +53,6 @@ import { paints } from "./paints";
|
|
|
56
53
|
|
|
57
54
|
export default {
|
|
58
55
|
schemaVersion: 1,
|
|
59
|
-
tokens: { namespace: "--plot-", stylesheet: "./tokens.css" },
|
|
60
56
|
paintInputs: [
|
|
61
57
|
{ api: Plot, property: "config.*.paint", kind: "paint-reference" },
|
|
62
58
|
{ api: Series, property: "fill", kind: "paint-reference", bindings: ["items"] },
|
|
@@ -75,7 +71,7 @@ export default {
|
|
|
75
71
|
{ api: Series, parent: Plot, consumer: Renderer, checks: ["isolation"] },
|
|
76
72
|
],
|
|
77
73
|
behavior: {
|
|
78
|
-
subjects: { plot: { api: Plot }, renderer: { implementation: Renderer } },
|
|
74
|
+
subjects: { plot: { api: Plot }, renderer: { implementation: Renderer, role: "implementation" } },
|
|
79
75
|
guarantees: [{
|
|
80
76
|
id: "scoped-output",
|
|
81
77
|
description: "Changing either instance updates only its own output.",
|
|
@@ -97,7 +93,13 @@ Symbol references resolve through normal imports, aliases and re-exports.
|
|
|
97
93
|
Calls, getters, methods, computed metadata and environment-dependent expressions
|
|
98
94
|
are rejected. Function references are opaque identities, never executed.
|
|
99
95
|
Private implementation subjects may be internal module exports without becoming
|
|
100
|
-
public barrel exports.
|
|
96
|
+
public barrel exports. Private subjects default to the existing headless controller
|
|
97
|
+
contract. Use `role: "controller"` explicitly for behavior-only code, or
|
|
98
|
+
`role: "implementation"` for a private visual renderer or binding producer whose
|
|
99
|
+
guarantees should be tracked without classifying it as a controller. Shared
|
|
100
|
+
`controllers/` source always remains headless. An implementation role retains
|
|
101
|
+
normal ownership, dependency, styling and development boundaries; it is not a
|
|
102
|
+
style exception. Producers/consumers must belong to the same owner. Required
|
|
101
103
|
checks must exist, back named guarantees and use a browser profile with the
|
|
102
104
|
corresponding scenario. A relationship is registration, not a passing guarantee.
|
|
103
105
|
|
|
@@ -145,17 +147,30 @@ it does not authorize arbitrary inline styling, CSSProperties APIs or bulk write
|
|
|
145
147
|
Unsupported dynamic producers/attachment paths fail with an analysis diagnostic.
|
|
146
148
|
Keep the implementation project-owned; there is no required ADS binding helper.
|
|
147
149
|
|
|
148
|
-
|
|
150
|
+
A producer with alternative/derived sources declares each entry path, for example:
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
valueFrom: ["paint", "scheme.day", "scheme.night"],
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Register each matching `config.*.<path>` in `paintInputs`. The producer may write
|
|
157
|
+
one declared field, or an exact `light-dark(${entry.scheme.day}, ${entry.scheme.night})`
|
|
158
|
+
template over two declared fields. The normal key/map/root proof still applies.
|
|
159
|
+
Raw constants, undeclared fields, extra writes and unknown transforms are rejected.
|
|
160
|
+
The browser audit checks actual accessible color references in both branches;
|
|
161
|
+
a local SVG URL or `none` is not a CSS color inside `light-dark()`.
|
|
162
|
+
|
|
163
|
+
Families cannot overlap shared tokens, private runtime
|
|
149
164
|
prefixes or other bindings. A broad family such as `--color-${key}` grants no
|
|
150
165
|
shared-token exception. Use a distinct private family where collision freedom
|
|
151
166
|
cannot be established. Registered paint consumers list their allowed binding IDs;
|
|
152
|
-
borrowing a peer's family or private
|
|
167
|
+
borrowing a peer's binding family or private runtime variable remains invalid. Bindings are scoped
|
|
153
168
|
to their actual root; portals outside it need deliberate project integration.
|
|
154
169
|
|
|
155
170
|
A registered binding producer may combine two accessible color references as
|
|
156
171
|
`light-dark(var(--light-token), var(--dark-token))`. The App paint audit checks
|
|
157
172
|
both branches and their observed effect in the active color scheme. Raw colors,
|
|
158
|
-
|
|
173
|
+
undefined tokens and SVG URLs inside this color function remain invalid.
|
|
159
174
|
This derived binding form does not widen public paint-input types; use constrained
|
|
160
175
|
references for each theme input and verify both color schemes in browser checks.
|
|
161
176
|
|
|
@@ -184,9 +199,30 @@ export const scenario = {
|
|
|
184
199
|
};
|
|
185
200
|
```
|
|
186
201
|
|
|
187
|
-
|
|
202
|
+
A part may register several distinct parents; each API/parent pair has one
|
|
203
|
+
consumer/check declaration. A parent may itself be a registered declarative part.
|
|
204
|
+
The graph must be acyclic and every parent chain must reach a public rendering
|
|
205
|
+
root. Duplicate pairs, cycles and detached part graphs fail.
|
|
206
|
+
|
|
207
|
+
For example, `Entry` can belong to `FirstView` and `SecondView`, while `Detail`
|
|
208
|
+
belongs to `Entry`. The scenario covers the rendering roots and exercises both
|
|
209
|
+
`Entry` and `Detail`. A nested `Detail` outside its registered parent does not count.
|
|
210
|
+
|
|
211
|
+
The real part must reach its registered consumer through a rendering parent.
|
|
188
212
|
ADS resolves source identity comparisons (`child.type === Series`, including a
|
|
189
213
|
traceable comparison helper) and reads of that same child’s props traced from the consumer’s children input.
|
|
214
|
+
Traceable paths include local recursive fragment flattening, `find`/`filter`,
|
|
215
|
+
callback aliases and props carried through local records. Reusing a review layout
|
|
216
|
+
inside another instance of itself is ordinary component composition, not a
|
|
217
|
+
recursive helper call. Source sites/work limits still bound analysis.
|
|
218
|
+
|
|
219
|
+
`exercises` establishes reachable behavioral use, including a conditional state
|
|
220
|
+
and mapped literal fixture data; it does not promise unconditional initial DOM.
|
|
221
|
+
Always-false branches, unused adapters, empty/unknown fixture maps and broken
|
|
222
|
+
parent chains grant no credit. `covers` retains its rendering contract. Required
|
|
223
|
+
browser checks cover a rendering root and exercise the relevant parent/child
|
|
224
|
+
chain, then verify adding/removing/updating the part changes actual output.
|
|
225
|
+
|
|
190
226
|
A comparison against a decoy object gives no evidence. An import, unrelated parent, unused
|
|
191
227
|
child or metadata claim gives no consumption credit. Unknown render branches are
|
|
192
228
|
conservative. Browser checks must verify that adding/removing/changing the part
|
|
@@ -199,38 +235,23 @@ retained. Unreadable prerequisites report coverage as not established. Inspect
|
|
|
199
235
|
the exact source diagnostic and bounded results; do not assume every subsequent
|
|
200
236
|
missing preview means its runtime API is invalid.
|
|
201
237
|
|
|
202
|
-
##
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
Ownership does not establish a project's visual scale:
|
|
216
|
-
|
|
217
|
-
- A component redefining shared `--space-4` fails.
|
|
218
|
-
- Its private `--plot-gap: 7px` can be valid component geometry.
|
|
219
|
-
- `--plot-gap: var(--space-4)` preserves a shared scale with local meaning.
|
|
220
|
-
|
|
221
|
-
Choose project policy explicitly. A registered project check can use tooling-only
|
|
222
|
-
`inspectTokens(root)` and `inspectTokenOrigins(inventory, name, { stopAt: names })`
|
|
223
|
-
from `@reqvire-org/ads`. `aliasOnly` verifies every theme definition follows only
|
|
224
|
-
aliases to the explicitly selected origins; `literals` and `diagnostics` explain
|
|
225
|
-
violations/limits. Select the exact targets and permitted shared origins. Keep
|
|
226
|
-
intentional geometry exceptions exact with documented reasons. ADS neither
|
|
227
|
-
infers spacing meaning from names nor prescribes a global spacing palette.
|
|
238
|
+
## Shared Data and project consistency
|
|
239
|
+
|
|
240
|
+
Data has one shared design vocabulary in the configured token foundation. There
|
|
241
|
+
is no owner-contract token namespace or private value stylesheet. Components map
|
|
242
|
+
shared values into `--ds-*`; patterns use `--ux-*`. Static literals cannot bypass
|
|
243
|
+
this boundary through aliases, fallbacks, themes or helper/import interpolation.
|
|
244
|
+
Shared token samples belong under the token directory. See
|
|
245
|
+
[shared Data and component mappings](design-data.md).
|
|
246
|
+
|
|
247
|
+
`inspectTokenOrigins(inventory, name, {stopAt: names})` remains available for
|
|
248
|
+
project-specific audits of shared alias relationships. It supplements mandatory
|
|
249
|
+
core source checks and does not enable independent local values.
|
|
228
250
|
|
|
229
251
|
## Migration and MCP editing
|
|
230
252
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
normalize into the same discovery, ownership, source revisions, affected-check
|
|
253
|
+
Use the static owner contract for new registrations. Competing declarations fail.
|
|
254
|
+
Contracts participate in discovery, ownership, source revisions, affected-check
|
|
234
255
|
selection and candidate gates. `ads_units` exposes `contractFile`; `ads_catalog`
|
|
235
256
|
reports constrained paint paths and declarative parent/consumer/check references.
|
|
236
257
|
Use bounded file reads and paged detailed results, not repeated whole-project dumps.
|