kwikqa 0.16.0-rc.1 → 0.16.0-rc.4

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.
package/CHANGELOG.md CHANGED
@@ -2,16 +2,31 @@
2
2
 
3
3
  What's new in each release of the KwikQA CLI.
4
4
 
5
- ## 0.16.0 — 2026-12-04
5
+ ## 0.16.0 — 2026-12-05
6
+
7
+ ### Added
8
+
9
+ - Opt in to `analyze --confirm-state` for a failing Cypress test when its diagnosis asks for an
10
+ `aria-expanded` check. KwikQA records up to 12 ordered expansion changes and offers one
11
+ separately previewed follow-up only if the same failure reproduces with that observation; the
12
+ follow-up may incur a charge.
6
13
 
7
14
  ### Changed
8
15
 
16
+ - When a failing Playwright attempt has no trace, `analyze` offers to re-run the failing tests once
17
+ with tracing before diagnosing, and `analyze --yes` (as in CI) does it without asking. Pass
18
+ `--no-capture` to turn this off. (KQA-154)
19
+ - Change evidence can include matching committed source hunks from sibling packages in the same
20
+ Git repository. The request preview lists outside paths with their hunk counts. Set
21
+ `"changes": { "scope": "workspace" }` in `kwikqa.config.json` to restrict the search to the
22
+ test workspace. (KQA-155)
9
23
  - KwikQA names the test or its environment as a failure's owner only with evidence of their
10
24
  fault, as it already did for the application. A test owner needs a cited application change or
11
25
  source, or a captured page, element, probe, or trace showing what the application does; an
12
26
  environment owner needs a browser or network failure. Without it, the owner is shown as a lean
13
27
  and the failure isn't repaired. The diagnosis prompt (1.8) says a test change can ask for
14
- something the application doesn't do yet.
28
+ something the application doesn't do yet. KwikQA withholds the test owner when all cited
29
+ evidence that supports test ownership also supports a plausible application regression.
15
30
 
16
31
  ## 0.15.0 — 2026-12-02
17
32
 
