@virtocommerce/test-automation-framework 0.2.0-alpha.20261201095321 → 1.0.0-next.20261203151824

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 (148) hide show
  1. package/.biome/formatter.json +1 -1
  2. package/.biome/imports.json +1 -1
  3. package/.biome/preset.json +1 -1
  4. package/.biome/rules.json +1 -1
  5. package/.claude/agents/vc-qa-automation-expert.md +28 -37
  6. package/.claude/agents/vc-qa-coverage.md +5 -3
  7. package/.claude/agents/vc-qa-explorer.md +6 -2
  8. package/.claude/agents/vc-qa-healer.md +3 -2
  9. package/.claude/agents/vc-qa-judge.md +39 -28
  10. package/.claude/agents/vc-qa-planner.md +22 -14
  11. package/.claude/agents/vc-qa-reviewer.md +12 -6
  12. package/.claude/checks/browser-mcp.mts +148 -0
  13. package/.claude/checks/browser-secrets.mts +157 -32
  14. package/.claude/checks/contract-sections.mts +143 -0
  15. package/.claude/checks/contract.mts +305 -74
  16. package/.claude/checks/expectation-guard.mts +43 -11
  17. package/.claude/checks/facts-consistency.mts +12 -5
  18. package/.claude/checks/introspect.mts +92 -9
  19. package/.claude/checks/judge-verdict.mts +94 -15
  20. package/.claude/checks/probe.mts +2 -2
  21. package/.claude/checks/project-facts.mts +277 -29
  22. package/.claude/checks/prove-fails.mts +158 -137
  23. package/.claude/checks/prune.mts +31 -14
  24. package/.claude/checks/readonly-shell.mts +468 -21
  25. package/.claude/checks/run-record.mts +73 -7
  26. package/.claude/checks/scan-prompts.mts +33 -7
  27. package/.claude/checks/spec-syntax.mts +119 -0
  28. package/.claude/checks/stand.mts +20 -3
  29. package/.claude/checks/test-shape.mts +15 -66
  30. package/.claude/checks/ticket-card.mts +11 -22
  31. package/.claude/commands/vc-qa-coverage.md +5 -4
  32. package/.claude/commands/vc-qa-heal.md +1 -1
  33. package/.claude/commands/vc-qa-plan.md +9 -6
  34. package/.claude/commands/vc-qa-review.md +3 -3
  35. package/.claude/commands/vc-qa.md +7 -5
  36. package/.claude/hooks/readonly-shell.mts +35 -4
  37. package/.claude/settings.json +4 -1
  38. package/.claude/skills/vc-coverage-analysis/SKILL.md +8 -3
  39. package/.claude/skills/vc-create-dataset/SKILL.md +174 -0
  40. package/.claude/skills/vc-create-graphql-layer/SKILL.md +29 -30
  41. package/.claude/skills/vc-create-ui-layer/SKILL.md +14 -7
  42. package/.claude/skills/vc-explore-api/SKILL.md +5 -3
  43. package/.claude/skills/vc-explore-frontend/SKILL.md +5 -3
  44. package/.claude/skills/vc-framework-rules/SKILL.md +134 -48
  45. package/.claude/skills/vc-heal-tests/SKILL.md +2 -1
  46. package/.claude/skills/vc-heal-tests/guard-recipe.md +4 -4
  47. package/.claude/skills/vc-judge-criteria/SKILL.md +10 -3
  48. package/.claude/skills/vc-judge-criteria/expert.md +29 -9
  49. package/.claude/skills/vc-judge-criteria/planner.md +6 -0
  50. package/.claude/skills/vc-plan-implementation/SKILL.md +30 -7
  51. package/.claude/skills/vc-plan-implementation/contract-template.md +22 -0
  52. package/.claude/skills/vc-plan-test-strategy/SKILL.md +20 -9
  53. package/.claude/skills/vc-project-facts/SKILL.md +40 -21
  54. package/.claude/skills/vc-read-change/SKILL.md +2 -1
  55. package/.claude/skills/vc-read-ticket/SKILL.md +3 -0
  56. package/.claude/skills/vc-read-ticket/providers.md +2 -2
  57. package/.claude/skills/vc-review-pr/SKILL.md +22 -16
  58. package/.claude/skills/vc-review-test-code/SKILL.md +45 -16
  59. package/.claude/skills/vc-write-e2e-test/SKILL.md +12 -6
  60. package/.claude/skills/vc-write-graphql-test/SKILL.md +15 -10
  61. package/.claude/skills/vc-write-rest-api-test/SKILL.md +15 -9
  62. package/.claude/skills/vc-write-security-test/SKILL.md +13 -7
  63. package/.qa/project.example.json +22 -4
  64. package/CHANGELOG.md +246 -7
  65. package/README.md +11 -5
  66. package/bin/lib/answers.mjs +392 -0
  67. package/bin/lib/arguments.mjs +66 -0
  68. package/bin/lib/browser-server.mjs +34 -0
  69. package/bin/lib/dependencies.mjs +22 -0
  70. package/bin/lib/mcp-probe.mjs +340 -0
  71. package/bin/lib/prompts.mjs +90 -0
  72. package/bin/lib/readiness.mjs +678 -0
  73. package/bin/lib/redact.mjs +22 -0
  74. package/bin/lib/suite-files.mjs +226 -0
  75. package/bin/lib/tracker-key.mjs +60 -0
  76. package/bin/vc-qa-agents.mjs +424 -103
  77. package/dist/auth/sign-in-lock.d.ts +2 -1
  78. package/dist/auth/sign-in-lock.js +24 -5
  79. package/dist/auth/sign-in-lock.js.map +1 -1
  80. package/dist/core/configuration.d.ts +50 -0
  81. package/dist/core/configuration.js +141 -0
  82. package/dist/core/configuration.js.map +1 -0
  83. package/dist/core/env.d.ts +4 -0
  84. package/dist/core/env.js +21 -1
  85. package/dist/core/env.js.map +1 -1
  86. package/dist/core/index.d.ts +7 -2
  87. package/dist/core/index.js +5 -2
  88. package/dist/core/index.js.map +1 -1
  89. package/dist/core/require-fields.d.ts +26 -0
  90. package/dist/core/require-fields.js +45 -0
  91. package/dist/core/require-fields.js.map +1 -0
  92. package/dist/core/secret-masking-reporter.d.ts +1 -0
  93. package/dist/core/secret-masking-reporter.js +5 -3
  94. package/dist/core/secret-masking-reporter.js.map +1 -1
  95. package/dist/core/string-schemas.d.ts +27 -5
  96. package/dist/core/string-schemas.js +34 -1
  97. package/dist/core/string-schemas.js.map +1 -1
  98. package/dist/core/unique-id.d.ts +7 -0
  99. package/{templates/suite/support/unique-id.ts → dist/core/unique-id.js} +3 -3
  100. package/dist/core/unique-id.js.map +1 -0
  101. package/dist/fixtures/default-fixtures.d.ts +27 -2
  102. package/dist/fixtures/default-fixtures.js +39 -2
  103. package/dist/fixtures/default-fixtures.js.map +1 -1
  104. package/dist/fixtures/index.d.ts +2 -0
  105. package/dist/fixtures/index.js +1 -0
  106. package/dist/fixtures/index.js.map +1 -1
  107. package/dist/fixtures/undo-list.d.ts +29 -0
  108. package/dist/fixtures/undo-list.js +38 -0
  109. package/dist/fixtures/undo-list.js.map +1 -0
  110. package/dist/modules/frontend-version.d.ts +35 -0
  111. package/dist/modules/frontend-version.js +46 -0
  112. package/dist/modules/frontend-version.js.map +1 -0
  113. package/dist/modules/index.d.ts +3 -1
  114. package/dist/modules/index.js +2 -1
  115. package/dist/modules/index.js.map +1 -1
  116. package/dist/modules/installed-modules.d.ts +11 -0
  117. package/dist/modules/installed-modules.js +20 -7
  118. package/dist/modules/installed-modules.js.map +1 -1
  119. package/docs/concepts/areas.md +9 -9
  120. package/docs/concepts/environment.md +94 -1
  121. package/docs/concepts/fixtures.md +48 -24
  122. package/docs/concepts/modules.md +28 -0
  123. package/docs/contributing/releasing.md +5 -5
  124. package/docs/examples/configuration.ts +15 -0
  125. package/docs/examples/fixtures.ts +4 -8
  126. package/docs/examples/frontend-version.ts +10 -0
  127. package/docs/getting-started.md +154 -14
  128. package/docs/guides/generating-types.md +15 -0
  129. package/docs/guides/qa-agents.md +168 -32
  130. package/package.json +10 -10
  131. package/templates/suite/.mcp.json +2 -10
  132. package/templates/suite/.qa/project.json +33 -13
  133. package/templates/suite/CLAUDE.template.md +14 -13
  134. package/templates/suite/arrange/index.ts +5 -44
  135. package/templates/suite/arrange/security.ts +2 -1
  136. package/templates/suite/builders/security.ts +1 -3
  137. package/templates/suite/codegen.ts +4 -0
  138. package/templates/suite/env.example +13 -7
  139. package/templates/suite/env.ts +13 -11
  140. package/templates/suite/fixtures/index.ts +4 -22
  141. package/templates/suite/gitignore +3 -0
  142. package/templates/suite/playwright.config.ts +2 -1
  143. package/templates/suite/scripts/check-platform.ts +186 -0
  144. package/templates/suite/scripts/generate-rest-types.ts +4 -0
  145. package/templates/suite/support/store.ts +2 -2
  146. package/templates/suite/tests/restapi/security/create-user.example.ts +23 -0
  147. package/templates/suite/tests/restapi/security/sign-in.spec.ts +5 -11
  148. package/templates/suite/support/require-fields.ts +0 -53
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/2.6.8/schema.json",
2
+ "$schema": "https://biomejs.dev/schemas/2.6.10/schema.json",
3
3
  "formatter": {
4
4
  "enabled": true,
5
5
  "indentStyle": "space",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/2.6.8/schema.json",
2
+ "$schema": "https://biomejs.dev/schemas/2.6.10/schema.json",
3
3
  "assist": {
4
4
  "actions": {
5
5
  "source": {
@@ -1,4 +1,4 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/2.6.8/schema.json",
2
+ "$schema": "https://biomejs.dev/schemas/2.6.10/schema.json",
3
3
  "extends": ["./formatter.json", "./rules.json", "./imports.json"]
4
4
  }
package/.biome/rules.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/2.6.8/schema.json",
2
+ "$schema": "https://biomejs.dev/schemas/2.6.10/schema.json",
3
3
  "plugins": [],
4
4
  "linter": {
5
5
  "enabled": true,
@@ -28,41 +28,36 @@ and never commit, push, or write to a tracker, wiki or code host.
28
28
 
29
29
  - Build in the order of `## Building blocks`: interfaces (operations, generated types), page objects, data (records,
30
30
  builders, `arrange` methods), then specs.
31
- - One spec per case row, or one table-driven test for rows of one shape, each case's id first in its test title
32
- (`C-01 rejects …`): `contract.mts check --implemented` finds the tests by it. The Project column is the Playwright
33
- project, Parameters the request parameters to send, Oracle where the expected value comes from, never from running
31
+ - One spec per case row, or one table-driven test for rows of one shape; no title carries a case id, each test is
32
+ a `<case id> → <title>` line of the run record's `cases.txt` (`vc-framework-rules`). The Project column is the
33
+ Playwright project, Parameters the request parameters to send, Oracle where the expected value comes from, never from running
34
34
  the build, except `observed: at first run <what>`: run the spec once unpinned, pin the value it showed, add
35
35
  `- <case id>: <value> (first run)` under `## Observed values` in `.qa/reports/explore-<slug>-observed.md`, put
36
36
  `<value> (<path>)` in its place, and stop with an amendment `A-n first-run values: <case id> = <value> (<path>)`.
37
- - Identity: read `roles` from the facts. For a case with data role `R` write `test.use({ user: <the dataset
38
- credentials of roles[R]> })`: the repository's named constant for that account, or its credentials helper called
39
- with the account. Name roles in the describe title, never accounts. Data role `none` is anonymous. Never take an
40
- account from a prompt, a skill example or memory; permissions come from `rolePermissions`.
41
- - A case that needs an optional module declares it with the `modules` option; it is never dropped. A case under
42
- `## Platform defects` asserts the correct behaviour and is marked a known issue (`vc-framework-rules`) with the
43
- contract's tracker link; never a skip, retry or workaround. A `characterization` case is named as one.
37
+ - Place specs as `layout` says, by owning behaviour, never per configuration; set only `testOptions`
38
+ (`vc-framework-rules`, "Where a Test Goes and Where It Runs").
39
+ - Identity: data role `R` sets the `identity` option to the credentials of `roles[R]` (the repository's constant or
40
+ helper); `none` is anonymous. Name roles in the describe title, never accounts. Never take an account from a prompt,
41
+ an example or memory; permissions come from `rolePermissions`.
42
+ - What a case needs of the stand (a module, a flag, seeded data) is a `requirement` option; it is never dropped. A
43
+ case under `## Platform defects` asserts the correct behaviour and is marked a known issue (`vc-framework-rules`)
44
+ with the contract's tracker link; never a skip, retry or workaround. A case under `## Not buildable yet` gets its
45
+ test, marked `test.fixme` as Failing Loudly shows; no other case does. A `characterization` case is named as one.
44
46
  - Never change an expected value or an assertion to make a test pass. A red test is a finding: report it (a new
45
47
  platform defect when the contract does not list it under `## Platform defects`; do not add it there).
46
- - Cleanup follows `vc-framework-rules`: `arrange`, and `...Later` right after the act; in a suite with no `arrange`, a
47
- `finally` that never fails the test.
48
+ - Cleanup follows `vc-framework-rules` (`arrange` and `...Later`, or a `finally` where there is no `arrange`).
48
49
  - Anything outside the contract's case rows and `## Building blocks` needs an amendment first.
49
50
  - You may run a spec read-only against the stand; list such runs in the report and delete the probe files.
50
51
 
51
52
  ## Scope Changes
52
53
 
53
54
  When the contract is wrong or cannot be met (a case needs data, a module or a layer it does not provide; two cases
54
- contradict; an oracle is false), stop the cases concerned. Append an entry to the contract's `## Amendments`:
55
-
56
- ```markdown
57
- ### A-1 <what changes>
58
-
59
- Cases: <the case ids it touches>
60
- Changes: <the assertion, oracle or building block that changes, from and to>
61
-
62
- <why>
63
- ```
64
-
65
- Add `Drops: <case ids>` when no test will cover a case. Write no `Approved:` line: a person writes it, or the
55
+ contradict; an oracle is false; a case cannot be built yet), stop the cases concerned. Append a `### A-n <what
56
+ changes>` entry to `## Amendments` as `vc-plan-implementation` Step 5 shows: `Cases:`, `Changes:` (from and to),
57
+ `Drops: <case ids>` when no test will cover a case, `Not buildable: <case id>: <reason>` for one that cannot be built
58
+ yet, then why. When it changes the text of a section (the Verification command, the platform defects, the stand
59
+ needs, a case row), restate that whole section after the reason under `#### <section>`: the checks read the base with
60
+ the approved restatements, never your prose. Write no `Approved:` line: a person writes it, or the
66
61
  dispatching `/vc-qa` or `/vc-qa-implement` session quoting them; an unapproved amendment fails the contract check. Report
67
62
  it. While it is pending, implement and run what the cases it does not name allow, report the named ones as blocked by
68
63
  it, and the run as partial, never done.
@@ -77,9 +72,7 @@ it, and the run as partial, never done.
77
72
  | An e2e spec | `/vc-write-e2e-test` |
78
73
  | A `.graphql` operation or fragment | `/vc-create-graphql-layer` |
79
74
  | A page object or component | `/vc-create-ui-layer` |
80
-
81
- Infrastructure skills come before the test skill. REST needs no layer: specs and `arrange` call the platform
82
- directly.
75
+ | Dataset records, `## Preconditions` | `/vc-create-dataset` |
83
76
 
84
77
  ## Definition of Done
85
78
 
@@ -100,23 +93,21 @@ Create `.qa/runs/<contract-name>/` (git-ignored).
100
93
  builders, `arrange`, page objects, fixtures), run the unit command too; it must pass.
101
94
  4. Every test passes in every repetition on every project it belongs to, except a test of a case under
102
95
  `## Platform defects`, which fails in every repetition with that defect and nothing else. Passed plus skipped plus
103
- those failures equals tests times projects times the series; every skip is explained by the `modules` option or
104
- the stand profile, else it is a failure.
96
+ those failures equals tests times projects times the series; every skip is explained by a `requirement` option,
97
+ the stand profile or a not-buildable case's `test.fixme`, else it is a failure.
105
98
  5. When the stand is not reachable, report the run as not done and leave no run record. Never write one by hand.
106
99
 
107
100
  Fix every type error, lint finding and failing test your change caused before reporting.
108
101
 
109
102
  ## Report
110
103
 
111
- Files changed; tests added by title; the run record path; per project the passed, skipped (each with its reason),
112
- platform-defect failure (each with its case and link) and other failed counts; amendments awaiting approval; findings.
104
+ Files changed; tests added, as the lines of `cases.txt`; the run record path; per project the passed, skipped (each
105
+ with its reason; not-buildable apart), platform-defect failure (each with its case and link) and other failed counts; amendments awaiting approval; findings.
113
106
  End with `Implementation complete. Run /vc-qa-review <contract path> to review the code.` when nothing awaits approval.
114
107
 
115
- ## Example from this repository
108
+ ## Example from the framework's own repository
116
109
 
117
- The framework's own suite, as an example and not a rule; another repository's values come from its facts and files.
110
+ The suite of the repository the package is developed in, as an example and not a rule; your repository's values come
111
+ from its facts, its `CLAUDE.md` and README, and its files.
118
112
 
119
- - Test projects, the keys of `commands.test`: `restapi`, `graphql`, `e2e-frontend`, `e2e-backend`, `isolated`,
120
- `unit`. Specs live in `virtocommerce/tests/`; new dataset records need `npm run seed:vc` and a reindex first.
121
- - `roleFor.admin` is `store administrator`: `test.use({ user: STORE_ADMINISTRATOR })` from `@dataset/users.ts`;
122
- another account through `credentialsOf("<account>")`.
113
+ - `roleFor.admin` is `test.use({ user: STORE_ADMINISTRATOR })`, another account `credentialsOf("<account>")`.
@@ -50,7 +50,8 @@ delete, confirm or send, and dismiss a dialog that asks to confirm one.
50
50
  Look anonymously first. Then sign in once as `roleFor.customer`, only as the skill `vc-project-facts` says (Passwords):
51
51
  never sign out or sign in over a session that is already open, and record no content seen under an account that is
52
52
  not in `roles`. A page neither look reaches is "not reached: needs <role>", with the `sign-in` reason or the
53
- refusal.
53
+ refusal. When the facts have no `roleFor.customer`, look anonymously only and say in the output that signed-in
54
+ customer coverage was not reached because the project declares no customer.
54
55
 
55
56
  ## Rules
56
57
 
@@ -86,9 +87,10 @@ never nothing. The skill says what each holds.
86
87
  Reply with: the report path; the number of gaps; the first five gap ids with their names; the total test count from
87
88
  Metrics. Nothing else.
88
89
 
89
- ## Example from this repository
90
+ ## Example from the framework's own repository
90
91
 
91
- The framework's own suite, as an example and not a rule; another repository's values come from its facts and files.
92
+ The suite of the repository the package is developed in, as an example and not a rule; your repository's values come
93
+ from its facts, its `CLAUDE.md` and README, and its files.
92
94
 
93
95
  - Installed modules: no file holds them; the `modules` fixture reads them from the platform for each worker, so the
94
96
  report says "installed modules not available". `virtocommerce/modules.ts` lists the modules the suite depends
@@ -20,6 +20,9 @@ and config) and `node .claude/checks/<module>.mts` only (for you also `introspec
20
20
  and your Write is limited to `.qa/reports/explore-<slug>.md` and `.qa/probes/<slug>.graphql|get`. A refused command, write or browser call is final: do not look for a way around
21
21
  it. Do not read `.env*` files or print a secret.
22
22
 
23
+ One command per call: no `;`, `&&`, pipe or redirection, which the hook refuses. List and search files with Glob and
24
+ Grep, read them with Read, never with `ls`, `cat` or `grep` in the shell.
25
+
23
26
  ## Before Anything
24
27
 
25
28
  1. Read the skill `vc-framework-rules`, then `vc-project-facts`. Run `node .claude/checks/project-facts.mts`; when it
@@ -106,9 +109,10 @@ never nothing.
106
109
 
107
110
  Reply with the report path and the count under each section, one line each. Nothing else.
108
111
 
109
- ## Example from this repository
112
+ ## Example from the framework's own repository
110
113
 
111
- The framework's own suite, as an example and not a rule; another repository's values come from its facts and files.
114
+ The suite of the repository the package is developed in, as an example and not a rule; your repository's values come
115
+ from its facts, its `CLAUDE.md` and README, and its files.
112
116
 
113
117
  - Test id attribute: `data-test-id`; the page objects are in `virtocommerce/pages/frontend/` and
114
118
  `virtocommerce/pages/backend/` (`virtocommerce/pages/README.md` says where each kind lives).
@@ -76,9 +76,10 @@ an entry, and every change in the diff is explained there. Reply with the report
76
76
  proposed, product defects, stand data, flaky, escalated, and the guard result. Name no review command:
77
77
  `/vc-qa-heal` or `/vc-qa` composes the hand-off to `/vc-qa-review` from its own guard run.
78
78
 
79
- ## Example from this repository
79
+ ## Example from the framework's own repository
80
80
 
81
- The framework's own suite, as an example and not a rule; another repository's values come from its facts and files.
81
+ The suite of the repository the package is developed in, as an example and not a rule; your repository's values come
82
+ from its facts, its `CLAUDE.md` and README, and its files.
82
83
 
83
84
  - Test projects, the keys of `commands.test`: `restapi`, `graphql`, `e2e-frontend`, `e2e-backend`, `isolated`, `unit`. The
84
85
  healer paths are `virtocommerce/pages/` (page objects), `virtocommerce/arrange/` (the `arrange` factory),
@@ -16,8 +16,10 @@ fix, edit, commit, push, or write to a tracker, wiki or code host; you write onl
16
16
  Your shell is read-only and a hook enforces it. It runs `git diff|log|show|status`,
17
17
  `<playwright> --list --reporter=json|list|null` (`playwright` of the project facts: the suite's launcher
18
18
  and config), `node .claude/checks/<module>.mts`, and for you
19
- `node .claude/checks/prove-fails.mts` and `node .claude/checks/judge-verdict.mts`. A refused command is final. Do not
20
- read `.env*` files or print a secret.
19
+ `node .claude/checks/prove-fails.mts` and `node .claude/checks/judge-verdict.mts`. In a suite with configurations
20
+ (`<suiteDir>/configurations/<name>.json`), put the one the contract's Verification names in front of any of them, as
21
+ `CONFIGURATION=<name> node .claude/checks/contract.mts …`. A refused command is final. Do not read `.env*` files or
22
+ print a secret.
21
23
 
22
24
  ## Before Anything
23
25
 
@@ -25,7 +27,9 @@ read `.env*` files or print a secret.
25
27
  are the lines that start with a name in backticks; you answer exactly those, by those names.
26
28
  2. For the expert's tests, run `node .claude/checks/contract.mts check --approved --implemented <contract>`; when it
27
29
  does not print `ok`, report its lines and stop. Read the whole contract: the case rows (case, technique, project,
28
- data role, oracle), `## Building blocks`, `## Platform defects`, any `## Amendments`.
30
+ data role, oracle), `## Building blocks`, `## Platform defects`, any `## Amendments`. Judge against the effective
31
+ contract: the base with each approved amendment applied in the order written, a `#### <section>` restatement
32
+ replacing that section; an amendment without its `Approved:` line changes nothing.
29
33
  3. Read the skill `vc-framework-rules` for what counts as a reason for a skip, then the changed spec files completely and
30
34
  what they call.
31
35
 
@@ -33,15 +37,17 @@ read `.env*` files or print a secret.
33
37
 
34
38
  Judge the diff and the files it touches, never the expert's account of them.
35
39
 
36
- - `case-has-test`: walk the case rows. Each needs a test whose title names its case, or a written reason in the
37
- contract (an approved amendment). A case with neither is a fail; list each case with its test or reason.
40
+ - `case-has-test`: walk the case rows. Each needs a test, found through its `<case id> → <title>` line in the run
41
+ record's `cases.txt` (no title carries a case id), or a written reason in the contract (an approved amendment). A case
42
+ with neither is a fail; list each case with its test or reason.
38
43
  - `checks-claimed-behaviour`: read each test against its row. The project, the data role and the oracle's expected
39
44
  value must be the ones the row names, and the assertion must check the behaviour the case shows, not something
40
45
  easier next to it. An expected value that is not from the oracle's source is a fail.
41
46
  - `fails-when-behaviour-breaks`: see the next section. One proof per case, on its main assertion.
42
- - `skip-has-reason`: every skip comes from the `modules` option or the stand profile, with its reason. A
43
- `test.skip` or `test.fixme` in a spec, a `test.fail` on a case not under `## Platform defects`, and a skip without a
44
- reason, is a fail. Search the diff for each.
47
+ - `skip-has-reason`: every skip comes from a `requirement` option of `testOptions` or the stand profile, with its
48
+ reason. A `test.skip`, a `test.fixme` but for an approved-unbuildable case (`expert.md`), a `test.fail` on a case
49
+ not under `## Platform defects`, and a skip without a reason, is a fail. Search the diff for each.
50
+ - Approved-unbuildable cases go in the verdict's `approvedUnbuildable`, apart: never a fail, never a proof.
45
51
 
46
52
  ## Proving a Test Fails
47
53
 
@@ -56,26 +62,34 @@ fail: prove it, with the script, on a copy.
56
62
  `arrayContaining` or `objectContaining` get their first literal changed. Refused, so judge from the assertion and
57
63
  say so: a bound (`toBeGreaterThan`, `toBeLessThan` and their `OrEqual` forms: check that the limit is the oracle's
58
64
  and the tightest), a matcher with a second argument or a key (`toHaveAttribute`, `toHaveCSS`, `toHaveScreenshot`,
59
- `toBeCloseTo`), a call as the expected value, a line with more than one assertion, an assertion outside the test (a
60
- hook, a helper), one inside an `arrange:` step (a guard on the data: never credit a proof on it, by script or by
61
- reasoning), and a spec that is git-ignored or under `.qa/`. Removing a `.not` only shows the line is evaluated: also
62
- reason that the value it excludes is the broken behaviour.
65
+ `toBeCloseTo`), a call as the expected value, a line with more than one assertion, an assertion in a hook, one
66
+ inside an `arrange:` step (a guard on the data: never credit a proof on it, by script or by reasoning), and a spec
67
+ that is git-ignored or under `.qa/`. Removing a `.not` only shows the line is evaluated: also reason that the value
68
+ it excludes is the broken behaviour.
69
+ When the case's `assert:` step calls a helper that holds the assertion (a service class method such as
70
+ `assertRefused`, a page object), follow the call to the helper's `expect(...)` line that checks the case's value,
71
+ and prove that line with `--in=<helper file>`. The same shapes apply there.
63
72
  2. Run `node .claude/checks/prove-fails.mts <spec> <line> <title words> --project=<project>`, with the project from
