@muggleai/works 5.24.0-staging.174 → 5.24.0-staging.176

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.
Files changed (34) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/{chunk-NOID65AF.js → chunk-C5MMZNZJ.js} +53 -10
  3. package/dist/{chunk-5ZCT7BYF.js → chunk-JERBZROI.js} +2 -2
  4. package/dist/cli.js +2 -2
  5. package/dist/index.js +2 -2
  6. package/dist/plugin/.claude-plugin/plugin.json +1 -1
  7. package/dist/plugin/.codex-mcp.json +1 -1
  8. package/dist/plugin/.codex-plugin/plugin.json +1 -1
  9. package/dist/plugin/.cursor-plugin/plugin.json +1 -1
  10. package/dist/plugin/.mcp.json +1 -1
  11. package/dist/plugin/skills/_shared/test-case-design.md +12 -0
  12. package/dist/plugin/skills/do/address-reviews.md +1 -1
  13. package/dist/plugin/skills/do/cleanup.md +6 -5
  14. package/dist/plugin/skills/do/e2e-acceptance.md +26 -11
  15. package/dist/plugin/skills/do/impact-analysis.md +69 -4
  16. package/dist/plugin/skills/do/wave-e2e.md +1 -1
  17. package/dist/plugin/skills/muggle-do/SKILL.md +2 -1
  18. package/dist/plugin/skills/muggle-test/SKILL.md +2 -10
  19. package/dist/release-manifest.json +3 -3
  20. package/dist/{src-LD2BVJE4.js → src-XCMPDHPJ.js} +1 -1
  21. package/package.json +1 -1
  22. package/plugin/.claude-plugin/plugin.json +1 -1
  23. package/plugin/.codex-mcp.json +1 -1
  24. package/plugin/.codex-plugin/plugin.json +1 -1
  25. package/plugin/.cursor-plugin/plugin.json +1 -1
  26. package/plugin/.mcp.json +1 -1
  27. package/plugin/skills/_shared/test-case-design.md +12 -0
  28. package/plugin/skills/do/address-reviews.md +1 -1
  29. package/plugin/skills/do/cleanup.md +6 -5
  30. package/plugin/skills/do/e2e-acceptance.md +26 -11
  31. package/plugin/skills/do/impact-analysis.md +69 -4
  32. package/plugin/skills/do/wave-e2e.md +1 -1
  33. package/plugin/skills/muggle-do/SKILL.md +2 -1
  34. package/plugin/skills/muggle-test/SKILL.md +2 -10
@@ -9,7 +9,7 @@
9
9
  "name": "muggleai",
10
10
  "source": "./plugin",
11
11
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
12
- "version": "5.24.0-staging.174"
12
+ "version": "5.24.0-staging.176"
13
13
  }
14
14
  ]
15
15
  }
@@ -5668,6 +5668,44 @@ function mapOrganizationList(response) {
5668
5668
  };
5669
5669
  }
5670
5670
 
5671
+ // packages/mcps/src/mcp/tools/e2e/secret-metadata-transform.ts
5672
+ function mapSecretList(response) {
5673
+ if (!Array.isArray(response.data)) {
5674
+ throw new GatewayError({
5675
+ code: "UPSTREAM_ERROR" /* UPSTREAM_ERROR */,
5676
+ message: `Secret list response was not an array (got ${typeof response.data}).`,
5677
+ statusCode: response.statusCode
5678
+ });
5679
+ }
5680
+ return response.data.map(toSecretMetadata);
5681
+ }
5682
+ function mapSecret(response) {
5683
+ const isSingleSecret = typeof response.data === "object" && response.data !== null && !Array.isArray(response.data);
5684
+ if (!isSingleSecret) {
5685
+ throw new GatewayError({
5686
+ code: "UPSTREAM_ERROR" /* UPSTREAM_ERROR */,
5687
+ message: `Secret response was not a single secret (got ${Array.isArray(response.data) ? "array" : typeof response.data}).`,
5688
+ statusCode: response.statusCode
5689
+ });
5690
+ }
5691
+ return toSecretMetadata(response.data);
5692
+ }
5693
+ function toSecretMetadata(upstreamSecret) {
5694
+ return {
5695
+ id: upstreamSecret.id,
5696
+ projectId: upstreamSecret.projectId,
5697
+ secretName: upstreamSecret.secretName,
5698
+ description: upstreamSecret.description,
5699
+ source: upstreamSecret.source,
5700
+ createdAt: upstreamSecret.createdAt,
5701
+ createdBy: upstreamSecret.createdBy,
5702
+ lastModifiedAt: upstreamSecret.lastModifiedAt,
5703
+ lastModifiedBy: upstreamSecret.lastModifiedBy,
5704
+ lastAccessedAt: upstreamSecret.lastAccessedAt,
5705
+ lastAccessedBy: upstreamSecret.lastAccessedBy
5706
+ };
5707
+ }
5708
+
5671
5709
  // packages/mcps/src/mcp/tools/e2e/test-runs-summary-transform.ts
5672
5710
  var UNKNOWN_STATUS = "UNKNOWN";
5673
5711
  function slimEntry(raw) {
@@ -6737,7 +6775,7 @@ var reportTools = [
6737
6775
  var secretTools = [
6738
6776
  {
6739
6777
  name: "muggle-remote-secret-list",
6740
- description: "List all secrets for a project. Secret values are not returned for security.",
6778
+ description: "List all secrets for a project: each secret's id, name, description, source and timestamps. Secret values are never returned.",
6741
6779
  inputSchema: SecretListInputSchema,
6742
6780
  mapToUpstream: (input) => {
6743
6781
  const toolInput = input;
@@ -6746,11 +6784,12 @@ var secretTools = [
6746
6784
  path: `${MUGGLE_TEST_PREFIX}/secrets`,
6747
6785
  queryParams: { projectId: toolInput.projectId }
6748
6786
  };
6749
- }
6787
+ },
6788
+ mapFromUpstream: mapSecretList
6750
6789
  },
6751
6790
  {
6752
6791
  name: "muggle-remote-secret-create",
6753
- description: "Create a new secret (credential) for a project.",
6792
+ description: "Create a new secret (credential) for a project. Returns the created secret's metadata; the value is never echoed back.",
6754
6793
  inputSchema: SecretCreateInputSchema,
6755
6794
  mapToUpstream: (input) => {
6756
6795
  const toolInput = input;
@@ -6765,11 +6804,12 @@ var secretTools = [
6765
6804
  source: toolInput.source
6766
6805
  }
6767
6806
  };
6768
- }
6807
+ },
6808
+ mapFromUpstream: mapSecret
6769
6809
  },
6770
6810
  {
6771
6811
  name: "muggle-remote-secret-get",
6772
- description: "Get details of a specific secret. The secret value is not returned for security.",
6812
+ description: "Get a specific secret's metadata: id, name, description, source and timestamps. The secret value is never returned.",
6773
6813
  inputSchema: SecretGetInputSchema,
6774
6814
  mapToUpstream: (input) => {
6775
6815
  const toolInput = input;
@@ -6777,11 +6817,12 @@ var secretTools = [
6777
6817
  method: "GET",
6778
6818
  path: `${MUGGLE_TEST_PREFIX}/secrets/${toolInput.secretId}`
6779
6819
  };
6780
- }
6820
+ },
6821
+ mapFromUpstream: mapSecret
6781
6822
  },
6782
6823
  {
6783
6824
  name: "muggle-remote-secret-update",
6784
- description: "Update an existing secret.",
6825
+ description: "Update an existing secret. Returns the updated secret's metadata; the value is never echoed back.",
6785
6826
  inputSchema: SecretUpdateInputSchema,
6786
6827
  mapToUpstream: (input) => {
6787
6828
  const toolInput = input;
@@ -6794,11 +6835,12 @@ var secretTools = [
6794
6835
  path: `${MUGGLE_TEST_PREFIX}/secrets/${toolInput.secretId}`,
6795
6836
  body
6796
6837
  };
6797
- }
6838
+ },
6839
+ mapFromUpstream: mapSecret
6798
6840
  },
6799
6841
  {
6800
6842
  name: "muggle-remote-secret-delete",
6801
- description: "Delete a secret from a project.",
6843
+ description: "Delete a secret from a project. Returns the deleted secret's metadata; the value is never returned.",
6802
6844
  inputSchema: SecretDeleteInputSchema,
6803
6845
  mapToUpstream: (input) => {
6804
6846
  const toolInput = input;
@@ -6806,7 +6848,8 @@ var secretTools = [
6806
6848
  method: "DELETE",
6807
6849
  path: `${MUGGLE_TEST_PREFIX}/secrets/${toolInput.secretId}`
6808
6850
  };
6809
- }
6851
+ },
6852
+ mapFromUpstream: mapSecret
6810
6853
  }
6811
6854
  ];
