@xera-ai/skills 0.4.0 → 0.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xera-ai/skills",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "files": [
5
5
  "*.md",
6
6
  "version.json"
package/version.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "skills": "0.4.0",
3
- "compatible_prompts": "^2.2.0",
2
+ "skills": "0.4.1",
3
+ "compatible_prompts": "^2.3.0",
4
4
  "skill_files": [
5
5
  "xera-run.md",
6
6
  "xera-fetch.md",
package/xera-report.md CHANGED
@@ -50,8 +50,38 @@ Step 4 below is *cognitive work that YOU, the session, must do*. It is not a she
50
50
 
51
51
  **Do not skip this step.** If you find yourself about to call `bun run xera:report` without having written this file, stop and write the file first.
52
52
 
53
+ ## Step 4b — TEST_OUTDATED pre-check (v0.6.1)
54
+
55
+ For every scenario in `classifier-input.json` whose `outcome === "FAIL"`:
56
+
57
+ 1. Compute `scenarioId = sha1(<TICKET> + ":" + normalize(scenario.name))` (lowercase, single-spaced).
58
+ 2. Query the graph: `bun run xera:graph-query --ticket <TICKET> --format json | jq '.edges[] | select(.kind == "modifies") | select(.discoveredAt > <scenario.generatedAt>)'`.
59
+ 3. If there are 0 candidates → skip this scenario, no LLM call needed.
60
+ 4. If there are ≥1 candidates → run the `classify-outdated.md` prompt (located at `packages/prompts/classify-outdated.md`):
61
+ - Inputs: scenario gherkin + original AC, candidate tickets' AC, failure expected/actual from trace.
62
+ - Wrap untrusted ticket text using the v0.3 untrusted-input preamble pattern (boundary tags + refusal label).
63
+ - Output: JSON `{ classification, confidence, evidence }` per the prompt schema.
64
+ 5. Aggregate all decisions into `.xera/<TICKET>/runs/<RUN_ID>/outdated-decisions.json` keyed by `scenarioId`.
65
+
66
+ **If lazy similarity is needed** (a candidate ticket exists but has no `similar` edges and is hot for many scenarios), first run:
67
+
68
+ ```bash
69
+ bun run xera:graph-enrich --ticket <CANDIDATE>
70
+ ```
71
+
72
+ This populates `similar` edges so future graph queries are richer. Skip if not needed.
73
+
53
74
  4a. **Heal sub-flow (only if SELECTOR_DRIFT present).** If the user passed `--no-heal` in the invocation, skip this entire sub-flow and proceed directly to step 5.
54
75
 
76
+ **v0.6.1 update:** Before invoking heal, check whether the scenario's failure was classified as TEST_OUTDATED. Read `.xera/{{TICKET}}/runs/{{RUN_ID}}/outdated-decisions.json` (written at step 4b, available in the current session). If the scenario's entry has `classification === 'TEST_OUTDATED'` and `confidence >= 0.7`, **SKIP heal** and instead instruct the user to regenerate the scenario from the candidate ticket's new AC:
77
+
78
+ ```bash
79
+ # Example:
80
+ bun run xera:script <ORIGINAL_TICKET> --refresh-from <CANDIDATE_TICKET>
81
+ ```
82
+
83
+ Heal is for selector drift (DOM moved); TEST_OUTDATED requires a scenario rewrite, not a heal.
84
+
55
85
  Otherwise: read `.xera/{{TICKET}}/classifier-input.json` (which you just wrote in step 4) and check whether any scenario has `class: "SELECTOR_DRIFT"`. If none, skip this entire sub-flow and proceed directly to step 5 (Aggregate + draft).
56
86
 
57
87
  If at least one scenario is SELECTOR_DRIFT, take the FIRST such scenario (by array order — the single-heal guard) and execute Phases A–C below. Subsequent SELECTOR_DRIFT scenarios are NOT auto-healed in the same `/xera-report` invocation; list them in the report output as "additional drifts: re-run /xera-report after applying the first heal."
@@ -118,8 +148,13 @@ If at least one scenario is SELECTOR_DRIFT, take the FIRST such scenario (by arr
118
148
 
119
149
  After the heal sub-flow finishes (whether it applied, refused, or errored), continue to step 5 below to aggregate + draft the report. The Jira comment in step 5 reflects the run as it was originally classified — heal results are a separate concern not (in v0.5) folded into the Jira comment.
120
150
 
121
- 5. **Aggregate + draft.** Run: `bun run xera:report {{TICKET}} -- --input=.xera/{{TICKET}}/classifier-input.json`
122
- This CLI: aggregates per-scenario classifications into an overall verdict, updates `status.json` with history, and writes `jira-comment.draft.md`. If exit code is non-zero, surface the error to the user; do not proceed to post.
151
+ 5. **Aggregate + draft.** Now invoke the existing `xera:report` flow as before:
152
+
153
+ ```bash
154
+ bun run xera:report {{TICKET}} --input=.xera/{{TICKET}}/classifier-input.json
155
+ ```
156
+
157
+ The `xera:report` subcommand reads `outdated-decisions.json` (if present) and may upgrade scenario classifications to `TEST_OUTDATED`. It aggregates per-scenario classifications into an overall verdict, updates `status.json` with history, and writes `jira-comment.draft.md`. If exit code is non-zero, surface the error to the user; do not proceed to post.
123
158
 
124
159
  6. **Show the draft.** Read `.xera/{{TICKET}}/jira-comment.draft.md`. Display its content to the user verbatim. Ask: "Post to Jira? (Y/n)" (default: Y, unless `meta.json.source === "local"` for SAMPLE tickets — then never post).
125
160
 
@@ -136,3 +171,54 @@ bun run xera:graph-record classify <TICKET> --run-id <RUN_ID>
136
171
  ```
137
172
 
138
173
  Non-fatal. Note: TEST_OUTDATED detection ships in v0.6.1 — for v0.6.0 this just emits `run.classified` events with existing 4-bucket classifications.
174
+
175
+ ## Step 10 — Notify ticket owner when TEST_OUTDATED detected (v0.6.1)
176
+
177
+ For every scenario classified as `TEST_OUTDATED` in `outdated-decisions.json`, find the **original ticket** that owns the scenario (from graph: `xera:graph-query --ticket <SCENARIO_OWNER_TICKET> --format json`). Then post a Jira sub-task on that ticket via the existing Jira backend (the same code path `/xera-fetch` uses to read tickets — re-use the configured backend per `xera.config.ts.jira`):
178
+
179
+ Body template:
180
+
181
+ ```
182
+ Test for this ticket may be outdated due to changes introduced by <CURRENT_TICKET>. Confidence: <conf>. Run `xera:script <ORIGINAL_TICKET> --refresh-from <CURRENT_TICKET>` to regenerate the test from the new AC.
183
+ ```
184
+
185
+ Tag the original ticket's assignee. This routes the signal to the right person, not the current QA running this report.
186
+
187
+ In the current QA's session, only show a summary line:
188
+ ```
189
+ 3 impact tickets notified (ABC-100, ABC-145, ABC-178). No action required from you.
190
+ ```
191
+
192
+ **Config:** Respects `xera.config.report.testOutdatedNotify`:
193
+ - `'jira-subtask'` (default) — post sub-task as above
194
+ - `'comment'` — post comment instead
195
+ - `'console-only'` — only print to terminal, no Jira write
196
+
197
+ ## Step 11 — Dispute capture (v0.6.1, optional)
198
+
199
+ After classification is displayed to the user, if any scenario has classification `TEST_OUTDATED` or `REAL_BUG`, prompt the user:
200
+
201
+ ```
202
+ Agree with classifications above? [Y]es / [d]ispute
203
+ ```
204
+
205
+ If the user picks `d`, prompt:
206
+ ```
207
+ Which scenario? [N]
208
+ What classification do you think it should be? (REAL_BUG / TEST_BUG / SELECTOR_DRIFT / FLAKY / TEST_OUTDATED)
209
+ Reason (optional, single line):
210
+ ```
211
+
212
+ Then emit a dispute event:
213
+
214
+ ```bash
215
+ bun run xera:graph-record dispute \
216
+ --run-id <RUN_ID> \
217
+ --scenario-id <SCENARIO_ID> \
218
+ --from <ORIGINAL_CLASSIFICATION> \
219
+ --to <DISPUTED_CLASSIFICATION> \
220
+ --actor "$(git config user.email)" \
221
+ --reason "<REASON>"
222
+ ```
223
+
224
+ Non-fatal: if it fails, log warning and continue. Dispute events are captured for v0.7+ classifier learning; v0.6.1 does not change classifier behavior based on disputes.