mirror of
https://github.com/callstack/agent-device.git
synced 2026-09-14 20:06:34 +08:00
a3ab69a110
* refactor(replay-test): neutralize the values crossing the scheduler seam
#1478 P3, part 1 of 2. Prepares the replay-test extraction by removing every
non-neutral value that crosses the scheduler seam, in place under `src/`, so the
physical move to `packages/replay-test` is a file move rather than a redesign.
`DaemonResponse` no longer crosses the seam. `session-test-types.ts` typed
`runReplay`/`finalizeAttempt` as returning a daemon response and the scheduler read
`.error.code`, `.error.details`, and `.data.replayed/.healed/.warnings/
.snapshotDiagnostics` off it throughout. That is invisible to R10 today only
because `checkDaemonTypesImporters` skips `src/daemon/`; once the files live in a
package they become external `daemon/types.ts` importers, which the ratchet only
lets shrink. Attempts now resolve as tagged `ReplayTestAttemptOutcome` values
carrying exactly what the scheduler consumes, including an `infrastructure` tag —
classifying an environmental failure needs platform boot-diagnostic vocabulary the
scheduler must not import, so the host decides and the scheduler reads the verdict.
`session-test-outcome.ts` is the one place a daemon response becomes an outcome.
Step events get a narrow per-attempt port. They were emitted from
`session-replay-runtime.ts` and `session-replay-maestro-observer.ts`, both reading
a request-global `AsyncLocalStorage` seeded per attempt. The scheduler now hands
each attempt an `onStep` sink, threaded the way `tracePath` already is; both
engines call it and `withReplayTestActionProgress`/`readReplayTestActionProgress`
are gone. A direct `replay` simply has no sink.
ADR 0012 divergence becomes a neutral leaf. `src/replay/divergence.ts` depended
only on kernel contracts and redaction, yet Maestro constructs divergences too and
CLI/MCP both render them, so P5 could not have moved it into `packages/ad-replay`.
It is now `@agent-device/contracts/divergence`; the renderer's output text is
unchanged.
The progress wire vocabulary moves to `@agent-device/contracts/progress`. It is
serialized by `request-progress-protocol.ts` and reconstructed by the CLI reporter
path, so it belongs below both; `src/request/progress.ts` keeps only the sink and
its AsyncLocalStorage binding.
Together these clear all four of replay-test's recorded R10 migration imports, so
the rule now enforces unconditionally for that module.
Behavior is unchanged. The shipped reporter contract — export spellings,
object/factory loading, hook names, timing/order, value fields, the synchronous
live-hook rule, awaited suite completion, error handling, exit codes — is
untouched, and `session-test-reporter-values.test.ts` passes unmodified. The
`--shard-all` `total`/`runnable` asymmetry is preserved as characterized.
Refs #1478
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RXQLYV7etZx3gcXsUsrQJ8
* test(replay-test): pin the Maestro reporter step path against the onStep port
Review finding on #1509: the native `.ad` reporter ratchet exercises only one of
the two `onStep` forwarding chains, so deleting a link in the Maestro chain would
silently stop `onTestStep` for every `test --maestro` run while every existing
reporter test stayed green. Same defect class as the dropped diagnosticId/logPath
(#1501) and the dropped reporter `hint` (#1505).
Maestro is one of P3's two required real adapters and its chain shares no links
with the native one below `runReplayScriptFile`:
scheduler sink -> runReplayScriptFile -> runTypedMaestroReplayFile
-> createMaestroReplayObserver({ onStep }) -> actionStarted -> onStep
Adds a Maestro scenario driving `test --maestro` through the real session handler
and the real reporter registry. It asserts the step payload the engine produces
(`stepIndex`/`stepTotal`/`stepCommand`/`stepValue`, including that a value-less
command stays value-less) together with the attempt/session identity the scheduler
supplies, since that half of the event came from request-global AsyncLocalStorage
before P3. A second case drives a retry so step events must carry attempt-1's
session and then attempt-2's. The flow `name` also pins the reporter `title`, a
value only the Maestro path can produce.
New file rather than an addition to session-test-reporter-values.test.ts: that file
is the pinned characterization and must keep passing unmodified, and Maestro needs
its own vi.mock of core/dispatch for device resolution.
Counterfactual run, both links, each restored after:
- dropping `onStep` from createMaestroReplayObserver in
session-replay-maestro-runtime.ts
- dropping the emitMaestroStep call from actionStarted in
session-replay-maestro-observer.ts
Each dropped both onTestStep events ("expected [ 'onSuiteStart', 'onTestStart',
…(2) ] to deeply equal [ 'onSuiteStart', 'onTestStart', …(4) ]") and failed both
new cases, while session-test-reporter-values.test.ts passed all 4 — exactly the
hole the reviewer identified.
Test-only; no production change. Bundle output is byte-identical to b339c640f.
Refs #1478
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RXQLYV7etZx3gcXsUsrQJ8
---------
Co-authored-by: Claude <noreply@anthropic.com>
69 lines
1.9 KiB
JSON
69 lines
1.9 KiB
JSON
{
|
|
"name": "@agent-device/contracts",
|
|
"version": "0.0.0",
|
|
"private": true,
|
|
"type": "module",
|
|
"description": "Shared agent-device command, snapshot, provider, and platform vocabulary. Internal workspace package bundled into the published agent-device artifact.",
|
|
"dependencies": {
|
|
"@agent-device/kernel": "workspace:*"
|
|
},
|
|
"exports": {
|
|
"./client": {
|
|
"types": "./src/facades/client.ts",
|
|
"default": "./src/facades/client.ts"
|
|
},
|
|
"./command": {
|
|
"types": "./src/facades/command.ts",
|
|
"default": "./src/facades/command.ts"
|
|
},
|
|
"./device": {
|
|
"types": "./src/facades/device.ts",
|
|
"default": "./src/facades/device.ts"
|
|
},
|
|
"./interaction": {
|
|
"types": "./src/facades/interaction.ts",
|
|
"default": "./src/facades/interaction.ts"
|
|
},
|
|
"./capture": {
|
|
"types": "./src/facades/capture.ts",
|
|
"default": "./src/facades/capture.ts"
|
|
},
|
|
"./platform": {
|
|
"types": "./src/facades/platform.ts",
|
|
"default": "./src/facades/platform.ts"
|
|
},
|
|
"./settings": {
|
|
"types": "./src/settings.ts",
|
|
"default": "./src/settings.ts"
|
|
},
|
|
"./session": {
|
|
"types": "./src/facades/session.ts",
|
|
"default": "./src/facades/session.ts"
|
|
},
|
|
"./recording": {
|
|
"types": "./src/facades/recording.ts",
|
|
"default": "./src/facades/recording.ts"
|
|
},
|
|
"./observability": {
|
|
"types": "./src/facades/observability.ts",
|
|
"default": "./src/facades/observability.ts"
|
|
},
|
|
"./remote": {
|
|
"types": "./src/facades/remote.ts",
|
|
"default": "./src/facades/remote.ts"
|
|
},
|
|
"./replay": {
|
|
"types": "./src/facades/replay.ts",
|
|
"default": "./src/facades/replay.ts"
|
|
},
|
|
"./divergence": {
|
|
"types": "./src/facades/divergence.ts",
|
|
"default": "./src/facades/divergence.ts"
|
|
},
|
|
"./progress": {
|
|
"types": "./src/facades/progress.ts",
|
|
"default": "./src/facades/progress.ts"
|
|
}
|
|
}
|
|
}
|