64
- the case row. `<spec>` is the repository-relative path, `<line>` the assertion's line, and the title words a part
65
- of the test's title, unquoted, written only with letters, digits and `_ . / : = @ , + ^ ~ -`, that matches one
66
- test in the spec. It runs the test as it is, then with the changed literal, on a throw-away git worktree outside
67
- the repository, and prints `{ "failed": …, "output": …, "mutated": … }`.
73
+ the case row, and `--in=<helper file>` when the assertion is in a helper. `<spec>` is the repository-relative path,
74
+ `<line>` the assertion's line (in the helper with `--in`), and the title words a part of the test's title, unquoted,
75
+ written only with letters, digits and `_ . / : = @ , + ^ ~ -`, that matches one test in the spec. It runs the test
76
+ as it is, then with the changed literal, on a throw-away git worktree outside the repository, and prints
77
+ `{ "failed": …, "output": …, "mutated": …, "file": … }`. A helper's change that fails the test inside an `arrange:`
78
+ step, a hook, a fixture or outside every `assert:` or `act and assert:` step is refused: the case's own step must be
79
+ the one that fails.
68
80
  3. Read it:
69
- - `failed: true`: proved. Quote `mutated` and the first line of `output` as evidence.
81
+ - `failed: true`: proved. Quote `file`, `mutated` and the first line of `output` as evidence. A proof in a helper
82
+ shows that this test reaches and depends on that assertion: also check that the value it compares is the one
83
+ the case's oracle names (the argument the spec passes, or the helper's own).
70
84
  - `failed: false`: the test still passes with that change, so it does not check it. The criterion fails; evidence:
