kwikqa 0.2.5 → 0.3.0-rc.1
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/README.md +99 -3
- package/dist/kwikqa.mjs +122 -103
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -183,7 +183,7 @@ WebdriverIO wherever your package manager installed it inside the repository, in
|
|
|
183
183
|
| `npx kwikqa analyze --html` | Also write the [failure report](#failure-report), `kwikqa-report.html`; `--output <path>` writes it elsewhere. |
|
|
184
184
|
| `npx kwikqa report` | Write the failure report of the latest analysis without analyzing again or sending anything. `--run <id>` picks an earlier run under `.kwikqa/runs/`; `--output <path>` picks the file. |
|
|
185
185
|
| `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. |
|
|
186
|
-
| `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. |
|
|
186
|
+
| `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. 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). |
|
|
187
187
|
| `npx kwikqa validate` | Run the approved validation. The repaired test must pass three times in a row, with retries off. 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. |
|
|
188
188
|
| `npx kwikqa fix --retry` | After a failed validation, re-diagnose from the new evidence and propose one revised patch. |
|
|
189
189
|
| `npx kwikqa status` | Show your plan, team, and this month's usage. |
|
|
@@ -302,8 +302,10 @@ Run records, transaction journals, captures, and validation output stay on your
|
|
|
302
302
|
|
|
303
303
|
## CI
|
|
304
304
|
|
|
305
|
-
`analyze` and `ci` run unattended
|
|
306
|
-
|
|
305
|
+
`analyze` and `ci` run unattended. `fix` doesn't, because applying a patch needs a person, except as
|
|
306
|
+
a draft pull request in GitHub Actions, Azure Pipelines, or GitLab CI/CD, where a person approves by
|
|
307
|
+
merging: see
|
|
308
|
+
[Fix pull requests](#fix-pull-requests). Create a CI token at https://kwikqa.com/dashboard/account/ and store it as the secret
|
|
307
309
|
`KWIKQA_TOKEN`. Running KwikQA with it approves its diagnosis requests, and each request's preview
|
|
308
310
|
is printed to the job's log.
|
|
309
311
|
|
|
@@ -348,6 +350,71 @@ steps:
|
|
|
348
350
|
in the log and skipped; the exit code is the analysis's. Without a KwikQA token, or past your
|
|
349
351
|
plan's limit, the run is analyzed locally and the summary says why it wasn't diagnosed.
|
|
350
352
|
|
|
353
|
+
### Fix pull requests
|
|
354
|
+
|
|
355
|
+
In GitHub Actions, `kwikqa fix` can repair a failure on the runner and open the repair as a draft
|
|
356
|
+
pull request. Nothing lands until a person reviews and merges it. Opt in by committing a policy in
|
|
357
|
+
`kwikqa.config.json`:
|
|
358
|
+
|
|
359
|
+
```json
|
|
360
|
+
{
|
|
361
|
+
"ci": { "fix": { "pullRequests": "draft", "retry": false } }
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
Then run it after your tests, in the same job:
|
|
366
|
+
|
|
367
|
+
```yaml
|
|
368
|
+
permissions:
|
|
369
|
+
contents: write # for the fix branch
|
|
370
|
+
pull-requests: write # for the comment and the fix pull request
|
|
371
|
+
steps:
|
|
372
|
+
- uses: actions/checkout@v7
|
|
373
|
+
- run: npx playwright test
|
|
374
|
+
- if: failure()
|
|
375
|
+
run: npx kwikqa ci
|
|
376
|
+
env:
|
|
377
|
+
KWIKQA_TOKEN: ${{ secrets.KWIKQA_TOKEN }}
|
|
378
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
379
|
+
- if: failure()
|
|
380
|
+
run: npx kwikqa fix
|
|
381
|
+
env:
|
|
382
|
+
KWIKQA_TOKEN: ${{ secrets.KWIKQA_TOKEN }}
|
|
383
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
Also turn on "Allow GitHub Actions to create and approve pull requests" in the repository's or
|
|
387
|
+
organization's Actions settings.
|
|
388
|
+
|
|
389
|
+
- **What it does.** It re-runs the failing tests once to confirm the failure, asks for one repair,
|
|
390
|
+
and applies it to the runner's checkout. The repaired test must pass three times in a row, with
|
|
391
|
+
retries off. A failure is rolled back, and retried once only with `"retry": true`. One CI fix
|
|
392
|
+
counts as one fix, and it reuses the diagnosis `kwikqa ci` made.
|
|
393
|
+
- **The pull request.** A draft labeled `kwikqa`, from a new branch `kwikqa/fix-<id>` named after
|
|
394
|
+
the failure group. For a pull request's run, it goes into that pull request's branch, as a change
|
|
395
|
+
to the change; for any other branch's run, such as a nightly suite on `main`, into that branch.
|
|
396
|
+
Its description gives the diagnosis, the repair's intent, its validation, and which models were
|
|
397
|
+
asked. KwikQA builds its commit through GitHub's API, so the runner's git writes nothing, and it
|
|
398
|
+
never moves a branch it didn't create.
|
|
399
|
+
- **Only under the committed policy.** The policy counts only if `kwikqa.config.json` is exactly as
|
|
400
|
+
committed, and only for the runner's checkout, inside `GITHUB_WORKSPACE`. Each request, re-run,
|
|
401
|
+
and patch is printed in the log with what approved it.
|
|
402
|
+
- **One per failure group.** While a group's fix pull request is open, a later run of the same
|
|
403
|
+
failure asks for no repair and costs no fix; it updates one note on that pull request instead. A
|
|
404
|
+
`kwikqa/fix-` branch left after a closed pull request also holds the group back until you delete
|
|
405
|
+
it.
|
|
406
|
+
- **When it can't open one.** A fork's pull request, a run on a tag, and a job without
|
|
407
|
+
`GITHUB_TOKEN` are refused before any request, so they cost nothing. For a fork, the job summary
|
|
408
|
+
says what a maintainer can run. If the pull request's branch has changed the repaired file since
|
|
409
|
+
the run, nothing is committed.
|
|
410
|
+
- **Checks on the fix pull request.** GitHub doesn't start workflows for a pull request the job's
|
|
411
|
+
`GITHUB_TOKEN` opens; close and reopen it, or push to it, to run them. To have them start by
|
|
412
|
+
themselves, give `kwikqa fix` a token from your own GitHub App (`actions/create-github-app-token`)
|
|
413
|
+
as `GITHUB_TOKEN`.
|
|
414
|
+
- **Plans.** GitHub Free has no draft pull requests in private repositories, and KwikQA opens only
|
|
415
|
+
drafts. Azure Pipelines and GitLab CI/CD work the same way, as below; Jenkins still needs a
|
|
416
|
+
terminal for `fix`.
|
|
417
|
+
|
|
351
418
|
### Azure Pipelines
|
|
352
419
|
|
|
353
420
|
```yaml
|
|
@@ -379,6 +446,22 @@ and `System.AccessToken`, only through the step's `env`.
|
|
|
379
446
|
only.
|
|
380
447
|
- **Forks.** A fork's build gets no secrets unless the pipeline allows it. KwikQA analyzes it
|
|
381
448
|
locally and skips the thread.
|
|
449
|
+
- **Fix pull requests.** With a committed `ci.fix` policy, as in
|
|
450
|
+
[Fix pull requests](#fix-pull-requests), add a `kwikqa fix` step after `kwikqa ci`:
|
|
451
|
+
|
|
452
|
+
```yaml
|
|
453
|
+
- script: npx kwikqa fix
|
|
454
|
+
condition: failed()
|
|
455
|
+
env:
|
|
456
|
+
KWIKQA_TOKEN: $(KWIKQA_TOKEN)
|
|
457
|
+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
It repairs and validates on the agent, then opens a draft pull request on Azure Repos: for a pull
|
|
461
|
+
request's build, into its source branch, built on its source commit; for any other branch, into
|
|
462
|
+
that branch. The build service needs "Contribute", "Create branch", and "Contribute to pull
|
|
463
|
+
requests" on the repository. A repository on GitHub or Bitbucket, and a fork's build, are refused
|
|
464
|
+
before any request.
|
|
382
465
|
|
|
383
466
|
### GitLab CI/CD
|
|
384
467
|
|
|
@@ -412,6 +495,19 @@ The `exit 1` keeps the job failed: KwikQA exits with the analysis's code, which
|
|
|
412
495
|
project.
|
|
413
496
|
- **Forks.** A fork's merge request pipeline runs in the fork, without your project's variables.
|
|
414
497
|
KwikQA analyzes it locally and skips the note.
|
|
498
|
+
- **Fix merge requests.** With a committed `ci.fix` policy, as in
|
|
499
|
+
[Fix pull requests](#fix-pull-requests), run `kwikqa fix` after `kwikqa ci`:
|
|
500
|
+
|
|
501
|
+
```yaml
|
|
502
|
+
- npx playwright test || { npx kwikqa ci; npx kwikqa fix; exit 1; }
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
It repairs and validates in the job, then opens a draft merge request: for a merge request's
|
|
506
|
+
pipeline, into its source branch, built on its head commit; for a branch pipeline, into that
|
|
507
|
+
branch. The merge request is labeled `kwikqa` and removes its branch when merged. `GITLAB_TOKEN`
|
|
508
|
+
needs the `api` scope and at least the Developer role, to push the fix branch; a fine-grained
|
|
509
|
+
token isn't verified for this yet. A merge request from a fork, and a tag's pipeline, are refused
|
|
510
|
+
before any request.
|
|
415
511
|
|
|
416
512
|
### Jenkins
|
|
417
513
|
|