@aarwitz/tapp 0.16.5 → 0.17.0-rc.10

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.
@@ -0,0 +1,75 @@
1
+ # Browser Release Studio
2
+
3
+ Status: current local-product contract as of 2026-08-08.
4
+
5
+ The browser Release Studio is an **optional local workspace**, not the current launch surface — the
6
+ **npm package (CLI + MCP + the GitHub Action) is the current objective** (ADR-0005). The Studio, the
7
+ VS Code extension, the desktop app, and the future managed SaaS are separate/paused tracks. Web is
8
+ also one application target beside iOS and Android; it is not a separate QA product. CLI, MCP, VS
9
+ Code, the Action, desktop, and future managed SaaS all adapt the shared product operations described
10
+ in [`PRODUCT-ENGINE.md`](PRODUCT-ENGINE.md).
11
+
12
+ ## Start locally
13
+
14
+ ```bash
15
+ npx -y @aarwitz/tapp app
16
+ ```
17
+
18
+ Tapp prints an authenticated one-time launch URL and opens it in the default browser. Use
19
+ `--no-open` when copying the URL manually and `--port 4317` only when a fixed loopback port is
20
+ needed. Drag/drop or Browse Folder copies source into a Tapp-owned workspace. Connect GitHub lists
21
+ repositories authorized to the local `gh` session and makes a shallow isolated clone.
22
+ `tapp app /path/to/repo` intentionally works directly in that checkout.
23
+
24
+ The local server binds to `127.0.0.1`. It owns workspace paths; browser requests cannot submit an
25
+ arbitrary server path. Mutations require an `HttpOnly` same-site session cookie, the exact local
26
+ Origin, and an in-memory CSRF token. Application runtimes, repository credentials, and evidence stay
27
+ in the local process/filesystem. This is a local trust boundary, not hosted multi-tenancy.
28
+
29
+ ## Product journey
30
+
31
+ 1. **Connect** a copied folder, an explicit checkout, or a repository authorized by local `gh`.
32
+ 2. **Detect and choose** an iOS, Android, or web target. Continue automatically only when the target
33
+ and configuration are conclusive.
34
+ 3. **Build, launch, and explore** the real simulator, emulator/device, or browser surface.
35
+ 4. **Understand the UI Map** through observed states, transitions, controls, provenance, and gaps.
36
+ 5. **Review intent** by approving, rejecting, deferring, or constraining a compact release plan.
37
+ 6. **Generate drafts** of Tasks and contracts. Drafts remain visibly untrusted.
38
+ 7. **Validate** approved drafts deterministically against the real target.
39
+ 8. **Promote** only validated artifacts into the canonical suite and refreshed Application Model.
40
+ 9. **Gate** with autonomous evidence plus the promoted deterministic suite.
41
+ 10. **Baseline** only a passing, conclusive, target-scoped gate.
42
+ 11. **Install CI** by previewing and writing a reviewable repository patch. Tapp does not commit,
43
+ push, create GitHub secrets, or enable branch protection.
44
+
45
+ Successful semantic actions can be saved in `.tapp/flows/`; credential values are templated to
46
+ environment references. Long-lived repository artifacts store binding names, not resolved secret
47
+ values.
48
+
49
+ ## Verified reference journey
50
+
51
+ `tests/browser-journey.test.js` drives the visible local browser against a fresh CommerceDemo copy.
52
+ It exercises startup, a real live web surface and semantic action, UI Map creation, Flow recording
53
+ and replay, proposal review, generation, deterministic validation, promotion, a first gate,
54
+ baseline-aware rerun, and CI preview.
55
+
56
+ The opt-in `tests/browser-native-journey.test.js` passed on 2026-08-06 against a booted iOS
57
+ simulator: the browser built and installed a disposable DemoApp checkout, ran shared target
58
+ preparation and exploration, rendered an observed UI Map, drove the live surface, and saved a
59
+ repository-native iOS Flow. The equivalent Android browser journey was not verified in that audit
60
+ because no emulator/device was connected.
61
+
62
+ This evidence proves representative local journeys. It does not prove arbitrary frameworks,
63
+ production credentials, third-party services, hosted execution, or complete inference of business
64
+ intent.
65
+
66
+ ## Hosted relationship
67
+
68
+ The future hosted application will present the same product journey through a different adapter: application
69
+ accounts/organizations, GitHub App repository authorization, private storage, a durable queue, and
70
+ isolated managed workers. It cannot reuse the loopback session, local `gh` authority, filesystem
71
+ boundary, or in-memory ownership assumptions.
72
+
73
+ The old hosted preview and `cloud/` prototype do not satisfy this boundary. The managed SaaS is a
74
+ separate, paused track (see the private source repository); do not market or accept private
75
+ repositories until its readiness gate passes.
@@ -0,0 +1,107 @@
1
+ # One Tapp product engine
2
+
3
+ Status: current product-engine contract as of 2026-08-08.
4
+
5
+ Tapp has several interfaces, not several products. The source of truth for customer-critical
6
+ operations is [`mcp-server/src/product-operations.js`](../mcp-server/src/product-operations.js).
7
+ An interface may validate its transport and render a result; it must not redefine onboarding,
8
+ review, trust, baseline, or gate semantics.
9
+
10
+ ## Product operation contract
11
+
12
+ The shared engine owns these operations:
13
+
14
+ | Operation | Authoritative result |
15
+ |---|---|
16
+ | `initializeProductProject` | detected targets, real exploration, Application Model, UI Map, release plan |
17
+ | `readProductProject` | one current, read-only product snapshot for any interface |
18
+ | `reviewProductPlan` | explicit approve/reject/defer decisions |
19
+ | `generateProductPlan` | compile-checked but untrusted Task/contract drafts |
20
+ | `validateProductPlan` | real-target, deterministic replay evidence |
21
+ | `promoteProductPlan` | canonical Tasks/contracts, refreshed model/plan, updated map coverage |
22
+ | `prepareProductCi` / `installProductCi` | target-aware workflow and machine-readable CI manifest |
23
+ | `runProductGate` | autonomous evidence plus the committed deterministic suite and one gate decision |
24
+ | `createProductBaseline` | conclusive, platform-and-target-specific comparison state |
25
+
26
+ Deterministic contract execution is in
27
+ [`mcp-server/src/product-execution.js`](../mcp-server/src/product-execution.js). It invokes platform
28
+ executors directly; MCP does not shell through the CLI, and the browser does not shell through MCP.
29
+
30
+ ## Interfaces
31
+
32
+ ```text
33
+ Browser Release Studio ─┐
34
+ CLI ├── product-operations ── application model / UI Map / Tasks / contracts
35
+ MCP ┘ │
36
+ └── deterministic executors / portable gate / evidence
37
+
38
+ VS Code ── MCP client
39
+ Desktop ── canonical artifact reader (migration to operation client remains)
40
+ Action ── portable gate adapter
41
+ Hosted ── tenant-aware SaaS adapter + queued isolated shared-operation workers (not built)
42
+ ```
43
+
44
+ Current convergence:
45
+
46
+ - the browser calls only shared product operations;
47
+ - CLI initialization, plan lifecycle, deterministic draft validation, promotion, gate/baseline
48
+ lifecycle, and CI installation call the same operations. Native build preparation remains at the
49
+ adapter boundary and passes a resolved `.app` or APK into the shared gate;
50
+ - MCP initialization, plan lifecycle, deterministic draft validation, promotion, baseline, and CI
51
+ installation call the same operations;
52
+ - the GitHub Action and `runProductGate` call the same portable gate and evidence protocol;
53
+ - VS Code remains a thin MCP client;
54
+ - desktop reads the same `.tapp` artifacts but still has legacy import/build orchestration. It is
55
+ retained, not the launch UX, until that orchestration is removed;
56
+ - `cloud/runner` is retained prototype evidence for exact checkout, versioned operation envelopes,
57
+ leases, and cleanup. It is not the production hosted adapter or an adequate arbitrary-customer
58
+ isolation boundary. The new SaaS must call these shared operations only through a tenant-aware,
59
+ queued worker contract (defined in the private source repository's SaaS architecture doc).
60
+
61
+ ## Canonical repository protocol
62
+
63
+ New product behavior writes only `.tapp/`:
64
+
65
+ ```text
66
+ .tapp/
67
+ project.json # actors, env binding names, controlled lifecycle; never secret values
68
+ application-model.json # detected/observed/declared product facts
69
+ ui-map.json # grounded screen/action/transition graph
70
+ release-plan.json # proposals and explicit human decisions
71
+ tasks/ # reusable deterministic semantic operations
72
+ contracts/ # reviewed business guarantees
73
+ baselines/<platform>/ # conclusive target-specific comparison state
74
+ ci.json # generated CI installation manifest
75
+ ```
76
+
77
+ `.tapp.yml` is the canonical run configuration, and `.tapp/` holds repository artifacts. These are
78
+ the only names the runtime reads; the pre-rename `.autotap.yml`, `.autotap/`, and `AUTOTAP_*` inputs
79
+ are no longer supported. Do not add another configuration format, and do not reintroduce a legacy
80
+ reader. Only an explicit reviewed operation may write new repository artifacts.
81
+
82
+ ## Anti-duplication rules
83
+
84
+ 0. Exploration (`explore`, formerly `qa`) observes and surfaces findings + evidence + UI Map; it must
85
+ not render a release outcome. Only the gate (`runProductGate`) applies versioned deterministic
86
+ policy to findings + coverage + selected suites + an optional baseline and computes
87
+ `pass | fail | inconclusive` (ADR-0005, in the private source repository).
88
+ 1. Trust states (`pending`, `approved`, `validated-draft`, `promoted`) are computed by the engine.
89
+ 2. Interfaces render `readProductProject`; they do not infer readiness from file existence.
90
+ 3. Re-exploration refreshes evidence while preserving reviewed decisions everywhere.
91
+ 4. Promotion refreshes the Application Model immediately; no interface may show stale pre-promotion
92
+ requirements.
93
+ 5. Baselines are identified by platform and stable target id everywhere.
94
+ 6. An adapter-specific feature is not complete until its engine operation is useful without that
95
+ adapter.
96
+ 7. Equivalence tests should assert artifacts and structured results, not merely matching copy.
97
+
98
+ ## Remaining migration
99
+
100
+ The next safe convergence work is deliberately narrow:
101
+
102
+ 1. replace desktop import/build orchestration with a local product-operation client;
103
+ 2. delete the two desktop detection/scaffolding paths only after equivalence fixtures pass;
104
+ 3. implement managed account, organization, and tenant authorization before connecting repositories;
105
+ 4. implement scoped GitHub authorization, private evidence, and disposable per-job
106
+ identity/simulator/credential isolation before accepting customer code;
107
+ 5. preserve CLI/MCP/VS Code/Action as adapters—do not rebuild their product logic.
@@ -0,0 +1,278 @@
1
+ # Application model and `tapp init`
2
+
3
+ `tapp init` is the deterministic import, exploration, and planning entrypoint of Tapp's customer
4
+ journey. It turns a repository into three platform-neutral, repository-native artifacts:
5
+
6
+ - `.tapp/ui-map.json` — observed UI states, controls, and transitions from real exploration;
7
+ - `.tapp/application-model.json` — what Tapp can support with evidence;
8
+ - `.tapp/release-plan.json` — the compact set of committed and proposed business guarantees a
9
+ customer must review before generation.
10
+
11
+ Plain `tapp init` performs source/artifact inspection only. `tapp init --explore` additionally uses
12
+ the same keyless QA engine as `tapp explore` to build/install/launch or connect to one selected real
13
+ target, merge the observed map, and construct the model and plan from that runtime evidence. It
14
+ does not generate or approve tests, call AI, or claim contract validation. When iOS repository
15
+ resolution actually builds and installs the detected Xcode container, the model records the exact
16
+ scheme as runtime-observed validation and removes the corresponding confirmation blocker. Merely
17
+ supplying a bundle id or prebuilt `.app` does not prove repository build configuration.
18
+
19
+ A fresh repository with more than one detected application target is never resolved by detection
20
+ order. Bare `tapp init . --explore` prompts in a human TTY; non-interactive CLI/MCP callers receive
21
+ exact `--platform`/`--target` commands before any build or write, and MCP also carries them as
22
+ structured `target-selection-required` choices. The selected run records that target as the default
23
+ for later bare exploration, but the application model retains the repository's other detected targets
24
+ and their unmet coverage.
25
+
26
+ ## First inspection
27
+
28
+ ```bash
29
+ # Read-only preview. For web, provide the owned runtime URL if already known.
30
+ tapp init . --url http://127.0.0.1:3000 --dry-run \
31
+ --json-out /tmp/tapp-init-preview.json
32
+
33
+ # Create canonical artifacts. Existing files are never overwritten implicitly.
34
+ tapp init . --url http://127.0.0.1:3000
35
+
36
+ # Build/start the detected web target, explore it, persist its UI Map, then stop it.
37
+ tapp init . --explore --platform web --actions 40 --timeout 600
38
+
39
+ # Or connect to an already-running owned environment.
40
+ tapp init . --explore --platform web --url http://127.0.0.1:3000 \
41
+ --actions 40 --timeout 600
42
+
43
+ # iOS can resolve a repository/Xcode container/.app/bundle id and build when needed.
44
+ tapp init . --explore --platform ios --target .
45
+
46
+ # Android can install an APK, then launch the explicit application id.
47
+ tapp init . --explore --platform android \
48
+ --apk app/build/outputs/apk/debug/app-debug.apk --app-id com.acme.app
49
+
50
+ # Re-inspect after source/UI Map changes while preserving explicit review decisions.
51
+ tapp init . --url http://127.0.0.1:3000 --refresh
52
+
53
+ # Re-explore after review without losing approve/reject/defer choices.
54
+ tapp init . --refresh --explore --platform web --url http://127.0.0.1:3000
55
+ ```
56
+
57
+ MCP clients use `tapp_init` with `operation: inspect|write|refresh|explore`. `inspect` is the safe
58
+ default. `explore` writes real evidence, so the CLI rejects `--explore --dry-run`; the CLI also
59
+ refreshes existing model/plan artifacts through the same decision-preserving semantics. Credentials
60
+ are passed only to the runtime and are never written into the model, map, or plan.
61
+
62
+ Successful repository-driven iOS build validation is portable and durable. The application model
63
+ stores the repository-relative container, scheme, configuration, bundle id, and a
64
+ `tapp-capture:<id>` evidence reference—never the local DerivedData or checkout path. A later
65
+ source-only `tapp init --refresh` retains that validation when it still names the same detected
66
+ container. Tapp does not infer equivalent proof from an installed application, an explicit bundle
67
+ id, or a prebuilt artifact; those paths can demonstrate runtime reachability but cannot silently
68
+ confirm the repository's Xcode scheme.
69
+
70
+ ## Actors and credential bindings
71
+
72
+ Configure named actors once instead of repeating credentials or session policy across tests:
73
+
74
+ ```bash
75
+ tapp actor set alice . --role member --session isolated --provisioning seeded \
76
+ --credential email=ALICE_EMAIL --credential password=ALICE_PASSWORD
77
+ tapp actor set bob . --role member --session isolated --provisioning seeded \
78
+ --credential email=BOB_EMAIL --credential password=BOB_PASSWORD
79
+ tapp actor list .
80
+ tapp init . --refresh
81
+ ```
82
+
83
+ This writes `.tapp/project.json`. The file contains roles, `default`/`isolated` session policy,
84
+ provisioning mode, same-origin lifecycle declarations, and environment-variable *names*. The CLI
85
+ and MCP `tapp_actor_config` reject credential values and refuse to replace an actor without an
86
+ explicit `--replace`/`replace: true`. Contracts refer to `$ALICE_EMAIL`-style placeholders. Tapp
87
+ merges those reviewed placeholders with the central configuration, blocks missing/conflicting
88
+ bindings, and never copies resolved values into the application model, release plan, UI Map, CI
89
+ manifest, or generated workflow.
90
+
91
+ When web `--url` is omitted, Tapp selects one detected browser target, runs only its internally
92
+ derived lockfile-backed install command, runs its declared build script when present, and starts its
93
+ `start`, `dev`, `serve`, or `preview` package script with argument-array process execution (never
94
+ generated shell source). A static site with no script uses Tapp's local read-only static server. The
95
+ runtime binds to an available loopback port, writes its log under the Tapp runtime directory, and is
96
+ terminated after exploration even when QA fails. Multiple web targets, an unlocked dependency
97
+ graph, an unrecognized start path, or backend-specific configuration produce explicit remediation;
98
+ provide `--target` and/or an already-running owned `--url` in those cases. Running repository build
99
+ scripts executes repository code and should only be used for a checkout the customer trusts.
100
+ The managed loop never persists its ephemeral loopback URL as customer configuration. The model
101
+ records `runtime.management: tapp-managed`, and the portable gate/Action reconstructs the same
102
+ start/wait/stop lifecycle later. An explicitly supplied owned URL remains `customer-managed`.
103
+
104
+ ## What the model records
105
+
106
+ Application Model v1 records:
107
+
108
+ - detected iOS simulator, Android application, and browser targets;
109
+ - inspectable build commands, project/module/container paths, scheme candidates, application ids,
110
+ owned URLs, missing confirmations, and exact runtime-observed target validation where Tapp itself
111
+ completed the repository build/install path;
112
+ - actors, roles, provisioning modes, credential requirements/environment bindings, and
113
+ session-isolation boundaries without credential values;
114
+ - business entities and capabilities explicitly declared by reviewed contracts or conservatively
115
+ derived from reusable Task names;
116
+ - authored critical journeys, revenue paths, and cross-actor system invariants;
117
+ - the shared UI Map's observed state/transition/control counts and uncovered ids;
118
+ - the latest import exploration's finding count and explicit inconclusive status, when available;
119
+ - existing Tasks and contracts;
120
+ - blocking requirements and exact remediation.
121
+
122
+ Every fact identifies its evidence class. The current deterministic importer uses:
123
+
124
+ - `source-observed` for repository files and build metadata;
125
+ - `runtime-observed` for a successful exact target build/install/exploration, with portable evidence;
126
+ - `reviewed-artifact` for committed Tasks, contracts, and UI Map evidence;
127
+ - `task-derived` or another source-derived status when a fact still requires review;
128
+ - `authored-unvalidated` when a committed contract exists without current-revision replay proof.
129
+
130
+ Runtime observation, source inference, optional AI proposals, and human decisions must not be
131
+ collapsed into one confidence label. The artifact explicitly records that remote AI was not used.
132
+
133
+ ## Release-plan quality
134
+
135
+ The deterministic planner starts with committed contracts, then proposes only evidence-grounded
136
+ gaps:
137
+
138
+ - a conservative cross-actor propagation guarantee when two explicitly configured isolated actors,
139
+ deterministic setup/teardown, compatible authentication/precondition screens, and an exact
140
+ content-producing Task output jointly prove that the proposal is grounded;
141
+ - reusable Tasks not composed by a reviewed contract;
142
+ - uncovered UI states carrying business signals such as authentication, pricing, checkout,
143
+ account, messaging, or settings behavior.
144
+
145
+ Error pages, blank pages, loading surfaces, changelogs, and generic feature-description pages remain
146
+ visible as UI Map coverage gaps but do not automatically become business contracts. The target is
147
+ approximately 5–15 contracts for a sufficiently rich product, not an artificial quota for a small
148
+ fixture. Every proposal includes business value, risk, criticality, actors, platforms, grounding,
149
+ and the real-surface validation required before it can be trusted.
150
+
151
+ ## Explicit review
152
+
153
+ ```bash
154
+ tapp plan show .tapp/release-plan.json
155
+ tapp plan review .tapp/release-plan.json \
156
+ --approve signInWorks,checkoutWorks \
157
+ --reject marketingPageReachable \
158
+ --defer adminAuditWorks
159
+
160
+ # Only after review: generate grounded Task + contract drafts under .tapp/proposals/.
161
+ tapp plan generate .tapp/release-plan.json --project-dir .
162
+
163
+ # Replay the draft on the real target and attach evidence to the plan.
164
+ # Omit --url to build/start/stop the detected managed browser target.
165
+ tapp plan validate .tapp/release-plan.json --project-dir . --platform web
166
+ # Or connect to an already-running owned environment.
167
+ tapp plan validate .tapp/release-plan.json --project-dir . \
168
+ --platform web --url http://127.0.0.1:3000
169
+
170
+ # Explicitly accept only fully validated drafts into canonical reviewed locations.
171
+ tapp plan promote .tapp/release-plan.json --project-dir . \
172
+ --item checkoutWorks
173
+ ```
174
+
175
+ The MCP equivalent is `tapp_release_plan` with `read|review|generate|validate|promote`. Review
176
+ changes decision metadata only. It cannot silently
177
+ edit a Task, contract, selector, or assertion. On `tapp init --refresh`, decisions, constraints, and
178
+ review notes are carried forward by stable item id; reviewed items no longer derived from current
179
+ evidence are retained and marked stale instead of disappearing.
180
+
181
+ A source-only refresh preserves recorded replay evidence. `tapp init --refresh --explore` carries
182
+ the history forward but invalidates trust for affected generated Tasks and contracts: prior
183
+ platform results move to historical evidence, status becomes `requires-revalidation`, and replay is
184
+ required before the draft can be trusted against the newly observed revision. Exploration never
185
+ silently self-heals or accepts the prior selector path.
186
+
187
+ The macOS desktop Coverage experience reads these same files. Its **Application** tab explains
188
+ detected targets, actors, capabilities, journeys, Tasks, contracts, and exact remediation. Its
189
+ **Release Plan** tab writes explicit approve/reject/defer decisions atomically into the canonical
190
+ plan while preserving fields from newer engine versions; committed contract intent is not editable
191
+ through these proposal controls. Flow Map merges the repository `.tapp/ui-map.json` with current
192
+ run evidence instead of building a separate desktop-only graph.
193
+
194
+ Schema compatibility is exercised by the repository's protocol tests and retained desktop reader.
195
+
196
+ `plan generate` handles only explicitly approved proposals. Grounded cross-actor proposals preserve
197
+ actor-attributed Task calls, captured output variables, bounded eventual assertions, and the
198
+ reviewed project lifecycle, then compile through the isolated Scenario executor. Existing
199
+ Task-backed proposals compose those reviewed Tasks. For UI-Map-only proposals, it finds an observed path from each platform's
200
+ recorded entry state, deduplicates shared semantic transitions into compositional Task drafts under
201
+ `.tapp/proposals/tasks/`, grounds every Task in exact node/edge ids, and writes the contract draft
202
+ under `.tapp/proposals/contracts/`. Proposal Tasks are visible only to proposal contracts; an
203
+ ordinary committed contract or CI glob cannot silently consume one.
204
+
205
+ Generation blocks when entry-state evidence is missing, the target is unreachable, an observed
206
+ action cannot be represented deterministically, or platform paths require incompatible semantic
207
+ composition. It never overwrites a draft, statically compiles each declared platform, and marks all
208
+ outputs untrusted. Missing non-secret Task inputs stay blocked until the plan has explicit bindings;
209
+ standard email/password secrets remain placeholders. Successful grounding and compilation are not
210
+ real-surface evidence and never promote drafts into `.tapp/tasks` or `.tapp/contracts`.
211
+
212
+ `plan validate` invokes the ordinary deterministic contract executor and records pass/fail evidence
213
+ per declared platform. A multi-platform draft remains only partially validated until every declared
214
+ platform passes. Failed replay remains visible and sets `trusted: false`; there is no selector
215
+ substitution or automatic assertion update.
216
+
217
+ `plan promote` is the explicit acceptance boundary. It refuses any contract or generated Task that
218
+ has not passed every declared platform, preflights every destination, never overwrites a reviewed
219
+ artifact, moves accepted files from `.tapp/proposals/{tasks,contracts}` into
220
+ `.tapp/{tasks,contracts}`, and applies their exact node/edge coverage to the canonical UI Map.
221
+ Shared Task paths in still-unpromoted proposals are rewritten to the canonical file. Promotion does
222
+ not commit, push, or install CI; the resulting repository patch remains reviewable by the customer.
223
+
224
+ ## Baseline and CI handoff
225
+
226
+ After promotion, complete the local onboarding loop with:
227
+
228
+ ```bash
229
+ # Runs the ordinary exploration + committed suites gate. Builds native targets when possible;
230
+ # web targets can be detected, built, started, awaited, and stopped without a durable URL.
231
+ tapp baseline create . --platform web
232
+
233
+ # Or import an already-retained successful full-gate report after review.
234
+ tapp baseline create . --platform web --from /path/to/tapp-report.json
235
+
236
+ # Generate one target-aware job per model target plus a machine-readable manifest.
237
+ tapp ci install . --action-ref aarwitz/tapp@v0.13.1
238
+ ```
239
+
240
+ Baseline creation rejects non-gate JSON, missing or mismatched target identity, platform mismatch,
241
+ failed Flows/Scenarios/contracts, `blocked`, and `inconclusive`. It writes atomically to
242
+ `.tapp/baselines/<platform>/<target-id>.json` and requires `--replace` to supersede reviewed
243
+ evidence. Capture-local paths are replaced with portable `tapp-capture:` references before the
244
+ repository artifact is written. The gate also checks baseline platform and target identity before
245
+ comparing findings. On iOS, the same validated launch arguments and string-valued launch
246
+ environment are passed to autonomous exploration and deterministic Flow/contract replay; invalid
247
+ JSON or unsupported value types fail before execution rather than silently testing different app
248
+ configurations.
249
+
250
+ CI installation writes `.github/workflows/tapp.yml` and `.tapp/ci.json`, never overwrites by
251
+ default, and refuses unresolved iOS schemes, Android ids, browser lockfiles, or runtimes. The
252
+ workflow uses exact contract paths, maps each actor environment binding to a same-named GitHub
253
+ Secret, uses the first/default actor for autonomous-login inputs, preserves the remaining bindings
254
+ for deterministic multi-actor replay, and supports managed web startup, Android emulator
255
+ provisioning, and the target-specific baseline. It does not commit,
256
+ push, enable branch protection, or create remote resources. Use MCP `tapp_ci_setup` for the same
257
+ read-only render, baseline import, and guarded install engine.
258
+
259
+ ## Current boundary
260
+
261
+ Repository detection, one-target real exploration, first-map merge, evidence classification,
262
+ runtime-observed iOS scheme confirmation, durable source-only refresh, deterministic planning, safe
263
+ persistence, approve/reject/defer review, and compile-checked Task-backed draft generation are
264
+ implemented. An empty map or a latest exploration marked inconclusive remains a blocking
265
+ requirement; observing a login wall is not treated as useful coverage.
266
+
267
+ `tapp init` does not yet orchestrate every detected target in one invocation, provision arbitrary
268
+ web backends/services, automatically replay every approved draft, or promote validated drafts without
269
+ explicit customer acceptance. Baseline creation and a reviewable per-target GitHub CI patch are now
270
+ implemented as explicit post-promotion commands, but the generated workflow has not yet passed on
271
+ current GitHub-hosted iOS, Android, and web runners. Task generation currently handles observed
272
+ reachable navigation. Deterministic business planning is deliberately limited to cross-actor
273
+ content propagation and one checkout-to-order-history persistence pattern supported by exact Task
274
+ input/output, screen, actor, UI Map, and lifecycle evidence. General forms, broader payment shapes,
275
+ dynamic value capture, messaging/reactions, role-asymmetric invariants, and incompatible platform
276
+ journeys still require reviewed authoring. Optional
277
+ AI business reasoning is also not wired into this path. Those missing stages remain completion
278
+ blockers.
@@ -0,0 +1,95 @@
1
+ # Multi-actor Scenarios
2
+
3
+ A Scenario is Tapp's low-level deterministic multi-actor execution format in `.tapp/scenarios/*.yml`. It uses the same semantic actions, polling assertions, timeouts, evidence markers, and merge policy as a Flow, but adds isolated named actors, shared variables, and explicit lifecycle steps. The customer-facing business authoring layer is a TypeScript **release contract**, which composes reusable Tasks and compiles to this runtime instead of duplicating UI steps.
4
+
5
+ Ordinary replay is keyless. AI may propose a Scenario during authoring, but no model, API key, or coding agent participates when CI executes it.
6
+
7
+ ## Current support
8
+
9
+ Web replay is implemented through one isolated Playwright browser context per actor. Cookies, local storage, and in-browser session state cannot leak between actors; all contexts point at the same deployed application and backend. The Action, portable gate, CLI, and MCP surface all consume the same file.
10
+
11
+ iOS and Android still support sequential account switching inside ordinary Flows, but do not yet have first-class isolated multi-actor Scenario drivers. Tapp rejects those platform combinations instead of presenting sequential login/logout as equivalent proof.
12
+
13
+ ## Contract
14
+
15
+ ```yaml
16
+ name: Alice publishes and Bob sees it
17
+ kind: scenario
18
+ platform: web
19
+ url: http://127.0.0.1:4180
20
+ timeoutMs: 6000
21
+ vars: # shared deterministic data
22
+ POST: Scenario post 7319
23
+ actors:
24
+ alice:
25
+ vars: # actor-scoped credentials/session inputs
26
+ EMAIL: alice@example.test
27
+ PASSWORD: demo
28
+ bob:
29
+ vars:
30
+ EMAIL: bob@example.test
31
+ PASSWORD: demo
32
+ setup:
33
+ - request: # bounded, same-origin HTTP; never arbitrary shell
34
+ method: POST
35
+ path: /__tapp/reset
36
+ status: 200
37
+ steps:
38
+ - actor: alice
39
+ type: { field: Email, value: $EMAIL }
40
+ - actor: alice
41
+ type: { field: Password, value: $PASSWORD }
42
+ - actor: alice
43
+ tap: Sign in
44
+ - actor: alice
45
+ type: { field: Post text, value: $POST }
46
+ - actor: alice
47
+ tap: Publish
48
+ - actor: bob
49
+ assert_exists: { target: $POST, timeoutMs: 6000 }
50
+ teardown:
51
+ - request: { method: POST, path: /__tapp/reset, status: 200 }
52
+ ```
53
+
54
+ - `actors` must contain at least two names. Every journey step names one of them.
55
+ - Actor variables override shared variables. A committed value such as `$ALICE_PASSWORD` resolves only that explicitly referenced environment variable at run time; Tapp does not serialize the surrounding environment.
56
+ - `setup` and `teardown` currently accept bounded HTTP request steps on the target origin. Teardown runs after a journey failure so state is still cleaned up.
57
+ - Flow assertions poll until their bounded timeout. This models eventual consistency without blind sleeps or unbounded retries. A condition that never becomes true fails visibly.
58
+ - Typed values are not written to step evidence. Results include actor, action, selector, status, and error; failures capture that actor's screen and final screenshots for all actors.
59
+ - A failed Scenario always blocks the release gate, independently of whether autonomous single-user exploration found a problem.
60
+
61
+ ## Run it
62
+
63
+ ```bash
64
+ tapp scenario validate .tapp/scenarios/social-system.yml
65
+ ALICE_EMAIL=alice@example.test ALICE_PASSWORD=demo \
66
+ BOB_EMAIL=bob@example.test BOB_PASSWORD=demo \
67
+ tapp scenario run .tapp/scenarios/social-system.yml
68
+
69
+ tapp ci --platform web --url http://127.0.0.1:4180 \
70
+ --scenarios '.tapp/scenarios/*.yml' \
71
+ --json-out tapp-report.json --md-out tapp-report.md
72
+ ```
73
+
74
+ GitHub Action:
75
+
76
+ ```yaml
77
+ - uses: aarwitz/tapp@main
78
+ with:
79
+ platform: web
80
+ url: http://127.0.0.1:4180
81
+ scenarios: .tapp/scenarios/*.yml
82
+ ```
83
+
84
+ MCP clients call `tapp_scenario_run` with `scenarioPath`, or an inline reviewed Scenario. The structured result identifies `kind: scenario`, actual executed/total steps, and actor-tagged steps.
85
+
86
+ ## Verified fixture and boundaries
87
+
88
+ `SocialDemo/.tapp/contracts/social-system.contract.ts` is the reference system guarantee; the Scenario remains its low-level execution proof and backwards-compatible escape hatch. On 2026-08-04 the contract passed 41/41 compiled steps using two isolated contexts against one delayed shared backend. With `SOCIAL_DEMO_FAULT=hide-cross-actor-posts`, the unchanged contract failed for Bob at 19/41 and the portable merge gate exited non-zero specifically because one release contract failed.
89
+
90
+ The fixture's `.tapp/project.json` is the central actor contract. It records Alice and Bob's
91
+ roles, isolated sessions, seeded provisioning, reset lifecycle, and four environment-variable
92
+ names. The release contract and Scenario consume those names; neither stores the public fixture
93
+ values. Customer values belong in the local environment or CI secret store.
94
+
95
+ This proves the contract and web implementation, not universal multi-user reliability. Real customers still need reset/provisioning hooks or dedicated test data, enough accessibility semantics to select controls, and a test backend whose eventual-consistency budget is known.