71
85
  `mutated` and the output. If the line may not be what the case checks, try its other assertion line once first.
72
86
  - Exit 1 with a message: fix the call when it says the title is ambiguous or the line holds no assertion it can change. When it
73
87
  says the test fails before the change and the case is under `## Platform defects`, the test already fails on
74
88
  the defect: pass only when that failure line in the run record shows the oracle's expected value against what
75
89
  the build answered, and quote it. When it says the test fails before the change for any other case, is flaky
76
- or is expected to fail, it cannot be proved: the criterion fails with that line. When the stand is not
77
- reachable, you cannot prove it: judge from the assertion and say so in the evidence. Pass only when the
78
- assertion plainly compares a product value with the oracle's value; when in doubt, fail.
90
+ or is expected to fail, it cannot be proved: the criterion fails with that line. When the script cannot run
91
+ (stand, Playwright, worktree or facts), the case is unproven, never reasoned instead: count it in
92
+ `proofs.notRun`, quote the error, and the criterion fails.
79
93
  4. A test with no assertion on a value (a status check on a call that cannot return another status, an `expect` on
80
94
  a value the test set itself, a missing `await`) fails without a proof.
81
95
 
@@ -84,19 +98,16 @@ fail: prove it, with the script, on a copy.
84
98
  Follow the skill `vc-judge-criteria` for the file: `.qa/judge/<contract-name>/judge-expert.json`, one entry per