6812
6855
  var prdFileTools = [
@@ -1,4 +1,4 @@
1
- import { __export, getLogger, getConfig, createChildLogger, buildElectronAppReleaseAssetUrl, getActiveRuntimeTarget, getAuthService, hasApiKey, getElectronAppVersion, getElectronAppDir, getPlatformKey, reconcileProjectPreferences, getDataDir, PREFERENCES_FILE_NAME, isFirstRun, writePreferences, DEFAULT_PREFERENCES, isElectronAppInstalled, getElectronAppChecksums, getChecksumForPlatform, getElectronAppSignedFromVersion, getReleaseSignerIdentityUri, verifyFileChecksum, resolveElectronAppExecutablePath, calculateFileChecksum, initTelemetry, Surface, ServiceName, track, EventName, getQaTools, getLocalQaTools, performLogout, assertDeviceCodeClientProvisioned, performLogin, toolRequiresAuth, getCallerCredentials, getElectronAppReleaseTagPrefix, hasShownDisclosure, markDisclosureShown, getBundledElectronAppVersion, getElectronAppVersionSource, getCredentialsFilePath, buildElectronAppChecksumsUrl, __require, getDisclosureCopy, buildOnboardingPlan, applyOnboardingAnswers, needsOnboarding, readRunView, RunViewError, renderRunViewText, writeRunViewHtml, openBrowserUrl, OnboardingBlanketChoice, PreferenceKey, resolvePreferences } from './chunk-NOID65AF.js';
1
+ import { __export, getLogger, getConfig, createChildLogger, buildElectronAppReleaseAssetUrl, getActiveRuntimeTarget, getAuthService, hasApiKey, getElectronAppVersion, getElectronAppDir, getPlatformKey, reconcileProjectPreferences, getDataDir, PREFERENCES_FILE_NAME, isFirstRun, writePreferences, DEFAULT_PREFERENCES, isElectronAppInstalled, getElectronAppChecksums, getChecksumForPlatform, getElectronAppSignedFromVersion, getReleaseSignerIdentityUri, verifyFileChecksum, resolveElectronAppExecutablePath, calculateFileChecksum, initTelemetry, Surface, ServiceName, track, EventName, getQaTools, getLocalQaTools, performLogout, assertDeviceCodeClientProvisioned, performLogin, toolRequiresAuth, getCallerCredentials, getElectronAppReleaseTagPrefix, hasShownDisclosure, markDisclosureShown, getBundledElectronAppVersion, getElectronAppVersionSource, getCredentialsFilePath, buildElectronAppChecksumsUrl, __require, getDisclosureCopy, buildOnboardingPlan, applyOnboardingAnswers, needsOnboarding, readRunView, RunViewError, renderRunViewText, writeRunViewHtml, openBrowserUrl, OnboardingBlanketChoice, PreferenceKey, resolvePreferences } from './chunk-C5MMZNZJ.js';
2
2
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
3
3
  import { ListToolsRequestSchema, CallToolRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema } from '@modelcontextprotocol/sdk/types.js';
4
4
  import { v4 } from 'uuid';
@@ -1042,7 +1042,7 @@ async function resolveGsScreenshotUrls(report, opts) {
1042
1042
  if (gsUrls.length === 0) {
1043
1043
  return report;
1044
1044
  }
1045
- const mcps = await import('./src-LD2BVJE4.js');
1045
+ const mcps = await import('./src-XCMPDHPJ.js');
1046
1046
  const credentials = await mcps.getCallerCredentialsAsync();
1047
1047
  if (!credentials.bearerToken && !credentials.apiKey) {
1048
1048
  stderrWrite(
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { runCli } from './chunk-5ZCT7BYF.js';
3
- import './chunk-NOID65AF.js';
2
+ import { runCli } from './chunk-JERBZROI.js';
3
+ import './chunk-C5MMZNZJ.js';
4
4
 
5
5
  // src/cli/main.ts
6
6
  runCli().catch((error) => {
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-5ZCT7BYF.js';
2
- export { createChildLogger, e2e_exports as e2e, getConfig, getLocalQaTools, getLogger, getQaTools, local_exports as localQa, mcp_exports as mcp, e2e_exports as qa, src_exports as shared } from './chunk-NOID65AF.js';
1
+ export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-JERBZROI.js';
2
+ export { createChildLogger, e2e_exports as e2e, getConfig, getLocalQaTools, getLogger, getQaTools, local_exports as localQa, mcp_exports as mcp, e2e_exports as qa, src_exports as shared } from './chunk-C5MMZNZJ.js';
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "muggle",
3
3
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
4
- "version": "5.24.0-staging.174",
4
+ "version": "5.24.0-staging.176",
5
5
  "author": {
6
6
  "name": "Muggle AI",
7
7
  "email": "support@muggle-ai.com"
@@ -4,7 +4,7 @@
4
4
  "command": "npx",
5
5
  "args": [
6
6
  "-y",
7
- "@muggleai/works@5.24.0-staging.174",
7
+ "@muggleai/works@5.24.0-staging.176",
8
8
  "serve"
9
9
  ],
10
10
  "env": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muggle",
3
- "version": "5.24.0-staging.174",
3
+ "version": "5.24.0-staging.176",
4
4
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
5
5
  "author": {
6
6
  "name": "Muggle AI",
@@ -2,7 +2,7 @@
2
2
  "name": "muggle",
3
3
  "displayName": "Muggle AI",
4
4
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
5
- "version": "5.24.0-staging.174",
5
+ "version": "5.24.0-staging.176",
6
6
  "author": {
7
7
  "name": "Muggle AI",
8
8
  "email": "support@muggle-ai.com"
@@ -4,7 +4,7 @@
4
4
  "command": "npx",
5
5
  "args": [
6
6
  "-y",
7
- "@muggleai/works@5.24.0-staging.174",
7
+ "@muggleai/works@5.24.0-staging.176",
8
8
  "serve"
9
9
  ]
10
10
  }
@@ -0,0 +1,12 @@
1
+ # Test case design: one atomic behavior per test case
2
+
3
+ Every test case verifies exactly **one** user-observable behavior. Never bundle multiple concerns, sequential flows, or bootstrap/setup into a single test case — even if you think it would be "cleaner" or "more efficient."
4
+
5
+ **Ordering and dependencies belong to the test-plan graph, not to the test case body.** The backend records which case depends on which; the run path reads that chain and runs the prerequisites first ([`test-case-chain-readiness.md`](test-case-chain-readiness.md)). Your job is to describe the *atomic behavior to verify* — never the flow that gets there.
6
+
7
+ - ❌ Wrong: one test case that "signs up, logs in, navigates to the detail modal, verifies icon stacking, verifies tab order, verifies history format, and verifies reference layout."
8
+ - ✅ Right: four separate test cases — one per verifiable behavior — each with instruction text like "Verify the detail modal shows stacked pair of icons per card" with **no** signup / login / navigation / setup language.
9
+
10
+ **Never bake bootstrap into a test case description.** Signup, login, seed data, prerequisite navigation, tear-down — none of these belong inside the test case body. Write only the verification itself. Setup arrives as its own prerequisite case: the chain runs ahead of the target, and the session it leaves behind is what the target starts from. Nothing is spliced into the case body.
11
+
12
+ **Never consolidate the generator's output.** When `muggle-remote-test-case-generate-from-prompt` returns N micro-tests from a single prompt, that decomposition is the authoritative one. Do not "merge them into 1 for simplicity," do not "rewrite them to share bootstrap," do not "collapse them to match a 4 UC / 4 TC plan." Accept what the generator gave you.
@@ -96,7 +96,7 @@ Invoke [`unit-tests.md`](unit-tests.md). Cover the surface that just changed; re
96
96
 
97
97
  #### 4e. Run ONE E2E acceptance pass (full cycle only)
98
98
 
99
- Invoke [`e2e-acceptance.md`](e2e-acceptance.md). One pass covering all related test cases for this PR, not one per comment. When `state.md` records `Wave: on`, the pass runs against the wave stack — siblings started from their PRs' current heads — and the refreshed walkthrough goes to every sibling too, per [`wave-e2e.md`](wave-e2e.md#later-cycles-on-one-wave-pr). The stage reads the persisted validation context (seeded by pre-flight or by bootstrap Step 6.5); a poll-only session with no context (e.g. auto-track) is reported `SKIPPED`. The persisted `Validation` strategy is the standing decision — no per-tick `autoE2ETest` prompt. See [`e2e-acceptance.md`](e2e-acceptance.md) Step 0 and [`../_shared/resolve-e2e-validation-context.md`](../_shared/resolve-e2e-validation-context.md). A minor cycle skips this step, wave or not.
99
+ Invoke [`e2e-acceptance.md`](e2e-acceptance.md). One pass over the `e2eScope` impact analysis emitted in 4c, not one per comment. When `state.md` records `Wave: on`, the pass runs against the wave stack — siblings started from their PRs' current heads — and the refreshed walkthrough goes to every sibling too, per [`wave-e2e.md`](wave-e2e.md#later-cycles-on-one-wave-pr). The stage reads the persisted validation context (seeded by pre-flight or by bootstrap Step 6.5); a poll-only session with no context (e.g. auto-track) is reported `SKIPPED`. The persisted `Validation` strategy is the standing decision — no per-tick `autoE2ETest` prompt. See [`e2e-acceptance.md`](e2e-acceptance.md) Step 0 and [`../_shared/resolve-e2e-validation-context.md`](../_shared/resolve-e2e-validation-context.md). A minor cycle skips this step, wave or not.
100
100
 
101
101
  #### 4f. Create or update the PR
102
102
 
@@ -1,6 +1,6 @@
1
1
  # Post-Merge Cleanup Stage
2
2
 
3
- Invoked by `/muggle-do` when the watcher forwards a PR's terminal state. On `merged` it resolves the session's workspace and **delegates** teardown to the shared procedure (it does not restate the teardown steps); on `closed` (unmerged) it skips teardown. Either way it ends by suggesting the next step. Never runs while the PR is open.
3
+ Invoked by `/muggle-do` when the watcher forwards a PR's terminal state. On `merged` it deletes the Muggle test cases the change retired, then resolves the session's workspace and **delegates** teardown to the shared procedure (it does not restate the teardown steps); on `closed` (unmerged) it skips teardown. Either way it ends by suggesting the next step. Never runs while the PR is open.
4
4
 
5
5
  ## Input
6
6
 
@@ -10,8 +10,9 @@ Invoked by `/muggle-do` when the watcher forwards a PR's terminal state. On `mer
10
10
 
11
11
  1. Read `~/.muggle-ai/muggle-do/sessions/<slug>/`: `prs.json` (PR `repo`, `number`, observed `state`) and `state.md` (`worktreePath` if a worktree was used, and the target branch `headRefName`).
12
12
  2. If `prs.json` shows the PR still open, do nothing and exit — this stage is terminal-only.
13
- 3. **Teardown (`merged` only).** When the PR is `merged`, run [`../_shared/post-merge-cleanup.md`](../_shared/post-merge-cleanup.md) with `{worktreePath}` and `{branch}`. That file owns the teardown sequence **and its safety rules** — including skipping worktree-remove and local branch deletion when no worktree was used. This stage adds no teardown logic of its own. On `closed`, skip teardown — the branch and any worktree stay intact.
14
- 4. Append a cleanup line to the session's `followup.log`, recording whether teardown ran.
15
- 5. Suggest the next step per [`next-step.md`](next-step.md), passing whether teardown ran. This is the stage's last action.
13
+ 3. **Retire the cases the change replaced or removed (`merged` only).** Read the newest `e2eScope` recorded in the slot's `iterations/` ([`impact-analysis.md`](impact-analysis.md#output-state--e2escope)) — later cycles rescope, so the newest one describes what merged. Soft-delete each `retiredTestCases` entry with `muggle-remote-test-case-delete`, then each `retiredUseCases` entry with `muggle-remote-use-case-delete`, all in one message per kind. Before deleting a use case, confirm with `muggle-remote-test-case-list-by-use-case` that every test case under it is in the retired list: the delete cascades, so a test case added since scoping keeps the use case and its id is reported instead. An id already gone counts as deleted. On `closed` nothing is deleted — the change never landed, so the default branch still exercises those cases.
14
+ 4. **Teardown (`merged` only).** When the PR is `merged`, run [`../_shared/post-merge-cleanup.md`](../_shared/post-merge-cleanup.md) with `{worktreePath}` and `{branch}`. That file owns the teardown sequence **and its safety rules** — including skipping worktree-remove and local branch deletion when no worktree was used. This stage adds no teardown logic of its own. On `closed`, skip teardown — the branch and any worktree stay intact.
15
+ 5. Append a cleanup line to the session's `followup.log`, recording the case ids retired and whether teardown ran.
16
+ 6. Suggest the next step per [`next-step.md`](next-step.md), passing whether teardown ran. This is the stage's last action.
16
17
 
17
- **Teardown never returns a question.** It finishes with its report — every step done, skipped, or blocked-with-a-reason — so steps 4 and 5 always run. A teardown that appears to be waiting on the user has stalled mid-sequence; the stage is not complete until the report and the next-step suggestion are both printed.
18
+ **Teardown never returns a question, and neither does retirement.** Each finishes with its report — every item done, skipped, or blocked-with-a-reason — so steps 5 and 6 always run. A teardown that appears to be waiting on the user has stalled mid-sequence; the stage is not complete until the report and the next-step suggestion are both printed.
@@ -47,6 +47,7 @@ You receive everything from `state.md` already — pre-flight resolved it:
47
47
  - Test-user credential status (existing / new / skip), when credentials are needed
48
48
  - The list of changed repos, files, and a summary of changes
49
49
  - The requirements goal
50
+ - The `e2eScope` from impact analysis — the impacted, retired, and new use cases and test cases this stage runs
50
51
 
51
52
  ## Your Job
52
53
 
@@ -97,20 +98,28 @@ Consume `pathClassification` from impact-analysis and resolve the dispatch targe
97
98
 
98
99
  The `devServerUrl` and project resolved here override any defaults in `state.md` for the remainder of this stage. Treat classification labels as routing hints provided by impact-analysis; do not hardcode product-specific paths in this stage.
99
100
 
100
- ### Step 2: Get Test Cases
101
+ ### Step 2: Load the scope
101
102
 
102
- Use `muggle-remote-test-case-list` with the project ID to fetch all test cases.
103
+ The cases to run are the `e2eScope` impact analysis recorded in its `iterations/<NNN>.md` marker ([`impact-analysis.md`](impact-analysis.md#output-state--e2escope)): every impacted test case plus every new one. Do not re-list the project or re-select by judgment here; the scope was decided where the diff and the criteria were both in hand.
103
104
 
104
- ### Step 3: Filter Relevant Test Cases
105
+ - **No scope, or `not-scoped`, on a cycle that reached this step** → run that file's scope procedure now and record it before going on. Never fall back to every case in the project.
106
+ - **A Stage 7.5 re-run** passes its affected test cases; they replace the scope for that run, and cases already created are not created again.
107
+ - **Retired use cases and test cases** are not run — the change replaced or removed what they verify. Nothing is deleted here: the report lists them as planned deletions, and [`cleanup.md`](cleanup.md) deletes them once the PR merges.
108
+ - **A flow the run shows the change reaches that no scoped case covers** is added with a one-line reason under the report's scope amendments. A scoped case is never dropped.
105
109
 
106
- Based on the changed files and the requirements goal, determine which test cases are relevant:
107
- - Test cases whose use cases directly relate to the changed functionality
108
- - Test cases that cover areas potentially affected by the changes
109
- - When in doubt, include the test case (better to over-test than miss a regression)
110
+ ### Step 3: Create the new cases
111
+
112
+ Create what the scope planned, before any run:
113
+
114
+ 1. **New use cases** — one `muggle-remote-use-case-create-from-prompts` call with every `newUseCases` instruction in its `instructions` array. Map each created use case back to its key.
115
+ 2. **New test cases** — one `muggle-remote-test-case-generate-from-prompt` per `newTestCases` entry, all in one message, with `projectId`, the resolved `useCaseId`, and the entry's `instruction`.
116
+ 3. **Create every generated case** — `muggle-remote-test-case-create` for each, in parallel. Accept the generator's decomposition as-is ([`../_shared/test-case-design.md`](../_shared/test-case-design.md)): N micro-tests from one instruction are N test cases. Record each `testCaseId` against its key; the report and a Stage 7.5 re-run name new cases by id.
117
+
118
+ A failed create leaves its entry `INCONCLUSIVE` with reason `case creation failed: <error>`; it stays in the report.
110
119
 
111
120
  ### Step 3.5: Satisfy each target's prerequisite chain
112
121
 
113
- For every test case selected in Step 3, resolve its prerequisite chain from the backend's test-plan graph and make each ancestor ready before the target runs, per [`../_shared/test-case-chain-readiness.md`](../_shared/test-case-chain-readiness.md). This stage is unattended, so follow that file's unattended-caller rule: a target whose chain cannot be satisfied is reported `INCONCLUSIVE` with reason `prerequisites unmet` and is not run.
122
+ For every test case in scope after Step 3, resolve its prerequisite chain from the backend's test-plan graph and make each ancestor ready before the target runs, per [`../_shared/test-case-chain-readiness.md`](../_shared/test-case-chain-readiness.md). This stage is unattended, so follow that file's unattended-caller rule: a target whose chain cannot be satisfied is reported `INCONCLUSIVE` with reason `prerequisites unmet` and is not run.
114
123
 
115
124
  A target that runs without its prerequisite state spends its step budget re-creating that state — signing in, seeding data — and reports on what it lacked rather than on the change under test. That verdict reads as a product failure and is worth less than no verdict.
116
125
 
@@ -118,7 +127,7 @@ Ancestors generated here are prerequisites, not results: they belong in neither
118
127
 
119
128
  ### Step 4: Run the dev loop, gather screenshots
120
129
 
121
- For each relevant test case, run the shared loop in [`../_shared/dev-loop/run.md`](../_shared/dev-loop/run.md): `muggle-remote-test-script-list` by `testCaseId` with `runEnvironmentType: "local"` (this stage runs against localhost) to pick [replay vs regen](../_shared/dev-loop/run.md), [execute with `timeoutMs`](../_shared/dev-loop/timeouts.md), [fetch the result](../_shared/dev-loop/failures.md) and [interpret failures](../_shared/dev-loop/failures.md), then read the studio-published [cloud refs and per-step screenshots](../_shared/dev-loop/publish.md) off the run result.
130
+ For each scoped test case, run the shared loop in [`../_shared/dev-loop/run.md`](../_shared/dev-loop/run.md): `muggle-remote-test-script-list` by `testCaseId` with `runEnvironmentType: "local"` (this stage runs against localhost) to pick [replay vs regen](../_shared/dev-loop/run.md), [execute with `timeoutMs`](../_shared/dev-loop/timeouts.md), [fetch the result](../_shared/dev-loop/failures.md) and [interpret failures](../_shared/dev-loop/failures.md), then read the studio-published [cloud refs and per-step screenshots](../_shared/dev-loop/publish.md) off the run result.
122
131
 
123
132
  Inputs to the loop: `mode` from the script-exists check, `localUrl`/project from Step 1.7, `cwd` = the working tree recorded in `state.md`.
124
133
 
@@ -127,7 +136,7 @@ Inputs to the loop: `mode` from the script-exists check, `localUrl`/project from
127
136
  For each test case:
128
137
  - Record pass or fail from the run result
129
138
  - If failed, capture the error message, failure step index, and `artifactsDir` for local debugging
130
- - In `local-e2e` mode, every relevant test case must be executed — generate a new script if none exists (no skips)
139
+ - In `local-e2e` mode, every scoped test case must be executed — generate a new script if none exists (no skips)
131
140
 
132
141
  ## Output
133
142
 
@@ -160,6 +169,12 @@ For each test case:
160
169
  - reason: `<one short sentence>`
161
170
  - steps: `[{ stepIndex, action, description, screenshotUrl }, ...]` (empty only when the run produced no steps)
162
171
 
172
+ **Scope:** (from `e2eScope`, after Step 3)
173
+ - impacted: `<testCaseId>`, ...
174
+ - new: `<key>` → `<testCaseId>`, ...
175
+ - retired (not run — deleted after merge): use case `<useCaseId>`, ...; test case `<testCaseId>` → replaced by `<testCaseId>` | removed, ...
176
+ - amendments: `<testCaseId>` — `<reason>`, ...
177
+
163
178
  **Metadata:**
164
179
  - projectId: `<projectId>`
165
180
 
@@ -182,6 +197,6 @@ Failed runs use the same evidence + diagnosis assembly as the interactive debug
182
197
  - No silent auth skip; always verify with `muggle-remote-auth-status` first.
183
198
  - Replay/timeout/result discipline per [`../_shared/dev-loop/run.md`](../_shared/dev-loop/run.md) — never hand-build `actionScript`, always pass `timeoutMs`, read structured run-result fields.
184
199
  - No hiding failures: surface errors, exit codes, and artifact paths.
185
- - In `local-e2e` mode, every relevant test case must be executed — generate a new script if none exists (no skips).
200
+ - In `local-e2e` mode, every scoped test case must be executed — generate a new script if none exists (no skips).
186
201
  - The studio publishes every run during execution, so screenshots are cloud-accessible for PR comments — read the refs off the run result, never re-publish.
187
202
  - **Never drop a test case from the report because it "couldn't run cleanly."** A test that didn't reach its assertion is `inconclusive`, not absent. Dropping it produces misleading verdicts and pushes downstream PR-comment renderers to hand-write the comment — which is the failure mode this stage exists to prevent.
@@ -1,21 +1,21 @@
1
1
  # Impact Analysis Agent (Stage 4)
2
2
 
3
- You are analyzing git repositories to determine which ones have actual code changes that need to go through the dev cycle pipeline.
3
+ You are analyzing git repositories to determine which ones have actual code changes that need to go through the dev cycle pipeline, and which use cases and test cases the E2E acceptance stage must run for them.
4
4
 
5
5
  ## Turn preamble
6
6
 
7
7
  Start the turn with:
8
8
 
9
9
  ```
10
- **Stage 4 — Impact analysis** — diffing each affected repo against its default branch.
10
+ **Stage 4 — Impact analysis** — diffing each affected repo against its default branch and scoping the E2E cases.
11
11
  ```
12
12
 
13
13
  ## Input
14
14
 
15
15
  You receive:
16
16
  - A list of repos with their local filesystem paths
17
- - The requirements goal and affected repos from the requirements stage
18
- - Pre-flight state, including `worktreePath` when a worktree was selected (see [`../_shared/use-worktrees.md`](../_shared/use-worktrees.md))
17
+ - The requirements goal, acceptance criteria, and affected repos from the requirements stage (`requirements.md`); in an address-reviews cycle, also the review-derived change items `build.md` was given
18
+ - Pre-flight state, including `worktreePath` when a worktree was selected (see [`../_shared/use-worktrees.md`](../_shared/use-worktrees.md)), and the `## Pre-flight answers` block's `Validation` and `projectId`
19
19
 
20
20
  ## Your Job
21
21
 
@@ -35,6 +35,7 @@ For each repo path provided:
35
35
  6. **List changed files:** Run `git diff --name-only <default-branch>...HEAD` to find files changed on this branch relative to the default branch. If no merge base exists, fall back to `git diff --name-only HEAD`.
36
36
  7. **Get the diff:** Run `git diff <default-branch>...HEAD` for the full diff.
37
37
  8. **Classify changed paths** to drive downstream test routing — emit `pathClassification` (see "Output state — pathClassification" below).
38
+ 9. **Scope the E2E cases** — map the diff and the acceptance criteria to the impacted existing use cases and test cases and the new ones to add; emit `e2eScope` (see "Output state — e2eScope" below).
38
39
 
39
40
  ## Output
40
41
 
@@ -91,3 +92,67 @@ cycleSize: <minor | full>
91
92
  ```
92
93
 
93
94
  `minor` only when every path in `cycleFiles` is in the `NO_APP_LOGIC_CHANGE` path set defined in [`e2e-acceptance.md`](e2e-acceptance.md); otherwise `full`. The rest of this stage still runs against the default branch, so a full cycle's E2E routes from `pathClassification` as in a forward run.
95
+
96
+ ## Output state — e2eScope
97
+
98
+ The case selection [`e2e-acceptance.md`](e2e-acceptance.md) runs. Stage 6 executes this scope rather than choosing its own, so the choice is made here, where the diff and the acceptance criteria are both in hand.
99
+
100
+ Scope only when this cycle runs E2E: `Validation` is `local-e2e`, `pathClassification` is not `none`, and in a watcher cycle `cycleSize` is `full`. Otherwise emit `e2eScope: not-scoped — <the condition that failed>`.
101
+
102
+ The criteria are the acceptance criteria in the session's `requirements.md`, plus each review-derived change item that alters behavior in an address-reviews cycle. A session with no `requirements.md` (an adopted PR) scopes from the diff alone and writes `criteria: []`.
103
+
104
+ ### Procedure
105
+
106
+ 1. **List the project's cases.** `muggle-remote-use-case-list` for the project the classification routes to (single-project repos: `projectId` from `state.md`), then `muggle-remote-test-case-list-by-use-case` for every use case, all in one message. `e2eScope` holds one entry per project, so `mixed` scopes each classification's project as its own entry.
107
+ 2. **Impacted use cases.** A use case is impacted when its flow passes through a page, route, component, endpoint, or data flow the diff changes, or when an acceptance criterion falls inside it.
108
+ 3. **Impacted test cases.** Under each impacted use case, a test case is impacted when it exercises a changed surface or verifies a behavior a criterion touches. When in doubt, include it: an extra replay costs minutes, a missed regression ships.
109
+ 4. **Retired cases.** A test case the change makes wrong fails by design, so it is retired, never impacted. Replaying it would send Stage 7.5 to repair the product back to the old behavior.
110
+ - **Replaced** — the change alters its expected outcome (a renamed label, a removed step, a new validation rule). Plan a new test case for the new expectation and name it in `replacedBy`.
111
+ - **Removed** — the change removes the feature it verifies. `replacedBy: none`.
112
+
113
+ A use case is retired only when the change removes its whole flow **and** every test case under it is retired: deleting a use case cascades to all its test cases and scripts, so one surviving test case keeps the use case. Retired cases are deleted after the PR merges ([`cleanup.md`](cleanup.md)), never during the cycle — an unmerged change must leave the project's suite intact for the default branch.
114
+ 5. **Map every criterion.** Each criterion carries `coveredBy` (impacted or new test cases that verify it) or `unobservable` (why no browser can observe it: a log line, a unit-test requirement, a config value). A criterion with neither is a scoping failure.
115
+ 6. **Plan the new cases.** Each uncovered criterion gets a new test case under the impacted use case its behavior belongs to, or under a new use case when none fits. A test case instruction names one atomic behavior to verify, with no signup, login, navigation, or seed-data steps, per [`../_shared/test-case-design.md`](../_shared/test-case-design.md); prerequisites come from the test-plan graph at run time ([`../_shared/test-case-chain-readiness.md`](../_shared/test-case-chain-readiness.md)).
116
+
117
+ This stage plans new cases and creates nothing. Stage 6 creates them, so a cycle that never reaches E2E leaves no cases behind in the project.
118
+
119
+ ### Shape
120
+
121
+ ```
122
+ e2eScope:
123
+ - projectId: <id>
124
+ impactedUseCases:
125
+ - useCaseId: <id>
126
+ title: <title>
127
+ reason: <changed path or criterion that puts it in scope>
128
+ impactedTestCases:
129
+ - testCaseId: <id>
130
+ useCaseId: <id>
131
+ title: <title>
132
+ reason: <changed path or criterion>
133
+ retiredUseCases:
134
+ - useCaseId: <id>
135
+ title: <title>
136
+ reason: <the flow the change removes>
137
+ retiredTestCases:
138
+ - testCaseId: <id>
139
+ title: <title>
140
+ reason: <the expectation the change alters, or the feature it removes>
141
+ replacedBy: <new test case key | none>
142
+ newUseCases:
143
+ - key: NUC1
144
+ instruction: <plain-English description of the use case>
145
+ newTestCases:
146
+ - key: NTC1
147
+ useCase: <useCaseId | new use case key>
148
+ instruction: <one atomic behavior to verify>
149
+ criteria:
150
+ - criterion: <acceptance criterion>
151
+ coveredBy: [<testCaseId | new test case key>, ...]
152
+ - criterion: <acceptance criterion>
153
+ unobservable: <why no browser can observe it>
154
+ ```
155
+
156
+ An empty list is written empty, never omitted; an absent list reads as "not scoped". Record the scope in this stage's marker in `iterations/<NNN>.md`, so Stage 6, a Stage 7.5 re-run, and a resumed session read the same one.
157
+
158
+ In a wave each member repo emits its own `e2eScope`, and [`wave-e2e.md`](wave-e2e.md) merges them.
@@ -36,7 +36,7 @@ Run [`e2e-acceptance.md`](e2e-acceptance.md) **once**, not once per repo, with t
36
36
 
37
37
  1. **Start the wave stack.** Invoke [`muggle-test-prepare`](../muggle-test-prepare/SKILL.md) with the wave members as `directoryOverrides` (repo → worktree path): every service whose repo is a wave member starts from that member's worktree path, not from the repo's usual checkout. Services from repos outside the wave start as the saved recipe says.
38
38
  2. **Confirm each wave service runs the wave branch.** A port that answers is not enough — the process on it may be a dev server the user left running from the default checkout. Check the readiness table: every wave service must report its member's worktree as its directory. A service that doesn't → halt and escalate with the table; never test a wave against a service running another branch.
39
- 3. **Select test cases against the union of diffs.** Steps 1.5–3 read impact analysis for every wave repo. A test case is relevant when any member's change touches its flow. `EMPTY_DIFF` applies only when every member's diff is empty.
39
+ 3. **Merge every member's scope.** Steps 1.5–3 read impact analysis for every wave repo, and the run's scope is the union of each member's `e2eScope`: a test case several members scope runs once, and a new case two members plan for the same criterion is created once. `EMPTY_DIFF` applies only when every member's diff is empty.
40
40
  4. **Run each selected test case once** against the combined stack. Do not repeat a case per repo.
41
41
  5. **Attribute failures.** For each Failed entry, name the member whose change the failing step implicates (`implicatedRepo: <owner/repo>`), or `unknown` when the evidence does not point at one. Stage 7.5 repairs in that repo.
42
42
 
@@ -49,7 +49,8 @@ Do not create or update a PR until each line holds, or is waived by a one-line r
49
49
  - Build clean — typecheck + lint on changed files
50
50
  - New/changed logic carries unit tests (authored in Stage 3; Stage 5 only runs the suite)
51
51
  - Unit suite run, PASS recorded
52
- - E2E verdict recorded with `runId` per `autoE2ETest` — or `[E2E FAILING]`, or `SKIPPED` citing a verified skip code from [`../do/e2e-acceptance.md`](../do/e2e-acceptance.md), where each code's verification rule lives. Free-text reasons are rejected by the gate
52
+ - Stage 4's `e2eScope` recorded, mapping every acceptance criterion to a test case or to `unobservable` — or `not-scoped` with the condition that failed
53
+ - E2E verdict recorded with `runId` for every case in that scope, per `autoE2ETest` — or `[E2E FAILING]`, or `SKIPPED` citing a verified skip code from [`../do/e2e-acceptance.md`](../do/e2e-acceptance.md), where each code's verification rule lives. Free-text reasons are rejected by the gate
53
54
  - UI changes verified in a real browser with evidence (screenshot path or muggle `runId`); `curl` + `grep` is not verification
54
55
 
55
56
  Opening a PR with an unchecked, unwaived line is a cycle failure. A Stage 6 readiness halt ([`../do/e2e-acceptance.md`](../do/e2e-acceptance.md) Step 0.5) leaves the E2E line open: no skip code, waiver, or explicit request to open the PR closes it.
@@ -5,6 +5,7 @@ mandatoryStages:
5
5
  - ../_shared/failure-mode-handling.md
6
6
  - ../_shared/debug-failed-run.md
7
7
  - ../_shared/identity-and-inbox.md
8
+ - ../_shared/test-case-design.md
8
9
  ---
9
10
 
10
11
  # Muggle Test — Change-Driven E2E Acceptance Router
@@ -41,16 +42,7 @@ Reach for these when the user is weighing Muggle Test against hand-written specs
41
42
 
42
43
  ## Test Case Design: One Atomic Behavior Per Test Case
43
44
 
44
- Every test case verifies exactly **one** user-observable behavior. Never bundle multiple concerns, sequential flows, or bootstrap/setup into a single test case — even if you think it would be "cleaner" or "more efficient."
45
-
46
- **Ordering and dependencies belong to the test-plan graph, not to the test case body.** The backend records which case depends on which; the run path reads that chain and runs the prerequisites first ([`_shared/test-case-chain-readiness.md`](../_shared/test-case-chain-readiness.md)). Your job is to describe the *atomic behavior to verify* — never the flow that gets there.
47
-
48
- - ❌ Wrong: one test case that "signs up, logs in, navigates to the detail modal, verifies icon stacking, verifies tab order, verifies history format, and verifies reference layout."
49
- - ✅ Right: four separate test cases — one per verifiable behavior — each with instruction text like "Verify the detail modal shows stacked pair of icons per card" with **no** signup / login / navigation / setup language.
50
-
51
- **Never bake bootstrap into a test case description.** Signup, login, seed data, prerequisite navigation, tear-down — none of these belong inside the test case body. Write only the verification itself. Setup arrives as its own prerequisite case: the chain runs ahead of the target, and the session it leaves behind is what the target starts from. Nothing is spliced into the case body.
52
-
53
- **Never consolidate the generator's output.** When `muggle-remote-test-case-generate-from-prompt` returns N micro-tests from a single prompt, that decomposition is the authoritative one. Do not "merge them into 1 for simplicity," do not "rewrite them to share bootstrap," do not "collapse them to match a 4 UC / 4 TC plan." Accept what the generator gave you.
45
+ Every test case verifies exactly **one** user-observable behavior, carries no signup, login, navigation, or seed-data steps, and the generator's decomposition is kept as-is. The full rule, with examples: [`_shared/test-case-design.md`](../_shared/test-case-design.md).
54
46
 
55
47
  **Never skip the generate→review cycle.** Even when you are 100% confident about the right shape, always present the generated test cases to the user before calling `muggle-remote-test-case-create`. "I'll skip the generate→review cycle and create directly" is a sign you're about to get it wrong.
56
48
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "release": "5.18.0",
3
- "buildId": "run-174-1",
4
- "commitSha": "7892a8736b1a82beb30d166005cd9c3b90dca792",
5
- "buildTime": "2026-10-23T00:15:33Z",
3
+ "buildId": "run-176-1",
4
+ "commitSha": "9ec6f9435429b034ab39af60051e0f0f29647991",
5
+ "buildTime": "2026-10-23T00:39:09Z",
6
6
  "serviceName": "muggle-ai-works-mcp"
7
7
  }
@@ -1 +1 @@
1
- export { ACTION_SCRIPT_FILE_NAME, DEFAULT_PREFERENCES, ELECTRON_APP_EXECUTABLE_PATH_SEGMENTS, ElectronAppPlatform, ElectronAppReleaseStream, HTML_VIEW_OFFER_LINE, ONBOARDING_BLANKET_OPTIONS, ONBOARDING_CHOICE_GROUPS, ONBOARDING_MAX_OFFERS, ONBOARDING_PRIMER_BULLETS, ONBOARDING_PRIMER_HEADLINE, ONBOARDING_TOGGLE_GROUPS, ONBOARDING_TOGGLE_PROMPT, ONBOARDING_UNSELECTED_TOGGLE_VALUE, OnboardingBlanketChoice, OnboardingGroupKind, PREFERENCES_FILE_NAME, PREFERENCES_PROJECT_DIR_NAME, PREFERENCES_SCHEMA, PREFERENCES_VERSION, PREFERENCE_ALLOWED_VALUES, PreferenceKey, PreferenceValue, ProjectPreferencesReconcileOutcome, RUN_SESSIONS_DIR_NAME, RUN_VIEW_DASHBOARD_LINK_LABEL, RunViewError, RuntimeTarget, SCREENSHOT_DIR_RELATIVE_PATH, SCREENSHOT_FILE_EXTENSION, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, applyOnboardingAnswers, assertDeviceCodeClientProvisioned, buildElectronAppChecksumsUrl, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, buildOnboardingPlan, calculateFileChecksum, completeOnboarding, createApiKeyWithToken, createChildLogger, deleteApiKeyData, deleteCredentials, e2e_exports as e2e, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDashboardBaseUrl, getDataDir, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppReleaseTagPrefix, getElectronAppSignedFromVersion, getElectronAppVersion, getElectronAppVersionSource, getLocalQaTools, getLogger, getOnboardingToggleKeys, getPlatformKey, getQaTools, getReleaseSignerIdentityUri, getRunSessionsDir, getValidApiKeyData, getValidCredentials, hasApiKey, isElectronAppInstalled, isElectronAppPlatform, isFirstRun, loadApiKeyData, loadCredentials, local_exports as localQa, markOnboardingCompleted, mcp_exports as mcp, needsOnboarding, openBrowserUrl, performLogin, performLogout, pollDeviceCode, e2e_exports as qa, readPreferencesMetadata, readRunView, reconcileProjectPreferences, recordOnboardingSkip, renderRunViewHtml, renderRunViewText, resetConfig, resetLogger, resetPreference, resolveActiveProfile, resolveActiveReleaseStream, resolveActiveReleaseTagPrefix, resolveBlanketPreferences, resolveElectronAppExecutablePath, resolveElectronAppPathOrNull, resolveOnboardingAnswers, resolvePreferences, resolveRunSessionPath, resolveRuntimeTarget, resolveTogglePreferences, saveApiKey, saveApiKeyData, saveCredentials, startDeviceCodeFlow, toolRequiresAuth, validatePreference, verifyFileChecksum, writePreferences, writePreferencesWithMetadata, writeRunViewHtml } from './chunk-NOID65AF.js';
1
+ export { ACTION_SCRIPT_FILE_NAME, DEFAULT_PREFERENCES, ELECTRON_APP_EXECUTABLE_PATH_SEGMENTS, ElectronAppPlatform, ElectronAppReleaseStream, HTML_VIEW_OFFER_LINE, ONBOARDING_BLANKET_OPTIONS, ONBOARDING_CHOICE_GROUPS, ONBOARDING_MAX_OFFERS, ONBOARDING_PRIMER_BULLETS, ONBOARDING_PRIMER_HEADLINE, ONBOARDING_TOGGLE_GROUPS, ONBOARDING_TOGGLE_PROMPT, ONBOARDING_UNSELECTED_TOGGLE_VALUE, OnboardingBlanketChoice, OnboardingGroupKind, PREFERENCES_FILE_NAME, PREFERENCES_PROJECT_DIR_NAME, PREFERENCES_SCHEMA, PREFERENCES_VERSION, PREFERENCE_ALLOWED_VALUES, PreferenceKey, PreferenceValue, ProjectPreferencesReconcileOutcome, RUN_SESSIONS_DIR_NAME, RUN_VIEW_DASHBOARD_LINK_LABEL, RunViewError, RuntimeTarget, SCREENSHOT_DIR_RELATIVE_PATH, SCREENSHOT_FILE_EXTENSION, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, applyOnboardingAnswers, assertDeviceCodeClientProvisioned, buildElectronAppChecksumsUrl, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, buildOnboardingPlan, calculateFileChecksum, completeOnboarding, createApiKeyWithToken, createChildLogger, deleteApiKeyData, deleteCredentials, e2e_exports as e2e, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDashboardBaseUrl, getDataDir, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppReleaseTagPrefix, getElectronAppSignedFromVersion, getElectronAppVersion, getElectronAppVersionSource, getLocalQaTools, getLogger, getOnboardingToggleKeys, getPlatformKey, getQaTools, getReleaseSignerIdentityUri, getRunSessionsDir, getValidApiKeyData, getValidCredentials, hasApiKey, isElectronAppInstalled, isElectronAppPlatform, isFirstRun, loadApiKeyData, loadCredentials, local_exports as localQa, markOnboardingCompleted, mcp_exports as mcp, needsOnboarding, openBrowserUrl, performLogin, performLogout, pollDeviceCode, e2e_exports as qa, readPreferencesMetadata, readRunView, reconcileProjectPreferences, recordOnboardingSkip, renderRunViewHtml, renderRunViewText, resetConfig, resetLogger, resetPreference, resolveActiveProfile, resolveActiveReleaseStream, resolveActiveReleaseTagPrefix, resolveBlanketPreferences, resolveElectronAppExecutablePath, resolveElectronAppPathOrNull, resolveOnboardingAnswers, resolvePreferences, resolveRunSessionPath, resolveRuntimeTarget, resolveTogglePreferences, saveApiKey, saveApiKeyData, saveCredentials, startDeviceCodeFlow, toolRequiresAuth, validatePreference, verifyFileChecksum, writePreferences, writePreferencesWithMetadata, writeRunViewHtml } from './chunk-C5MMZNZJ.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@muggleai/works",
3
3
  "mcpName": "io.github.multiplex-ai/muggle",
4
- "version": "5.24.0-staging.174",
4
+ "version": "5.24.0-staging.176",
5
5
  "description": "13 years of Microsoft hyperscale engineering, packaged as a harness for your AI coding agent.",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "muggle",
3
3
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
4
- "version": "5.24.0-staging.174",
4
+ "version": "5.24.0-staging.176",
5
5
  "author": {
6
6
  "name": "Muggle AI",
7
7
  "email": "support@muggle-ai.com"
@@ -4,7 +4,7 @@
4
4
  "command": "npx",
5
5
  "args": [
6
6
  "-y",
7
- "@muggleai/works@5.24.0-staging.174",
7
+ "@muggleai/works@5.24.0-staging.176",
8
8
  "serve"
9
9
  ],
10
10
  "env": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muggle",
3
- "version": "5.24.0-staging.174",
3
+ "version": "5.24.0-staging.176",
4
4
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
5
5
  "author": {
6
6
  "name": "Muggle AI",
@@ -2,7 +2,7 @@
2
2
  "name": "muggle",
3
3
  "displayName": "Muggle AI",
4
4
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
5
- "version": "5.24.0-staging.174",
5
+ "version": "5.24.0-staging.176",
6
6
  "author": {
7
7
  "name": "Muggle AI",
8
8
  "email": "support@muggle-ai.com"
package/plugin/.mcp.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "command": "npx",
5
5
  "args": [
6
6
  "-y",
7
- "@muggleai/works@5.24.0-staging.174",
7
+ "@muggleai/works@5.24.0-staging.176",
8
8
  "serve"
9
9
  ]
10
10
  }
@@ -0,0 +1,12 @@
1
+ # Test case design: one atomic behavior per test case
2
+
3
+ Every test case verifies exactly **one** user-observable behavior. Never bundle multiple concerns, sequential flows, or bootstrap/setup into a single test case — even if you think it would be "cleaner" or "more efficient."
4
+
5
+ **Ordering and dependencies belong to the test-plan graph, not to the test case body.** The backend records which case depends on which; the run path reads that chain and runs the prerequisites first ([`test-case-chain-readiness.md`](test-case-chain-readiness.md)). Your job is to describe the *atomic behavior to verify* — never the flow that gets there.
6
+
7
+ - ❌ Wrong: one test case that "signs up, logs in, navigates to the detail modal, verifies icon stacking, verifies tab order, verifies history format, and verifies reference layout."
8
+ - ✅ Right: four separate test cases — one per verifiable behavior — each with instruction text like "Verify the detail modal shows stacked pair of icons per card" with **no** signup / login / navigation / setup language.
9
+
10
+ **Never bake bootstrap into a test case description.** Signup, login, seed data, prerequisite navigation, tear-down — none of these belong inside the test case body. Write only the verification itself. Setup arrives as its own prerequisite case: the chain runs ahead of the target, and the session it leaves behind is what the target starts from. Nothing is spliced into the case body.
11
+
12
+ **Never consolidate the generator's output.** When `muggle-remote-test-case-generate-from-prompt` returns N micro-tests from a single prompt, that decomposition is the authoritative one. Do not "merge them into 1 for simplicity," do not "rewrite them to share bootstrap," do not "collapse them to match a 4 UC / 4 TC plan." Accept what the generator gave you.
@@ -96,7 +96,7 @@ Invoke [`unit-tests.md`](unit-tests.md). Cover the surface that just changed; re
96
96
 
97
97
  #### 4e. Run ONE E2E acceptance pass (full cycle only)
98
98
 
99
- Invoke [`e2e-acceptance.md`](e2e-acceptance.md). One pass covering all related test cases for this PR, not one per comment. When `state.md` records `Wave: on`, the pass runs against the wave stack — siblings started from their PRs' current heads — and the refreshed walkthrough goes to every sibling too, per [`wave-e2e.md`](wave-e2e.md#later-cycles-on-one-wave-pr). The stage reads the persisted validation context (seeded by pre-flight or by bootstrap Step 6.5); a poll-only session with no context (e.g. auto-track) is reported `SKIPPED`. The persisted `Validation` strategy is the standing decision — no per-tick `autoE2ETest` prompt. See [`e2e-acceptance.md`](e2e-acceptance.md) Step 0 and [`../_shared/resolve-e2e-validation-context.md`](../_shared/resolve-e2e-validation-context.md). A minor cycle skips this step, wave or not.
99
+ Invoke [`e2e-acceptance.md`](e2e-acceptance.md). One pass over the `e2eScope` impact analysis emitted in 4c, not one per comment. When `state.md` records `Wave: on`, the pass runs against the wave stack — siblings started from their PRs' current heads — and the refreshed walkthrough goes to every sibling too, per [`wave-e2e.md`](wave-e2e.md#later-cycles-on-one-wave-pr). The stage reads the persisted validation context (seeded by pre-flight or by bootstrap Step 6.5); a poll-only session with no context (e.g. auto-track) is reported `SKIPPED`. The persisted `Validation` strategy is the standing decision — no per-tick `autoE2ETest` prompt. See [`e2e-acceptance.md`](e2e-acceptance.md) Step 0 and [`../_shared/resolve-e2e-validation-context.md`](../_shared/resolve-e2e-validation-context.md). A minor cycle skips this step, wave or not.
100
100
 
101
101
  #### 4f. Create or update the PR
102
102
 
@@ -1,6 +1,6 @@
1
1
  # Post-Merge Cleanup Stage
2
2
 
3
- Invoked by `/muggle-do` when the watcher forwards a PR's terminal state. On `merged` it resolves the session's workspace and **delegates** teardown to the shared procedure (it does not restate the teardown steps); on `closed` (unmerged) it skips teardown. Either way it ends by suggesting the next step. Never runs while the PR is open.
3
+ Invoked by `/muggle-do` when the watcher forwards a PR's terminal state. On `merged` it deletes the Muggle test cases the change retired, then resolves the session's workspace and **delegates** teardown to the shared procedure (it does not restate the teardown steps); on `closed` (unmerged) it skips teardown. Either way it ends by suggesting the next step. Never runs while the PR is open.
4
4
 
5
5
  ## Input
6
6
 
@@ -10,8 +10,9 @@ Invoked by `/muggle-do` when the watcher forwards a PR's terminal state. On `mer
10
10
 
11
11
  1. Read `~/.muggle-ai/muggle-do/sessions/<slug>/`: `prs.json` (PR `repo`, `number`, observed `state`) and `state.md` (`worktreePath` if a worktree was used, and the target branch `headRefName`).
12
12
  2. If `prs.json` shows the PR still open, do nothing and exit — this stage is terminal-only.
13
- 3. **Teardown (`merged` only).** When the PR is `merged`, run [`../_shared/post-merge-cleanup.md`](../_shared/post-merge-cleanup.md) with `{worktreePath}` and `{branch}`. That file owns the teardown sequence **and its safety rules** — including skipping worktree-remove and local branch deletion when no worktree was used. This stage adds no teardown logic of its own. On `closed`, skip teardown — the branch and any worktree stay intact.
14
- 4. Append a cleanup line to the session's `followup.log`, recording whether teardown ran.
15
- 5. Suggest the next step per [`next-step.md`](next-step.md), passing whether teardown ran. This is the stage's last action.
13
+ 3. **Retire the cases the change replaced or removed (`merged` only).** Read the newest `e2eScope` recorded in the slot's `iterations/` ([`impact-analysis.md`](impact-analysis.md#output-state--e2escope)) — later cycles rescope, so the newest one describes what merged. Soft-delete each `retiredTestCases` entry with `muggle-remote-test-case-delete`, then each `retiredUseCases` entry with `muggle-remote-use-case-delete`, all in one message per kind. Before deleting a use case, confirm with `muggle-remote-test-case-list-by-use-case` that every test case under it is in the retired list: the delete cascades, so a test case added since scoping keeps the use case and its id is reported instead. An id already gone counts as deleted. On `closed` nothing is deleted — the change never landed, so the default branch still exercises those cases.
14
+ 4. **Teardown (`merged` only).** When the PR is `merged`, run [`../_shared/post-merge-cleanup.md`](../_shared/post-merge-cleanup.md) with `{worktreePath}` and `{branch}`. That file owns the teardown sequence **and its safety rules** — including skipping worktree-remove and local branch deletion when no worktree was used. This stage adds no teardown logic of its own. On `closed`, skip teardown — the branch and any worktree stay intact.
15
+ 5. Append a cleanup line to the session's `followup.log`, recording the case ids retired and whether teardown ran.
16
+ 6. Suggest the next step per [`next-step.md`](next-step.md), passing whether teardown ran. This is the stage's last action.
16
17
 
17
- **Teardown never returns a question.** It finishes with its report — every step done, skipped, or blocked-with-a-reason — so steps 4 and 5 always run. A teardown that appears to be waiting on the user has stalled mid-sequence; the stage is not complete until the report and the next-step suggestion are both printed.
18
+ **Teardown never returns a question, and neither does retirement.** Each finishes with its report — every item done, skipped, or blocked-with-a-reason — so steps 5 and 6 always run. A teardown that appears to be waiting on the user has stalled mid-sequence; the stage is not complete until the report and the next-step suggestion are both printed.
@@ -47,6 +47,7 @@ You receive everything from `state.md` already — pre-flight resolved it:
47
47
  - Test-user credential status (existing / new / skip), when credentials are needed
48
48
  - The list of changed repos, files, and a summary of changes
49
49
  - The requirements goal
50
+ - The `e2eScope` from impact analysis — the impacted, retired, and new use cases and test cases this stage runs
50
51
 
51
52
  ## Your Job
52
53
 
@@ -97,20 +98,28 @@ Consume `pathClassification` from impact-analysis and resolve the dispatch targe
97
98
 
98
99
  The `devServerUrl` and project resolved here override any defaults in `state.md` for the remainder of this stage. Treat classification labels as routing hints provided by impact-analysis; do not hardcode product-specific paths in this stage.
99
100
 
100
- ### Step 2: Get Test Cases
101
+ ### Step 2: Load the scope
101
102
 
102
- Use `muggle-remote-test-case-list` with the project ID to fetch all test cases.
103
+ The cases to run are the `e2eScope` impact analysis recorded in its `iterations/<NNN>.md` marker ([`impact-analysis.md`](impact-analysis.md#output-state--e2escope)): every impacted test case plus every new one. Do not re-list the project or re-select by judgment here; the scope was decided where the diff and the criteria were both in hand.
103
104
 
104
- ### Step 3: Filter Relevant Test Cases
105
+ - **No scope, or `not-scoped`, on a cycle that reached this step** → run that file's scope procedure now and record it before going on. Never fall back to every case in the project.
106
+ - **A Stage 7.5 re-run** passes its affected test cases; they replace the scope for that run, and cases already created are not created again.
107
+ - **Retired use cases and test cases** are not run — the change replaced or removed what they verify. Nothing is deleted here: the report lists them as planned deletions, and [`cleanup.md`](cleanup.md) deletes them once the PR merges.
108
+ - **A flow the run shows the change reaches that no scoped case covers** is added with a one-line reason under the report's scope amendments. A scoped case is never dropped.
105
109
 
106
- Based on the changed files and the requirements goal, determine which test cases are relevant:
107
- - Test cases whose use cases directly relate to the changed functionality
108
- - Test cases that cover areas potentially affected by the changes
109
- - When in doubt, include the test case (better to over-test than miss a regression)
110
+ ### Step 3: Create the new cases
111
+
112
+ Create what the scope planned, before any run:
113
+
114
+ 1. **New use cases** — one `muggle-remote-use-case-create-from-prompts` call with every `newUseCases` instruction in its `instructions` array. Map each created use case back to its key.
115
+ 2. **New test cases** — one `muggle-remote-test-case-generate-from-prompt` per `newTestCases` entry, all in one message, with `projectId`, the resolved `useCaseId`, and the entry's `instruction`.
116
+ 3. **Create every generated case** — `muggle-remote-test-case-create` for each, in parallel. Accept the generator's decomposition as-is ([`../_shared/test-case-design.md`](../_shared/test-case-design.md)): N micro-tests from one instruction are N test cases. Record each `testCaseId` against its key; the report and a Stage 7.5 re-run name new cases by id.
117
+
118
+ A failed create leaves its entry `INCONCLUSIVE` with reason `case creation failed: <error>`; it stays in the report.
110
119
 
111
120
  ### Step 3.5: Satisfy each target's prerequisite chain
112
121
 
113
- For every test case selected in Step 3, resolve its prerequisite chain from the backend's test-plan graph and make each ancestor ready before the target runs, per [`../_shared/test-case-chain-readiness.md`](../_shared/test-case-chain-readiness.md). This stage is unattended, so follow that file's unattended-caller rule: a target whose chain cannot be satisfied is reported `INCONCLUSIVE` with reason `prerequisites unmet` and is not run.
122
+ For every test case in scope after Step 3, resolve its prerequisite chain from the backend's test-plan graph and make each ancestor ready before the target runs, per [`../_shared/test-case-chain-readiness.md`](../_shared/test-case-chain-readiness.md). This stage is unattended, so follow that file's unattended-caller rule: a target whose chain cannot be satisfied is reported `INCONCLUSIVE` with reason `prerequisites unmet` and is not run.
114
123
 
115
124
  A target that runs without its prerequisite state spends its step budget re-creating that state — signing in, seeding data — and reports on what it lacked rather than on the change under test. That verdict reads as a product failure and is worth less than no verdict.
116
125
 
@@ -118,7 +127,7 @@ Ancestors generated here are prerequisites, not results: they belong in neither
118
127
 
119
128
  ### Step 4: Run the dev loop, gather screenshots
120
129
 
121
- For each relevant test case, run the shared loop in [`../_shared/dev-loop/run.md`](../_shared/dev-loop/run.md): `muggle-remote-test-script-list` by `testCaseId` with `runEnvironmentType: "local"` (this stage runs against localhost) to pick [replay vs regen](../_shared/dev-loop/run.md), [execute with `timeoutMs`](../_shared/dev-loop/timeouts.md), [fetch the result](../_shared/dev-loop/failures.md) and [interpret failures](../_shared/dev-loop/failures.md), then read the studio-published [cloud refs and per-step screenshots](../_shared/dev-loop/publish.md) off the run result.
130
+ For each scoped test case, run the shared loop in [`../_shared/dev-loop/run.md`](../_shared/dev-loop/run.md): `muggle-remote-test-script-list` by `testCaseId` with `runEnvironmentType: "local"` (this stage runs against localhost) to pick [replay vs regen](../_shared/dev-loop/run.md), [execute with `timeoutMs`](../_shared/dev-loop/timeouts.md), [fetch the result](../_shared/dev-loop/failures.md) and [interpret failures](../_shared/dev-loop/failures.md), then read the studio-published [cloud refs and per-step screenshots](../_shared/dev-loop/publish.md) off the run result.
122
131
 
123
132
  Inputs to the loop: `mode` from the script-exists check, `localUrl`/project from Step 1.7, `cwd` = the working tree recorded in `state.md`.
124
133
 
@@ -127,7 +136,7 @@ Inputs to the loop: `mode` from the script-exists check, `localUrl`/project from
127
136
  For each test case:
128
137
  - Record pass or fail from the run result
129
138
  - If failed, capture the error message, failure step index, and `artifactsDir` for local debugging
130
- - In `local-e2e` mode, every relevant test case must be executed — generate a new script if none exists (no skips)
139
+ - In `local-e2e` mode, every scoped test case must be executed — generate a new script if none exists (no skips)
131
140
 
132
141
  ## Output
133
142
 
@@ -160,6 +169,12 @@ For each test case:
160
169
  - reason: `<one short sentence>`
161
170
  - steps: `[{ stepIndex, action, description, screenshotUrl }, ...]` (empty only when the run produced no steps)
162
171
 
172
+ **Scope:** (from `e2eScope`, after Step 3)
173
+ - impacted: `<testCaseId>`, ...
174
+ - new: `<key>` → `<testCaseId>`, ...
175
+ - retired (not run — deleted after merge): use case `<useCaseId>`, ...; test case `<testCaseId>` → replaced by `<testCaseId>` | removed, ...
176
+ - amendments: `<testCaseId>` — `<reason>`, ...
177
+
163
178
  **Metadata:**
164
179
  - projectId: `<projectId>`
165
180
 
@@ -182,6 +197,6 @@ Failed runs use the same evidence + diagnosis assembly as the interactive debug
182
197
  - No silent auth skip; always verify with `muggle-remote-auth-status` first.
183
198
  - Replay/timeout/result discipline per [`../_shared/dev-loop/run.md`](../_shared/dev-loop/run.md) — never hand-build `actionScript`, always pass `timeoutMs`, read structured run-result fields.
184
199
  - No hiding failures: surface errors, exit codes, and artifact paths.
185
- - In `local-e2e` mode, every relevant test case must be executed — generate a new script if none exists (no skips).
200
+ - In `local-e2e` mode, every scoped test case must be executed — generate a new script if none exists (no skips).
186
201
  - The studio publishes every run during execution, so screenshots are cloud-accessible for PR comments — read the refs off the run result, never re-publish.
187
202
  - **Never drop a test case from the report because it "couldn't run cleanly."** A test that didn't reach its assertion is `inconclusive`, not absent. Dropping it produces misleading verdicts and pushes downstream PR-comment renderers to hand-write the comment — which is the failure mode this stage exists to prevent.
@@ -1,21 +1,21 @@
1
1
  # Impact Analysis Agent (Stage 4)
2
2
 
3
- You are analyzing git repositories to determine which ones have actual code changes that need to go through the dev cycle pipeline.
3
+ You are analyzing git repositories to determine which ones have actual code changes that need to go through the dev cycle pipeline, and which use cases and test cases the E2E acceptance stage must run for them.
4
4
 
5
5
  ## Turn preamble
6
6
 
7
7
  Start the turn with:
8
8
 
9
9
  ```
10
- **Stage 4 — Impact analysis** — diffing each affected repo against its default branch.
10
+ **Stage 4 — Impact analysis** — diffing each affected repo against its default branch and scoping the E2E cases.
11
11
  ```
12
12
 
13
13
  ## Input
14
14
 
15
15
  You receive:
16
16
  - A list of repos with their local filesystem paths
17
- - The requirements goal and affected repos from the requirements stage
18
- - Pre-flight state, including `worktreePath` when a worktree was selected (see [`../_shared/use-worktrees.md`](../_shared/use-worktrees.md))
17
+ - The requirements goal, acceptance criteria, and affected repos from the requirements stage (`requirements.md`); in an address-reviews cycle, also the review-derived change items `build.md` was given
18
+ - Pre-flight state, including `worktreePath` when a worktree was selected (see [`../_shared/use-worktrees.md`](../_shared/use-worktrees.md)), and the `## Pre-flight answers` block's `Validation` and `projectId`
19
19
 
20
20
  ## Your Job
21
21
 
@@ -35,6 +35,7 @@ For each repo path provided:
35
35
  6. **List changed files:** Run `git diff --name-only <default-branch>...HEAD` to find files changed on this branch relative to the default branch. If no merge base exists, fall back to `git diff --name-only HEAD`.
36
36
  7. **Get the diff:** Run `git diff <default-branch>...HEAD` for the full diff.
37
37
  8. **Classify changed paths** to drive downstream test routing — emit `pathClassification` (see "Output state — pathClassification" below).
38
+ 9. **Scope the E2E cases** — map the diff and the acceptance criteria to the impacted existing use cases and test cases and the new ones to add; emit `e2eScope` (see "Output state — e2eScope" below).
38
39
 
39
40
  ## Output
40
41
 
@@ -91,3 +92,67 @@ cycleSize: <minor | full>
91
92
  ```
92
93
 
93
94
  `minor` only when every path in `cycleFiles` is in the `NO_APP_LOGIC_CHANGE` path set defined in [`e2e-acceptance.md`](e2e-acceptance.md); otherwise `full`. The rest of this stage still runs against the default branch, so a full cycle's E2E routes from `pathClassification` as in a forward run.
95
+
96
+ ## Output state — e2eScope
97
+
98
+ The case selection [`e2e-acceptance.md`](e2e-acceptance.md) runs. Stage 6 executes this scope rather than choosing its own, so the choice is made here, where the diff and the acceptance criteria are both in hand.
99
+
100
+ Scope only when this cycle runs E2E: `Validation` is `local-e2e`, `pathClassification` is not `none`, and in a watcher cycle `cycleSize` is `full`. Otherwise emit `e2eScope: not-scoped — <the condition that failed>`.
101
+
102
+ The criteria are the acceptance criteria in the session's `requirements.md`, plus each review-derived change item that alters behavior in an address-reviews cycle. A session with no `requirements.md` (an adopted PR) scopes from the diff alone and writes `criteria: []`.
103
+
104
+ ### Procedure
105
+
106
+ 1. **List the project's cases.** `muggle-remote-use-case-list` for the project the classification routes to (single-project repos: `projectId` from `state.md`), then `muggle-remote-test-case-list-by-use-case` for every use case, all in one message. `e2eScope` holds one entry per project, so `mixed` scopes each classification's project as its own entry.
107
+ 2. **Impacted use cases.** A use case is impacted when its flow passes through a page, route, component, endpoint, or data flow the diff changes, or when an acceptance criterion falls inside it.
108
+ 3. **Impacted test cases.** Under each impacted use case, a test case is impacted when it exercises a changed surface or verifies a behavior a criterion touches. When in doubt, include it: an extra replay costs minutes, a missed regression ships.
109
+ 4. **Retired cases.** A test case the change makes wrong fails by design, so it is retired, never impacted. Replaying it would send Stage 7.5 to repair the product back to the old behavior.
110
+ - **Replaced** — the change alters its expected outcome (a renamed label, a removed step, a new validation rule). Plan a new test case for the new expectation and name it in `replacedBy`.
111
+ - **Removed** — the change removes the feature it verifies. `replacedBy: none`.
112
+
113
+ A use case is retired only when the change removes its whole flow **and** every test case under it is retired: deleting a use case cascades to all its test cases and scripts, so one surviving test case keeps the use case. Retired cases are deleted after the PR merges ([`cleanup.md`](cleanup.md)), never during the cycle — an unmerged change must leave the project's suite intact for the default branch.
114
+ 5. **Map every criterion.** Each criterion carries `coveredBy` (impacted or new test cases that verify it) or `unobservable` (why no browser can observe it: a log line, a unit-test requirement, a config value). A criterion with neither is a scoping failure.
115
+ 6. **Plan the new cases.** Each uncovered criterion gets a new test case under the impacted use case its behavior belongs to, or under a new use case when none fits. A test case instruction names one atomic behavior to verify, with no signup, login, navigation, or seed-data steps, per [`../_shared/test-case-design.md`](../_shared/test-case-design.md); prerequisites come from the test-plan graph at run time ([`../_shared/test-case-chain-readiness.md`](../_shared/test-case-chain-readiness.md)).
116
+
117
+ This stage plans new cases and creates nothing. Stage 6 creates them, so a cycle that never reaches E2E leaves no cases behind in the project.
118
+
119
+ ### Shape
120
+
121
+ ```
122
+ e2eScope:
123
+ - projectId: <id>
124
+ impactedUseCases:
125
+ - useCaseId: <id>
126
+ title: <title>
127
+ reason: <changed path or criterion that puts it in scope>
128
+ impactedTestCases:
129
+ - testCaseId: <id>
130
+ useCaseId: <id>
131
+ title: <title>
132
+ reason: <changed path or criterion>
133
+ retiredUseCases:
134
+ - useCaseId: <id>
135
+ title: <title>
136
+ reason: <the flow the change removes>
137
+ retiredTestCases:
138
+ - testCaseId: <id>
139
+ title: <title>
140
+ reason: <the expectation the change alters, or the feature it removes>
141
+ replacedBy: <new test case key | none>
142
+ newUseCases:
143
+ - key: NUC1
144
+ instruction: <plain-English description of the use case>
145
+ newTestCases:
146
+ - key: NTC1
147
+ useCase: <useCaseId | new use case key>
148
+ instruction: <one atomic behavior to verify>
149
+ criteria:
150
+ - criterion: <acceptance criterion>
151
+ coveredBy: [<testCaseId | new test case key>, ...]
152
+ - criterion: <acceptance criterion>
153
+ unobservable: <why no browser can observe it>
154
+ ```
155
+
156
+ An empty list is written empty, never omitted; an absent list reads as "not scoped". Record the scope in this stage's marker in `iterations/<NNN>.md`, so Stage 6, a Stage 7.5 re-run, and a resumed session read the same one.
157
+
158
+ In a wave each member repo emits its own `e2eScope`, and [`wave-e2e.md`](wave-e2e.md) merges them.
@@ -36,7 +36,7 @@ Run [`e2e-acceptance.md`](e2e-acceptance.md) **once**, not once per repo, with t
36
36
 
37
37
  1. **Start the wave stack.** Invoke [`muggle-test-prepare`](../muggle-test-prepare/SKILL.md) with the wave members as `directoryOverrides` (repo → worktree path): every service whose repo is a wave member starts from that member's worktree path, not from the repo's usual checkout. Services from repos outside the wave start as the saved recipe says.
38
38
  2. **Confirm each wave service runs the wave branch.** A port that answers is not enough — the process on it may be a dev server the user left running from the default checkout. Check the readiness table: every wave service must report its member's worktree as its directory. A service that doesn't → halt and escalate with the table; never test a wave against a service running another branch.
39
- 3. **Select test cases against the union of diffs.** Steps 1.5–3 read impact analysis for every wave repo. A test case is relevant when any member's change touches its flow. `EMPTY_DIFF` applies only when every member's diff is empty.
39
+ 3. **Merge every member's scope.** Steps 1.5–3 read impact analysis for every wave repo, and the run's scope is the union of each member's `e2eScope`: a test case several members scope runs once, and a new case two members plan for the same criterion is created once. `EMPTY_DIFF` applies only when every member's diff is empty.
40
40
  4. **Run each selected test case once** against the combined stack. Do not repeat a case per repo.
41
41
  5. **Attribute failures.** For each Failed entry, name the member whose change the failing step implicates (`implicatedRepo: <owner/repo>`), or `unknown` when the evidence does not point at one. Stage 7.5 repairs in that repo.
42
42
 
@@ -49,7 +49,8 @@ Do not create or update a PR until each line holds, or is waived by a one-line r
49
49
  - Build clean — typecheck + lint on changed files
50
50
  - New/changed logic carries unit tests (authored in Stage 3; Stage 5 only runs the suite)
51
51
  - Unit suite run, PASS recorded
52
- - E2E verdict recorded with `runId` per `autoE2ETest` — or `[E2E FAILING]`, or `SKIPPED` citing a verified skip code from [`../do/e2e-acceptance.md`](../do/e2e-acceptance.md), where each code's verification rule lives. Free-text reasons are rejected by the gate
52
+ - Stage 4's `e2eScope` recorded, mapping every acceptance criterion to a test case or to `unobservable` — or `not-scoped` with the condition that failed
53
+ - E2E verdict recorded with `runId` for every case in that scope, per `autoE2ETest` — or `[E2E FAILING]`, or `SKIPPED` citing a verified skip code from [`../do/e2e-acceptance.md`](../do/e2e-acceptance.md), where each code's verification rule lives. Free-text reasons are rejected by the gate
53
54
  - UI changes verified in a real browser with evidence (screenshot path or muggle `runId`); `curl` + `grep` is not verification
54
55
 
55
56
  Opening a PR with an unchecked, unwaived line is a cycle failure. A Stage 6 readiness halt ([`../do/e2e-acceptance.md`](../do/e2e-acceptance.md) Step 0.5) leaves the E2E line open: no skip code, waiver, or explicit request to open the PR closes it.
@@ -5,6 +5,7 @@ mandatoryStages:
5
5
  - ../_shared/failure-mode-handling.md
6
6
  - ../_shared/debug-failed-run.md
7
7
  - ../_shared/identity-and-inbox.md
8
+ - ../_shared/test-case-design.md
8
9
  ---
9
10
 
10
11
  # Muggle Test — Change-Driven E2E Acceptance Router
@@ -41,16 +42,7 @@ Reach for these when the user is weighing Muggle Test against hand-written specs
41
42
 
42
43
  ## Test Case Design: One Atomic Behavior Per Test Case
43
44
 
44
- Every test case verifies exactly **one** user-observable behavior. Never bundle multiple concerns, sequential flows, or bootstrap/setup into a single test case — even if you think it would be "cleaner" or "more efficient."
45
-
46
- **Ordering and dependencies belong to the test-plan graph, not to the test case body.** The backend records which case depends on which; the run path reads that chain and runs the prerequisites first ([`_shared/test-case-chain-readiness.md`](../_shared/test-case-chain-readiness.md)). Your job is to describe the *atomic behavior to verify* — never the flow that gets there.
47
-
48
- - ❌ Wrong: one test case that "signs up, logs in, navigates to the detail modal, verifies icon stacking, verifies tab order, verifies history format, and verifies reference layout."
49
- - ✅ Right: four separate test cases — one per verifiable behavior — each with instruction text like "Verify the detail modal shows stacked pair of icons per card" with **no** signup / login / navigation / setup language.
50
-
51
- **Never bake bootstrap into a test case description.** Signup, login, seed data, prerequisite navigation, tear-down — none of these belong inside the test case body. Write only the verification itself. Setup arrives as its own prerequisite case: the chain runs ahead of the target, and the session it leaves behind is what the target starts from. Nothing is spliced into the case body.
52
-
53
- **Never consolidate the generator's output.** When `muggle-remote-test-case-generate-from-prompt` returns N micro-tests from a single prompt, that decomposition is the authoritative one. Do not "merge them into 1 for simplicity," do not "rewrite them to share bootstrap," do not "collapse them to match a 4 UC / 4 TC plan." Accept what the generator gave you.
45
+ Every test case verifies exactly **one** user-observable behavior, carries no signup, login, navigation, or seed-data steps, and the generator's decomposition is kept as-is. The full rule, with examples: [`_shared/test-case-design.md`](../_shared/test-case-design.md).
54
46
 
55
47
  **Never skip the generate→review cycle.** Even when you are 100% confident about the right shape, always present the generated test cases to the user before calling `muggle-remote-test-case-create`. "I'll skip the generate→review cycle and create directly" is a sign you're about to get it wrong.
56
48