package/README.md CHANGED
@@ -100,9 +100,8 @@ export const config = {
100
100
 
101
101
  `@wdio/json-reporter` and JUnit reports work too: `npx kwikqa analyze --report <directory>`.
102
102
 
103
- KwikQA's reporters write to `test-results/kwikqa/`, which `analyze` finds on its own. Cypress and
104
- WebdriverIO keep no trace of a failure; run `npx kwikqa analyze --capture` and KwikQA re-runs the
105
- failing specs and records each failure's page (see below).
103
+ KwikQA's reporters write to `test-results/kwikqa/`, which `analyze` finds on its own. To record
104
+ browser evidence for failures, see [Capturing failure evidence](#capturing-failure-evidence).
106
105
 
107
106
  `login` signs you in at kwikqa.com/device: with GitHub for a personal account, or with your work
108
107
  email or your company's single sign-on for a company account. Hobby needs no payment details.
@@ -162,8 +161,8 @@ npx kwikqa analyze --report reports/junit.xml --html
162
161
 
163
162
  You get failure groups, a diagnosis, and the [failure report](#failure-report). Only the runs named
164
163
  under [supported frameworks](#supported-frameworks) are repaired and validated. For a report-only run,
165
- `fix` explains why and makes no model request. The CLI's `--capture` flag works with Playwright,
166
- Cypress, and WebdriverIO. For Playwright repairs, use its JSON reporter as shown above.
164
+ `fix` explains why and makes no model request. For Playwright capture and repair, use its JSON
165
+ reporter as shown above. See [Capturing failure evidence](#capturing-failure-evidence).
167
166
 
168
167
  Some details depend on the reporter:
169
168
 
@@ -212,6 +211,11 @@ repository root. So the root's `node_modules` works, but a copy installed only i
212
211
  doesn't. It never runs one from outside the repository, so pnpm's global virtual store
213
212
  (`enableGlobalVirtualStore`) isn't supported.
214
213
 
214
+ Change evidence defaults to `"repository"`, the Git repository containing the workspace. Set
215
+ `"changes": { "scope": "workspace" }` in the test package's `kwikqa.config.json` to search only
216
+ that package. Source filters use paths relative to the package for its own files, including
217
+ packages under directories such as `build/qa`. See [what the preview shows](#what-is-sent-and-where).
218
+
215
219
  If your tests run with a runner other than the one your test files resolve, name its folder in
216
220
  `kwikqa.config.json`. Microsoft's Playwright repository is an example: it runs its own tests with a
217
221
  pinned stable runner. Add `"runner": { "playwright": "tests/playwright-test/stable-test-runner" }`,
@@ -219,17 +223,44 @@ and KwikQA re-runs and validates with the `@playwright/test` that folder's own `
219
223
  resolves. `kwikqa init` proposes the folder when a `package.json` script starts Playwright from
220
224
  it. kwikqa before 0.15.0 refuses a config with a `runner` section.
221
225
 
226
+ ## Capturing failure evidence
227
+
228
+ If any failing attempt in a Playwright JSON report lacks a trace file, `analyze` offers to re-run
229
+ the failing tests with the project's own Playwright and config before diagnosis. Press Enter to
230
+ accept. With `--yes`, as in CI, it captures without asking. Pass `--no-capture` to skip the
231
+ offer. If the capture fails, KwikQA diagnoses the original report. Traces stay on the machine,
232
+ and the evidence preview shows what would be sent.
233
+
234
+ Use `analyze --capture` to request capture explicitly. Playwright re-runs the failing tests
235
+ with full tracing. Cypress and WebdriverIO re-run the failing specs with your config plus
236
+ KwikQA's reporter and failure capture, recording each failed attempt's DOM, command log, console,
237
+ and network. Explicit capture requires terminal approval or `--yes`.
238
+
239
+ Use `analyze --capture --confirm-state` to allow one extra Cypress run when a diagnosis
240
+ leaves ownership open and asks about `aria-expanded`. The follow-up records up to 12
241
+ expansion changes during the single failing test. If the same failure reproduces and a
242
+ change enters the evidence preview, KwikQA can request a second diagnosis. It uses a
243
+ revised owner only when the graded answer cites a recorded change for ownership.
244
+ The follow-up has its own run and evidence approvals, which `--yes` accepts.
245
+
246
+ With Playwright 1.59+ and [Playwright CLI](https://www.npmjs.com/package/@playwright/cli) installed,
247
+ capture can also pause locator failures at the failing line and ask Playwright for locators of
248
+ nearby elements. `analyze --no-probe` skips this step.
249
+
250
+ `fix` can reuse the saved capture for the same report. When it diagnoses a report for the first
251
+ time, it follows the same capture offer and approval rules.
252
+
222
253
  ## Commands
223
254
 
224
255
  | Command | What it does |
225
256
  | --- | --- |
226
- | `npx kwikqa analyze` | Diagnose the failures in the latest report. `--report <path>` picks a report file or a directory of one run's reports; `--framework` names the framework of a JUnit report; `--local` builds the evidence summary without sending anything; `--no-changes` leaves out recent code changes (see below). |
227
- | `npx kwikqa analyze --capture` | First re-run the failing tests so every failure has full evidence. Playwright runs with full tracing; with Playwright 1.59+ and [Playwright CLI](https://www.npmjs.com/package/@playwright/cli) installed, it also pauses locator failures at the failing line and asks Playwright for locators of the closest elements (`--no-probe` skips this). Cypress and WebdriverIO re-run the failing specs with your own config plus KwikQA's reporter and failure capture, which records each failed attempt's DOM, command log, console, and network. Asks before running anything; `--yes` approves in CI. |
257
+ | `npx kwikqa analyze` | Diagnose the failures in the latest report. `--report <path>` picks a report file or a directory of one run's reports; `--framework` names the framework of a JUnit report; `--local` builds the evidence summary without sending anything; `--no-changes` leaves out recent code changes (see below). See [Capturing failure evidence](#capturing-failure-evidence). |
258
+ | `npx kwikqa analyze --capture` | Request a re-run to [capture failure evidence](#capturing-failure-evidence). |
228
259
  | `npx kwikqa analyze --html` | Also write the [failure report](#failure-report), `kwikqa-report.html`; `--output <path>` writes it elsewhere. |
229
260
  | `npx kwikqa report` | Write a report from a recorded analysis. Choose HTML (default), JSON or Markdown with `--format`. Use `--run <id>` to select a run and `--output <path>` to choose the file. |
230
261
  | `npx kwikqa summarize` | Count results from every participating suite offline by default. Use `--suite <id>` and, for parallel jobs, `--shard <id>`. Use `--manifest <path>` to reconcile the shard summaries with CI. Both modes write JSON to stdout or the file given by `--output`. See [Suite coverage](#suite-coverage). |
231
262
  | `npx kwikqa flakes` | Review recurring Playwright retry passes across saved CI manifests. Use `--as-of <utc>` to reproduce the 30-day window and `--output <path>` to save the JSON. See [Runner-local retry history](#runner-local-retry-history). |
232
- | `npx kwikqa ci` | In a CI job: analyze as `analyze --yes --html` does, then publish a summary. On GitHub Actions that is the job summary and one pull-request comment, on Azure Pipelines a build summary and one pull-request thread, on GitLab CI/CD the job's log and one merge-request note, and on Jenkins the console log and one comment on a GitHub or GitLab pull request; with your webhooks, also a Slack or Teams message. See [CI](#ci). Without a KwikQA token it analyzes locally. It takes `--report`, `--framework`, `--local`, `--no-changes`, and `--output` as `analyze` does, and `--notify always` to post to chat after every run, not only failed ones. |
263
+ | `npx kwikqa ci` | Analyze the existing report in a CI job, write the failure report, and publish a summary. On GitHub Actions that is the job summary and one pull-request comment, on Azure Pipelines a build summary and one pull-request thread, on GitLab CI/CD the job's log and one merge-request note, and on Jenkins the console log and one comment on a GitHub or GitLab pull request; with your webhooks, also a Slack or Teams message. See [CI](#ci). Without a KwikQA token it analyzes locally. It takes `--report`, `--framework`, `--local`, `--no-changes`, and `--output` as `analyze` does, and `--notify always` to post to chat after every run, not only failed ones. |
233
264
  | `npx kwikqa fix` | Propose a repair for a test-side cause, show the diff and validation commands, and apply it if you approve. First it offers to re-run the failing tests once: a test that passes now is flaky, so KwikQA reports it and requests no repair. It starts with the failure group whose test-side diagnosis is strongest; if the model declines, or its proposal fails KwikQA's checks, it asks about the next such group, at most three, each with its own preview. One `fix` counts as one fix however many groups it tries. `--group <n>` repairs only group n, as `analyze` numbered it. `--propose-only` stops after the proposal. A repair of shared test support, such as a page object, fixture, or helper, is validated over every test that uses it: first those tests run once on the current code, after you approve, and afterwards each must pass again, three times in a row for Playwright, Cypress, and WebdriverIO and once for Maven, Gradle, and pytest, so a test the patch breaks is caught. In GitHub Actions, Azure Pipelines, and GitLab CI/CD, a committed `ci.fix` policy lets it run without a terminal and open a draft pull request; see [Fix pull requests](#fix-pull-requests). |
234
265
  | `npx kwikqa validate` | Run the approved validation. The repaired test must pass three times in a row, with retries off (once, for a shared Maven, Gradle, pytest, or Cucumber-JVM repair). Passing keeps the patch; failing rolls it back. When other tests failed with the same cause, it then offers to re-run them once and names any that still fail, so you can run `fix` again for them; the patch stays either way. |
235
266
  | `npx kwikqa fix --retry` | After a failed validation, re-diagnose from the new evidence and propose one revised patch. |
@@ -380,8 +411,10 @@ the failure names: locator text and test ids, expected and received values, and
380
411
  paths. Only matching hunks of source files are kept, at most 12, each with its commit's subject
381
412
  line. The subjects of the commits searched (at most 20) and the names of source files with
382
413
  uncommitted changes are listed too. Author names, emails, commit bodies, and documentation are
383
- never read. The preview says how
384
- many changed hunks a request carries. `--no-changes` on `analyze` and `fix` leaves them out.
414
+ never read. The preview shows the number of changed hunks and lists paths outside the workspace
415
+ with their hunk counts. Symlink and submodule changes are excluded. `--no-changes` on `analyze`,
416
+ `ci`, and `fix` turns off change evidence. See [the monorepo configuration](#package-managers-and-monorepos)
417
+ and the [Git evidence boundary](docs/architecture/trust-boundaries.md#source-and-git).
385
418
 
386
419
  - **Hobby, Pro, Teams, Enterprise:** the redacted packet goes to the KwikQA service, which forwards it unchanged to
387
420
  OpenRouter and the model endpoint shown in the preview. Requests go only to endpoints with a
@@ -82,6 +82,37 @@ function serialize(root) {
82
82
  let commands = [];
83
83
  let consoleEntries = [];
84
84
  let screenshots = [];
85
+ let expansionChanges = [];
86
+ let expansionObserver;
87
+ const MAX_EXPANSION_CHANGES = 12;
88
+
89
+ function observeExpansion(records) {
90
+ // Changes to one element can be delivered together. The next mutation's old value
91
+ // is the preceding mutation's new value, even if the element has since changed again.
92
+ const nextValue = new Map();
93
+ const changes = [];
94
+ const start = Math.max(0, records.length - MAX_LOG);
95
+ for (let index = records.length - 1; index >= start; index--) {
96
+ const { target, oldValue } = records[index];
97
+ const current = nextValue.has(target)
98
+ ? nextValue.get(target)
99
+ : target.getAttribute("aria-expanded");
100
+ nextValue.set(target, oldValue);
101
+ if (
102
+ oldValue !== current &&
103
+ (oldValue === "true" || oldValue === "false") &&
104
+ (current === "true" || current === "false")
105
+ ) {
106
+ changes.push({
107
+ control: (target.getAttribute("aria-label") || target.tagName).slice(0, 120),
108
+ before: oldValue === "true",
109
+ after: current === "true",
110
+ });
111
+ if (changes.length === MAX_EXPANSION_CHANGES) break;
112
+ }
113
+ }
114
+ expansionChanges = [...expansionChanges, ...changes.reverse()].slice(-MAX_EXPANSION_CHANGES);
115
+ }
85
116
 
86
117
  function brief(attributes) {
87
118
  const props = attributes.renderProps || {};
@@ -105,6 +136,8 @@ Cypress.on("test:before:run", () => {
105
136
  commands = [];
106
137
  consoleEntries = [];
107
138
  screenshots = [];
139
+ expansionChanges = [];
140
+ expansionObserver?.takeRecords();
108
141
  });
109
142
  Cypress.on("log:added", (attributes) => {
110
143
  if (commands.length < MAX_LOG) commands.push(brief(attributes));
@@ -114,6 +147,19 @@ Cypress.on("log:changed", (attributes) => {
114
147
  if (index >= 0) commands[index] = brief(attributes);
115
148
  });
116
149
  Cypress.on("window:before:load", (win) => {
150
+ if (settings.observeExpanded === true) {
151
+ if (expansionObserver !== undefined) {
152
+ observeExpansion(expansionObserver.takeRecords());
153
+ expansionObserver.disconnect();
154
+ }
155
+ expansionObserver = new win.MutationObserver(observeExpansion);
156
+ expansionObserver.observe(win.document, {
157
+ attributes: true,
158
+ attributeOldValue: true,
159
+ attributeFilter: ["aria-expanded"],
160
+ subtree: true,
161
+ });
162
+ }
117
163
  for (const level of ["error", "warn"]) {
118
164
  const original = win.console[level];
119
165
  win.console[level] = (...args) => {
@@ -153,6 +199,7 @@ afterEach(function kwikqaCapture() {
153
199
  typeof test.currentRetry === "function" ? test.currentRetry() : test._currentRetry || 0;
154
200
  const spec = Cypress.spec.relative;
155
201
  cy.document({ log: false }).then((doc) => {
202
+ if (expansionObserver !== undefined) observeExpansion(expansionObserver.takeRecords());
156
203
  const snapshot = serialize(doc.documentElement);
157
204
  const network = commands
158
205
  .filter(
@@ -183,6 +230,7 @@ afterEach(function kwikqaCapture() {
183
230
  dom: snapshot.tree,
184
231
  domTruncated: snapshot.truncated,
185
232
  commands: commands.map(({ id, ...rest }) => rest),
233
+ ...(expansionChanges.length === 0 ? {} : { expansionChanges }),
186
234
  console: consoleEntries,
187
235
  network,
188
236
  screenshots,