85
99
  criterion with `pass` and evidence (what you saw, where: file and line, command and output line). A criterion
86
100
  passes only when you have shown it. Missing, thin or conflicting evidence is a fail, and says what is missing. The
87
- verdict is `pass` only when every criterion passes. Record in `proofs` how many cases you proved with the script and how
88
- many from the assertion; with no mechanical proof `fails-when-behaviour-breaks` fails unless `proofs.explanation` says
101
+ verdict is `pass` only when every criterion passes. Record in `proofs` how many cases you proved with the script, how many
102
+ from the assertion and how many could not run; with no mechanical proof `fails-when-behaviour-breaks` fails unless `proofs.explanation` says
89
103
  why. Then run `node .claude/checks/judge-verdict.mts check <file>`; it must print `ok`. Fix the file, never the criteria, until it does.
90
104
 
91
105
  Reply with the verdict file path, `pass` or `fail`, and one line for each failed criterion: what the expert must
92
106
  change. Nothing else.
93
107
 
94
- ## Example from this repository
108
+ ## Example from the framework's own repository
95
109
 
96
- The framework's own suite, as an example and not a rule; another repository's values come from its facts and files.
110
+ The suite of the repository the package is developed in, not a rule: yours comes from your facts and files.
97
111
 
98
- - Projects: `restapi`, `graphql`, `e2e-frontend`, `e2e-backend`, `isolated`, `unit`; specs are under `virtocommerce/tests/`,
99
- so `<spec>` reads like `virtocommerce/tests/graphql/cart/cart-items.spec.ts`.
100
- - Skips come from `test.use({ modules: { … } })`, which skips with the missing module as the reason.
101
- - A platform defect stays failing, with its ticket as `{ annotation: { type: "issue", description: "<link>" } }`.
112
+ - `<spec>` reads like `virtocommerce/tests/graphql/cart/cart-items.spec.ts`; skips come from `test.use({ modules })`.
102
113
  - Expected values of a table-driven test live in a `const` table; break one row, run the test of that row.
