@piwitests/reporter 0.52.0 → 0.54.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piwitests/reporter",
3
- "version": "0.52.0",
3
+ "version": "0.54.0",
4
4
  "description": "Playwright reporter that streams results, traces and HTML reports to a Piwi Dashboard instance",
5
5
  "url": "https://github.com/PiwiTests/platform",
6
6
  "homepage": "https://piwitests.dev",
@@ -19,7 +19,7 @@ Prefer the **Piwi MCP server** if it is connected to this agent (tools named `li
19
19
 
20
20
  3. **Group by cause.** Call `get_failure_groups` (or `list_clusters` / `get_cluster`) — failures that share a root cause are clustered, so you fix one thing, not five. Work cluster by cluster.
21
21
 
22
- 4. **Read the evidence per cluster.** Call `get_cluster_context` — the same SCM-grounded context the built-in diagnosis uses: representative errors, test steps, console logs, failing network requests, ARIA snapshots, and the **diff of files changed since the last green run**. If a diagnosis already exists, `get_cluster_diagnosis` returns its root cause and suggested fix.
22
+ 4. **Read the evidence per cluster.** Call `get_cluster_context` — the same SCM-grounded context the built-in diagnosis uses: representative errors, test steps, console logs, failing network requests, ARIA snapshots, and the **diff of files changed since the last green run**. If a diagnosis already exists, `get_cluster_diagnosis` returns its root cause and suggested fix. When the failure has no change behind it and the project records coverage, call `compare_coverage` with a failing execution's id: the code this run took that the last passing run did not (an error path, a fallback) is where to look.
23
23
 
24
24
  5. **Form the diagnosis.** Tie the failure to a cause with evidence: a selector that stopped matching, an assertion on changed copy, a slow/500 endpoint (`get_network_requests`), a race, a genuinely flaky test (check `get_test_stability_trend` — if it fails intermittently, treat it as flaky, not a regression). Point at the specific commit/file from the diff when the evidence supports it.
25
25
 
@@ -15,7 +15,7 @@ Prefer the **Piwi MCP server** if it is connected (`list_flaky_tests`, `get_flak
15
15
 
16
16
  1. **Rank the flaky tests.** Call `list_flaky_tests` for the project and take the top few by impact. Do not try to fix the whole list at once.
17
17
 
18
- 2. **Read the suspects.** For a chosen test, call `get_flake_profile`. Each suspect carries raw counts ("slow in 7 of 8 failures and 3 of 44 passes"), the condition that would test it, and, once the lab has run, its latest result (`lab`). `experiments` lists what the lab already found; if an experiment reproduced the test, skip to step 4. Read one failing execution (`get_test_run_case` / `explain_failure`) for the error at the moment it flaked.
18
+ 2. **Read the suspects.** For a chosen test, call `get_flake_profile`. Each suspect carries raw counts ("slow in 7 of 8 failures and 3 of 44 passes"), the condition that would test it, and, once the lab has run, its latest result (`lab`). `experiments` lists what the lab already found; if an experiment reproduced the test, skip to step 4. Read one failing execution (`get_test_run_case` / `explain_failure`) for the error at the moment it flaked. A test whose root cause is `order` depends on state an earlier test leaves behind: `compare_coverage` with its `testCaseId` names that test and the code whose path changes, so reproduce by running that test before this one in a single worker, and fix the shared state, not the wait.
19
19
 
20
20
  3. **Reproduce it.** Run the lab on the test (`plan_flake_experiment` gives the exact commands and the arms it will run, with an estimate):
21
21
 
@@ -14,7 +14,7 @@ drafts it from the graph, and opens it in the same change.
14
14
  ## How you reach Piwi
15
15
 
16
16
  Prefer the **Piwi MCP server** if it is connected (`list_scenario_gaps`,
17
- `draft_scenario`, `get_change_coverage`, `triage_gap`). Otherwise use the dashboard's **Gaps**
17
+ `draft_scenario`, `get_change_coverage`, `get_coverage`, `triage_gap`). Otherwise use the dashboard's **Gaps**
18
18
  view, or the reporter CLI with `PIWI_DASHBOARD_URL` / `PIWI_API_KEY` /
19
19
  `PIWI_PROJECT_NAME` set.
20
20
 
@@ -38,7 +38,11 @@ view, or the reporter CLI with `PIWI_DASHBOARD_URL` / `PIWI_API_KEY` /
38
38
  skeleton: a title, `piwi:` annotations from the nearest test, the graph path
39
39
  from a reached page to the gap as the step list, the catalog page-object
40
40
  methods that match the page, and a `TODO` assertion naming what to check.
41
- Nothing is committed — the skeleton is yours to finish.
41
+ Nothing is committed — the skeleton is yours to finish. When the gap points at
42
+ application code (an uncovered file, a handler, an error path), name the target
43
+ lines in it and call `get_coverage` with `projectId`, `file` and `lines`:
44
+ `nearest` is the existing test running most of the function around them, the
45
+ one whose setup to copy.
42
46
 
43
47
  4. **Finish the assertion.** The draft reaches the subject; you write the check.
44
48
  For a false-comfort gap, assert the effect the probe fault suppressed (the row
@@ -51,11 +55,33 @@ view, or the reporter CLI with `PIWI_DASHBOARD_URL` / `PIWI_API_KEY` /
51
55
  for the right reason: temporarily break the behavior it asserts and see it
52
56
  fail. Open it in the same pull request as the change that motivated it.
53
57
 
54
- 6. **Report.** State which gap you closed (class, subject, score) and how the new
55
- test asserts the missing behavior. If the gap had no reachable path, say so —
56
- the draft cannot invent an entry point, and the gap may need a fixture.
58
+ 6. **Prove it reaches its target lines.** When the project records server
59
+ coverage (an ASP.NET Core backend in a coverage build), run the new test with
60
+ it on and reporting to Piwi:
57
61
 
58
- 7. **Report back to Piwi.** Tell Piwi what you decided about the gap with
62
+ ```bash
63
+ PIWI_COVERAGE_SERVER=lines npx playwright test <file> -g "<title>"
64
+ ```
65
+
66
+ ```powershell
67
+ $env:PIWI_COVERAGE_SERVER='lines'; npx playwright test <file> -g "<title>"
68
+ ```
69
+
70
+ Then call `get_coverage` with `projectId`, `testFile`, `testTitle`, `file`
71
+ and `lines` (the target lines). `ran` lists the target lines it executed,
72
+ `notRan` those it did not, `notExecutable` those that cannot run (blank lines,
73
+ comments), and `unknown` those the capture could not tell: run it again, and
74
+ check the backend records `lines`, not only files. While a target line did not
75
+ run, compare your test with `nearest`, change the steps or the data that lead
76
+ to that code, and run again, until `allRan` is true. If `get_coverage` says the
77
+ project records no coverage, skip this step and say so in the report.
78
+
79
+ 7. **Report.** State which gap you closed (class, subject, score), how the new
80
+ test asserts the missing behavior, and which target lines it ran. If the gap
81
+ had no reachable path, say so — the draft cannot invent an entry point, and
82
+ the gap may need a fixture.
83
+
84
+ 8. **Report back to Piwi.** Tell Piwi what you decided about the gap with
59
85
  `triage_gap` (reporter or admin access): `verb: "accept"` for the gap you
60
86
  wrote the test for, `covered-by` with the covering test's id when a test you
61
87
  found already covers it, or `dismiss` with the reason (`not-worth-testing`,