feat(config)!: config shape, part 1: recording modes, output root, test-glob exclusions, renames, secrets in engine options
Merged
OK
2mo ago+2882+2882+0123456789012345678901234567890123456789-1126-1126-0123456789012345678901234567890123456789
First layer of the config redesign agreed after #610 (it replaces the closed #489). Stack: this PR, then #646 (agents), then #648 (the app on the target and services).
Recording modes
traceandvideoshare oneRecordingMode:'off' | 'on' | 'retain-on-failure' | 'on-first-retry' | 'on-all-retries'.- They can be set at the config root, on a target, on a test or describe, or with
--trace [mode]/--video [mode]. Precedence, lowest first: config, target, CLI, test. - Trace defaults to
onlocally andon-first-retryin CI. There's a notice when a retry mode meetsretries: 0. - A mode set at the config root or with a flag skips targets that can't record, with one notice. A mode set on a target or a test is required and fails with
UNSUPPORTED_ARTIFACT. artifacts.kindsandartifacts.traceare removed, and each old form names thetracemode it meant. Failure screenshots are always captured.
Output
output(default.e2e,--output) is the one per-run root: report, junit, summary, ai-trace,artifacts/,sessions/, and MCP videos.cache.dirstays separate.<output>/artifactsis cleared at run start. The output directory is validated: not the project root, not inside the cache, not holding the tests.--artifactsis hidden and fails with the--outputmapping.artifactsholds onlystore. The optionalArtifactStore.putLinkreceives provider-hosted video links, and itsrefgoes into the report.
trace: 'on-first-retry',
video: 'retain-on-failure',
output: '.e2e',
artifacts: { store: { put, putLink } },
targets: [{ name: 'kernel', engine, video: 'on', trace: 'off' }],
test('checkout', { video: 'on' }, ...);
Smaller changes
specVersionis removed. A config that sets it fails withINVALID_CONFIG; the runner version is the format version. The report's internalspecVersionis unchanged.testsaccepts!exclusions (['tests/**/*.e2e.ts', '!tests/wip/**']). A list of only exclusions isINVALID_CONFIG.- Renames:
TraceCacheStorebecomesCacheStore, "trace cache" becomes "replay cache" in docs and CLI help, andweb({ video: { size, quality } })becomesweb({ screencast }).web({ video })fails namingscreencast. secrets.get('name')works in engine options:- At config time it returns a deferred handle that carries only the name. The config load checks the name, with a did-you-mean.
- The worker resolves it per attempt through the new
EngineAttemptContext.resolveSecret, and the value joins the redaction ledger first. web({ basicAuth: { password } })accepts a Secret.
process.loadEnvFile('.env')is documented as the way to load env files.
secrets: { stagingPassword: () => process.env.STAGING_PASSWORD! },
targets: [{ engine: web({ basicAuth: { username: 'staging', password: secrets.get('stagingPassword') } }) }],
Verified
Ran it locally: yes
- Built CLI in the testbed:
--output .e2e-verifywrote the report, junit and markdown files there and cleared a stale artifact.--trace=retain-on-failurekept no traces for passing tests, and--tracekepttrace/trace.zipper attempt.--output .and--artifactsexit 2 with the expected messages.
- Built CLI in the testbed with a scratch config:
specVersionis rejected.!exclusions select the right files, and an exclusions-only list fails.web({ video })namesscreencast.- An unknown
secrets.get()name gets a did-you-mean. e2e cache --helpsays "replay cache".
- New
engine-secrets.test.ts: a real config, workers, and a browser. A provider-backed basic-auth password echoed by the page is redacted from the failure message, the report, and the reporter files. It fails when the ledger registration is removed from the builtdist.