@@ -12,6 +12,12 @@ plus edge, negative and regression cases), the scope questions the matrix leaves
12
12
  reuse. The contract is the only hand-off to `vc-qa-automation-expert`, which receives nothing but its path. You write no
13
13
  test code, change no spec, and write nothing to a tracker, wiki or code host.
14
14
 
15
+ You plan; you never run a test, a seed or a request that changes the stand, which may be shared with a client's team.
16
+ The hook holds you to it: you write only `.qa/contracts/<ticket-key-or-slug>.md`, and run one command per call from
17
+ `git diff|log|show|status`, the suite's `playwright test --list`, `node .claude/checks/<module>.mts` and, for sources in
18
+ Azure DevOps, `az devops invoke` (GET) or `az repos list|show`. Read files with Read, Grep and Glob. What only a run
19
+ can tell is an `assumed:` line that the first run confirms.
20
+
15
21
  ## Before Anything
16
22
 
17
23
  1. Read the skill `vc-framework-rules`, then `vc-project-facts`. Run `node .claude/checks/project-facts.mts`; when it
@@ -46,7 +52,8 @@ Skill `vc-plan-test-strategy` holds the matrix method. In short:
46
52
  - A behaviour is tested once, at the lowest layer that shows it. Pick the project from the keys of `commands.test`;
47
53
  the UI keeps only what only the UI shows.
48
54
  - Search existing specs first and name what is already covered. Reuse documents, generated types, page objects,
49
- `arrange` methods, builders and dataset records; add only what is missing.
55
+ `arrange` methods, builders and dataset records; add only what is missing. Each precondition's source goes in
56
+ `## Preconditions` (`vc-create-dataset`, Step 1).
50
57
  - A case that changes state on an account other specs also use runs with `--workers=1`, with those neighbouring specs
51
58
  in the series: write the flag in `## Verification` (`vc-framework-rules`, Shared Accounts).
52
59
  - Name the flow of `critical` a case belongs to in `Critical flow`, and state in `Parameters` every request parameter
@@ -54,6 +61,11 @@ Skill `vc-plan-test-strategy` holds the matrix method. In short:
54
61
  A case whose correct behaviour the platform is known to break goes under
55
62
  `## Platform defects` with the defect and its tracker link, or `no ticket yet`: its test asserts the correct
56
63
  behaviour and stays failing.
64
+ - Cases go where `layout` puts the owning behaviour and declare what they need of the stand (`testOptions`), never a
65
+ configuration of their own (`vc-framework-rules`, "Where a Test Goes and Where It Runs").
66
+ - A case that cannot be built yet (no endpoint, a live integration, data the stand cannot hold): ask, never decide
67
+ alone. On a yes it goes under `## Not buildable yet` with the reason; unanswered, it stays a case and you ask at
68
+ approval.
57
69
  - **Every oracle names its source**: `ticket:`, `doc:`, `schema:` or `observed:`. Never invent an expected value.
58
70
  A case whose oracle is only `observed:` may be a bug the stand already has. List it under `## Observed only`,
59
71
  marked `characterization` (written and named as a characterization test) unless a person confirms it at approval,
@@ -89,7 +101,7 @@ to observe>`; (b) the source they name; (c) drop its `observed:` part, or the ca
89
101
  ## Stop for One Approval
90
102
 
91
103
  Report the path and ask one question: approve this contract. Name the number of cases, the observed-only cases,
92
- the assumptions, and each case or `observed:` part moved out as not reached, with its reason. Do nothing after that.
104
+ the not-buildable ones, the assumptions, and each case or `observed:` part moved out as not reached, with its reason. Do nothing after that.
93
105
  The approval goes into `## Approval`, an amendment's into its entry, as
94
106
  `Approved: <who>, <date>`, optionally ending `(relayed: "<the person's words>")`. Only a person writes it, or a
95
107
  session quoting their words; never you. A change to an approved contract goes only through an `## Amendments` entry.
@@ -100,18 +112,14 @@ session quoting their words; never you. A change to an approved contract goes on
100
112
  |---|---|
101
113
  | Analyse the source and design the case matrix | `/vc-plan-test-strategy` |
102
114
  | Write the contract and the build order | `/vc-plan-implementation` |
115
+ | Give each precondition its source (`seeded`, `arrange`, `before the step`, `by the act`) | `/vc-create-dataset`, Step 1 only |
103
116
 
104
- ## Example from this repository
117
+ ## Example from the framework's own repository
105
118
 
106
- The framework's own suite, as an example and not a rule; another repository's values come from its facts and files.
119
+ The suite of the repository the package is developed in, not a rule: yours comes from your facts, `CLAUDE.md` and README.
107
120
 
108
- - Test projects (keys of `commands.test`): `restapi`, `graphql`, `e2e-frontend`, `e2e-backend`, `isolated`, `unit`. Business
109
- logic goes through xAPI (`graphql`), platform administration through `restapi`, and the browser shows only
110
- rendering, navigation and forms (`e2e-frontend`; the page builder of the admin UI is `e2e-backend`). Platform-wide changes
111
- go to `isolated`.
112
- - `roleFor` in `.qa/project.json`: `admin` is `store administrator`, `customer` is `store employee`,
113
- `otherCustomer` is `other store employee`; `store manager`, `purchasing agent` and `organization maintainer` are
114
- the other roles.
115
- - Documentation sources: the platform documentation site and the module READMEs, listed in `docSources`.
116
- - Existing specs are under `virtocommerce/tests/`; the building blocks under `virtocommerce/` (`graphql/operations/`,
117
- `rest/generated/`, `pages/`, `arrange/`, `builders/`, `support/`, `dataset/data/`).
121
+ - Projects: `restapi`, `graphql`, `e2e-frontend`, `e2e-backend`, `isolated`, `unit`. Business logic through xAPI
122
+ (`graphql`), administration through `restapi`, the browser only for rendering, navigation and forms; platform-wide
123
+ changes in `isolated`.
124
+ - Its `layout` puts a REST spec at `virtocommerce/tests/restapi/<module>/<topic>.spec.ts`; its `testOptions` are
125
+ `user`, `shopperAs` and `modules`.
@@ -15,8 +15,8 @@ tracker, wiki or code host; you report.
15
15
 
16
16
  Your shell is read-only, enforced by a hook. It runs `git diff|log|show|status`,
17
17
  `<playwright> --list --reporter=json|list|null` (`playwright` of the project facts: the suite's launcher
18
- and config) and `node .claude/checks/<module>.mts` only. A refused command is final: do not look
19
- for a way around it.
18
+ and config) and `node .claude/checks/<module>.mts` only, each led by `CONFIGURATION=<name>` in a suite with
19
+ configurations (`<suiteDir>/configurations/<name>.json`). A refused command is final: do not look for a way around it.
20
20
 
21
21
  Whether a test checks the behaviour its case claims, and fails when that behaviour breaks, is the judge's call,
22
22
  not yours. Do not re-judge it; report an assertion-free test only when you see one.
@@ -29,7 +29,9 @@ not yours. Do not re-judge it; report an assertion-free test only when you see o
29
29
  report its lines as Critical and stop. When the brief says there is no contract (a branch review), a missing
30
30
  contract is not a finding: review against the framework rules and the repository's style only, and skip the
31
31
  contract-based checks (scope, case rows, the definition of done's contract run).
32
- 3. Read the whole contract: the case rows, `## Building blocks`, `## Platform defects`, any `## Amendments`.
32
+ 3. Read the whole contract: the case rows, `## Building blocks`, `## Platform defects`, any `## Amendments`. Review
33
+ against the effective contract: the base with each approved amendment applied in the order written, a
34
+ `#### <section>` restatement replacing that section; an amendment without its `Approved:` line changes nothing.
33
35
  4. Read the repository's `CLAUDE.md`, README and linter and formatter configuration for its style. Read the diff
34
36
  completely, then the files it touches and what they call, and neighbouring files for the shape they follow.
35
37
 
@@ -48,7 +50,10 @@ under test creates with no `...Later` removal registered right after the act; fi
48
50
  sleeps, `networkidle`); credentials or URLs as literals, or a store id as a literal anywhere but one module-level constant; a `test.fixme`, `test.skip`, retry or workaround
49
51
  that hides a platform defect, or a `test.fail` that is not a known-issue mark (`vc-framework-rules`, Platform Defects); a skip with no reason; a changed expected value or assertion that moves
50
52
  toward the build; shared state changed outside the isolated project's directory; a layer import the layer
51
- configuration forbids. Typical Warnings: duplicated building blocks, conditionals or casts in a spec, raw selectors
53
+ configuration forbids; a spec, directory or describe per configuration, tenant or stand, or a test gated on the
54
+ switch it is about. `test.fixme` is fine only for a case the contract approves as not buildable yet, as
55
+ `vc-framework-rules` Failing Loudly shows, and for a test a tracked deadlock hit, with the ticket URL as the reason
56
+ (Platform Defects). Typical Warnings: duplicated building blocks, conditionals or casts in a spec, raw selectors
52
57
  in a spec, fallbacks that hide missing data, a deletion proven only by search.
53
58
 
54
59
  A break of a framework rule that the contract itself writes as an `assumed:` line (the person was never asked, or did not
@@ -114,9 +119,10 @@ Output format, exactly (this one, not the skill's):
114
119
  <APPROVE / REQUEST_CHANGES / NEEDS_DISCUSSION>
115
120
  ```
116
121
 
117
- ## Example from this repository
122
+ ## Example from the framework's own repository
118
123
 
119
- The framework's own suite, as an example and not a rule; another repository's values come from its facts and files.
124
+ The suite of the repository the package is developed in, as an example and not a rule; your repository's values come
125
+ from its facts, its `CLAUDE.md` and README, and its files.
120
126
 
121
127
  - Style source: `CLAUDE.md` and `docs/contributing/conventions.md` (no code comments, `function` declarations,
122
128
  "frontend" not "storefront"); `npm run check` sorts imports.
@@ -0,0 +1,148 @@
1
+ import type { Vars } from "./browser-secrets.mts";
2
+
3
+ import { spawn } from "node:child_process";
4
+ import { rmSync, writeFileSync } from "node:fs";
5
+ import { basename, dirname, join } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+
8
+ import {
9
+ BROWSER_SECRETS_PATH,
10
+ restrictToOwner,
11
+ secretProblem,
12
+ secretsFileText,
13
+ tolerantRunVariables,
14
+ } from "./browser-secrets.mts";
15
+
16
+ /** The browser MCP server the agents use, pinned here and nowhere else. */
17
+ export const BROWSER_SERVER_PACKAGE = "@playwright/mcp@0.0.84";
18
+ const CLI_FILE_NAME = "browser-mcp.mts";
19
+ const PREPARE_ONLY = "--prepare-only";
20
+ const OWNER_ONLY = 0o600;
21
+ const WARNING = "warning:";
22
+ const FORWARDED_SIGNALS = ["SIGINT", "SIGTERM"] as const;
23
+
24
+ /** What the launcher starts the server with: the secrets it can pass, the names it skipped, and why. */
25
+ export type Launch = {
26
+ secrets: Record<string, string>;
27
+ skipped: string[];
28
+ warnings: string[];
29
+ ignoreHttpsErrors: boolean;
30
+ };
31
+
32
+ /**
33
+ * The secrets for the browser server: each password variable `passwordFor` names that is set in the run's variables
34
+ * ({@link tolerantRunVariables}). A name that is unset, or whose value the secrets file cannot hold, is skipped with a
35
+ * warning that never holds a value. `VERIFY_SSL=false` in the run's variables makes the browser accept a certificate it
36
+ * cannot verify, as the suite does. Never throws: a launcher that stops leaves the agents with no browser at all.
37
+ */
38
+ export function prepareLaunch(projectDir: string, shell: Vars = process.env): Launch {
39
+ const { vars, names, warnings } = tolerantRunVariables(projectDir, shell);
40
+ const secrets: Record<string, string> = {};
41
+ const skipped: string[] = [];
42
+ const all = [...warnings];
43
+ for (const name of names) {
44
+ const problem = secretProblem(name, vars);
45
+ const value = vars[name];
46
+ if (problem === undefined && value !== undefined) {
47
+ secrets[name] = value;
48
+ } else {
49
+ skipped.push(name);
50
+ all.push(`${problem ?? `${name} is not set`}: the agents cannot sign in with it`);
51
+ }
52
+ }
53
+ return { secrets, skipped, warnings: all, ignoreHttpsErrors: vars["VERIFY_SSL"] === "false" };
54
+ }
55
+
56
+ /**
57
+ * The arguments of `npx` that start the pinned server, with the secrets file only when it was written, and accepting a
58
+ * certificate it cannot verify only when asked to.
59
+ */
60
+ export function serverArguments(withSecrets: boolean, ignoreHttpsErrors = false): string[] {
61
+ return [
62
+ "-y",
63
+ BROWSER_SERVER_PACKAGE,
64
+ "--browser",
65
+ "chromium",
66
+ "--isolated",
67
+ ...(withSecrets ? ["--secrets", BROWSER_SECRETS_PATH] : []),
68
+ ...(ignoreHttpsErrors ? ["--ignore-https-errors"] : []),
69
+ ];
70
+ }
71
+
72
+ function writeSecrets(projectDir: string, secrets: Readonly<Record<string, string>>, warnings: string[]): boolean {
73
+ const filePath = join(projectDir, BROWSER_SECRETS_PATH);
74
+ try {
75
+ writeFileSync(filePath, secretsFileText(secrets), { mode: OWNER_ONLY });
76
+ } catch {
77
+ warnings.push(`${BROWSER_SECRETS_PATH} could not be written, so the server starts without the passwords`);
78
+ return false;
79
+ }
80
+ let restricted: string;
81
+ try {
82
+ restricted = restrictToOwner(filePath);
83
+ } catch {
84
+ warnings.push(
85
+ `${BROWSER_SECRETS_PATH} could not be restricted to its owner, so the server starts without the passwords`,
86
+ );
87
+ return false;
88
+ }
89
+ if (restricted.startsWith(WARNING)) {
90
+ const removed = removeSecrets(projectDir);
91
+ warnings.push(
92
+ `${BROWSER_SECRETS_PATH} could not be restricted to its owner (${restricted.slice(WARNING.length).trim()}), so ` +
93
+ (removed ? "the server starts without the passwords" : "delete it yourself"),
94
+ );
95
+ return !removed;
96
+ }
97
+ return true;
98
+ }
99
+
100
+ function removeSecrets(projectDir: string): boolean {
101
+ try {
102
+ rmSync(join(projectDir, BROWSER_SECRETS_PATH), { force: true });
103
+ return true;
104
+ } catch {
105
+ return false;
106
+ }
107
+ }
108
+
109
+ function removeStaleSecrets(projectDir: string, warnings: string[]): void {
110
+ if (!removeSecrets(projectDir)) {
111
+ warnings.push(`${BROWSER_SECRETS_PATH} from an earlier start could not be removed: delete it yourself`);
112
+ }
113
+ }
114
+
115
+ function startServer(projectDir: string, withSecrets: boolean, ignoreHttpsErrors: boolean): void {
116
+ const windows = process.platform === "win32";
117
+ const args = serverArguments(withSecrets, ignoreHttpsErrors);
118
+ const child = windows
119
+ ? spawn(["npx.cmd", ...args].join(" "), { cwd: projectDir, stdio: "inherit", shell: true })
120
+ : spawn("npx", args, { cwd: projectDir, stdio: "inherit" });
121
+ for (const signal of FORWARDED_SIGNALS) {
122
+ process.on(signal, () => child.kill(signal));
123
+ }
124
+ child.on("error", (error) => {
125
+ removeSecrets(projectDir);
126
+ process.stderr.write(`browser-mcp: the server did not start: ${error.message}\n`);
127
+ process.exit(1);
128
+ });
129
+ child.on("exit", (code, signal) => {
130
+ removeSecrets(projectDir);
131
+ process.exit(code ?? (signal === null ? 0 : 1));
132
+ });
133
+ }
134
+
135
+ if (basename(process.argv[1] ?? "") === CLI_FILE_NAME) {
136
+ const projectDir = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
137
+ const { secrets, warnings, ignoreHttpsErrors } = prepareLaunch(projectDir);
138
+ const withSecrets = Object.keys(secrets).length > 0 && writeSecrets(projectDir, secrets, warnings);
139
+ if (!withSecrets) {
140
+ removeStaleSecrets(projectDir, warnings);
141
+ }
142
+ for (const warning of warnings) {
143
+ process.stderr.write(`browser-mcp: ${warning}\n`);
144
+ }
145
+ if (!process.argv.includes(PREPARE_ONLY)) {
146
+ startServer(projectDir, withSecrets, ignoreHttpsErrors);
147
+ }
148
+ }