ado-sync 0.1.46 → 0.1.48

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 (53) hide show
  1. package/.next-steps.md +179 -0
  2. package/README.md +22 -945
  3. package/dist/azure/test-cases.js +39 -6
  4. package/dist/azure/test-cases.js.map +1 -1
  5. package/dist/azure/work-items.d.ts +60 -0
  6. package/dist/azure/work-items.js +194 -0
  7. package/dist/azure/work-items.js.map +1 -0
  8. package/dist/cli.js +396 -28
  9. package/dist/cli.js.map +1 -1
  10. package/dist/config.js +50 -0
  11. package/dist/config.js.map +1 -1
  12. package/dist/issues/ado-bugs.d.ts +23 -0
  13. package/dist/issues/ado-bugs.js +59 -0
  14. package/dist/issues/ado-bugs.js.map +1 -0
  15. package/dist/issues/create-issues.d.ts +32 -0
  16. package/dist/issues/create-issues.js +236 -0
  17. package/dist/issues/create-issues.js.map +1 -0
  18. package/dist/issues/github.d.ts +22 -0
  19. package/dist/issues/github.js +95 -0
  20. package/dist/issues/github.js.map +1 -0
  21. package/dist/mcp-server.d.ts +35 -0
  22. package/dist/mcp-server.js +507 -0
  23. package/dist/mcp-server.js.map +1 -0
  24. package/dist/sync/cache.d.ts +7 -1
  25. package/dist/sync/cache.js.map +1 -1
  26. package/dist/sync/engine.js +105 -51
  27. package/dist/sync/engine.js.map +1 -1
  28. package/dist/sync/generate.d.ts +27 -0
  29. package/dist/sync/generate.js +184 -0
  30. package/dist/sync/generate.js.map +1 -0
  31. package/dist/sync/manifest.d.ts +69 -0
  32. package/dist/sync/manifest.js +197 -0
  33. package/dist/sync/manifest.js.map +1 -0
  34. package/dist/sync/publish-results.d.ts +8 -1
  35. package/dist/sync/publish-results.js +139 -2
  36. package/dist/sync/publish-results.js.map +1 -1
  37. package/dist/types.d.ts +55 -0
  38. package/docs/agent-setup.md +204 -0
  39. package/docs/cli.md +241 -0
  40. package/docs/mcp-server.md +275 -0
  41. package/docs/publish-test-results.md +136 -2
  42. package/docs/troubleshooting.md +101 -0
  43. package/docs/work-item-links.md +115 -0
  44. package/docs/workflows.md +381 -0
  45. package/llms.txt +164 -0
  46. package/package.json +4 -2
  47. package/.cucumber/.ado-sync-state.json +0 -282
  48. package/.cucumber/ado-sync.yaml +0 -21
  49. package/.cucumber/features/cart.feature +0 -62
  50. package/.cucumber/features/checkout.feature +0 -100
  51. package/.cucumber/features/homepage.feature +0 -7
  52. package/.cucumber/features/inventory.feature +0 -59
  53. package/.cucumber/features/login.feature +0 -74
package/.next-steps.md ADDED
@@ -0,0 +1,179 @@
1
+ What I'd build next (priority order)
2
+
3
+ 1. create_issue_on_failure — GitHub Issues + ADO Bugs (dual provider) ✅ DONE
4
+
5
+ When publish-test-results finds failures, automatically file issues so agents can pick them up
6
+ and propose fix PRs. Supports both GitHub Issues and ADO Bugs as providers under one config key.
7
+
8
+ --- Why GitHub Issues is the better default ---
9
+
10
+ GitHub Issues is preferred over ADO Bugs for most teams because:
11
+ - 5,000 req/hour API limit vs ADO's stricter rate limits
12
+ - The healer agent lives in GitHub Actions — Issue → PR → auto-close on merge is native
13
+ - Only requires repo `issues: write` permission, not ADO Work Items (Write)
14
+ - Dedup by label search is simpler than WiQL queries
15
+ - Issue body can embed the ADO TC URL, so full traceability is preserved
16
+
17
+ ADO Bugs remain available for teams fully inside ADO (no GitHub, or policy requires bugs in ADO).
18
+
19
+ --- The bulk-failure problem ---
20
+
21
+ A full environment outage (app down, auth broken) can fail 10,000 tests and would create 10,000
22
+ issues, hitting API limits and flooding the tracker. Guards are applied in order before any issue
23
+ is filed:
24
+
25
+ 1. Failure rate threshold (default 20%)
26
+ If >20% of tests fail → skip per-test issues entirely.
27
+ Create ONE environment-failure issue with a summary of all failures.
28
+
29
+ 2. Error signature clustering
30
+ Group failures by hashed error message.
31
+ If 500 tests all fail with ERR_CONNECTION_REFUSED → ONE cluster issue listing affected tests
32
+ (up to 20 names, then "+ N more").
33
+
34
+ 3. Hard cap (default 50)
35
+ Ceiling regardless of strategy. After the cap, one "overflow" summary issue is created:
36
+ "50 issues filed; X additional failures suppressed — possible environment issue."
37
+
38
+ 4. Dedup against open issues
39
+ Skip creation if an open issue already exists for that TC (matched by label tc:ID or title).
40
+
41
+ Decision tree at runtime:
42
+
43
+ failures > threshold% of total?
44
+ └─ YES → 1 environment issue, stop
45
+ └─ NO
46
+ └─ cluster by error signature
47
+ └─ cluster size > 10?
48
+ └─ YES → 1 issue per cluster (lists affected TCs)
49
+ └─ NO → 1 issue per TC (up to maxIssues cap)
50
+ └─ cap hit? → 1 overflow summary issue
51
+
52
+ --- CLI ---
53
+
54
+ ado-sync publish-test-results \
55
+ --testResult results/ctrf.json \
56
+ --create-issues-on-failure \
57
+ --github-repo owner/repo \
58
+ --github-token $GITHUB_TOKEN
59
+
60
+ # ADO Bugs instead:
61
+ ado-sync publish-test-results \
62
+ --testResult results/ctrf.json \
63
+ --create-issues-on-failure \
64
+ --issue-provider ado
65
+
66
+ --- Config (ado-sync.json) ---
67
+
68
+ {
69
+ "publishTestResults": {
70
+ "createIssuesOnFailure": {
71
+ "provider": "github", // "github" | "ado"
72
+ "repo": "owner/repo", // GitHub only
73
+ "labels": ["test-failure", "automated"],
74
+ "threshold": 20, // % of failures that triggers env-failure mode
75
+ "maxIssues": 50, // hard cap per run
76
+ "clusterByError": true, // group same-error failures into one issue
77
+ "dedupByTestCase": true, // skip if open issue for TC already exists
78
+ "areaPath": "MyProject\\QA", // ADO only
79
+ "assignTo": "$AZURE_DEVOPS_USER"
80
+ }
81
+ }
82
+ }
83
+
84
+ --- MCP tools ---
85
+
86
+ create_issue({ title, failureDetails, testCaseId, buildId, provider })
87
+ → files one issue (GitHub or ADO) and returns the issue/bug URL
88
+
89
+ create_issues_from_run({ runId, provider, ...guardOptions })
90
+ → applies full guard logic against a completed test run, returns summary
91
+
92
+ --- GitHub Issue body template ---
93
+
94
+ ## Test failure: {testName}
95
+
96
+ | Field | Value |
97
+ |---|---|
98
+ | ADO Test Case | [#{testCaseId}]({adoTcUrl}) |
99
+ | Build | #{buildId} |
100
+ | Run | [View in Azure DevOps]({runUrl}) |
101
+ | File | {filePath}:{line} |
102
+
103
+ ### Error
104
+ ```
105
+ {errorMessage}
106
+ ```
107
+
108
+ ### Stack trace
109
+ ```
110
+ {stackTrace}
111
+ ```
112
+
113
+ /cc @healer-agent
114
+
115
+ This unblocks Use Case 4 — the GitHub Agentic Workflow where the Playwright Healer Agent reads
116
+ the issue, understands the failure from errorMessage + stackTrace + ADO TC context, then proposes
117
+ a fix PR. The issue is the handoff between CI and the healer.
118
+
119
+ 2. CTRF format support in publish-test-results ✅ DONE
120
+ The scope doc and materia article both use CTRF. It's becoming the standard cross-framework report format. Teams using the materia pattern will arrive with CTRF output expecting ado-sync to accept it.
121
+ Auto-detected from results.tests array structure. TC IDs from tags[] or test name. Attachments,
122
+ stdout/stderr uploaded automatically. Documented in docs/publish-test-results.md.
123
+
124
+ 3. get_story_context MCP tool (Planner agent feed) ✅ DONE
125
+ Returns AC items (bullet list), inferred tags (@smoke, @auth…), extracted actors, and linked TC IDs.
126
+ CLI: ado-sync story-context --story-id 1234
127
+ MCP: get_story_context({ storyId: 1234 })
128
+ Implemented in src/azure/work-items.ts — getStoryContext() with tag inference + actor extraction.
129
+
130
+ 4. ai-workflow-manifest.json generator ✅ DONE
131
+ CLI: ado-sync generate --manifest --story-ids 1234
132
+ MCP: generate_manifest({ storyIds: [1234], outputFolder: "e2e/bdd", format: "gherkin" })
133
+ Writes .ai-workflow-manifest-{id}.json with 8-step workflow, AC items, required docs checklist,
134
+ validation steps, and output paths. Implemented in src/sync/manifest.ts.
135
+
136
+ 5. GitHub Actions reusable workflow
137
+ The scope doc explicitly asks for this:
138
+
139
+ "There is need to write GitHub Actions templates in TR Org Workflows repo"
140
+
141
+ A reusable workflow file:
142
+
143
+
144
+ # .github/workflows/ado-sync.yml (reusable)
145
+ on:
146
+ workflow_call:
147
+ inputs:
148
+ test-result-path: ...
149
+ create-issues-on-failure: ...
150
+ Teams subscribe to it — one-line adoption in their own pipelines.
151
+
152
+ 6. Flaky test detection in publish-test-results
153
+ Materia's 4-method flaky detection:
154
+
155
+ Summary-level flaky count
156
+ Retry pattern analysis
157
+ Explicit marking
158
+ Passed-after-retry
159
+ Add a --detect-flaky flag that outputs a flaky test report alongside the ADO publish. Tag flaky TCs in ADO with ado-sync:flaky so you can track trends across runs.
160
+
161
+ The full picture
162
+
163
+ User Story (ADO)
164
+ ↓ get_story_context (MCP)
165
+ Planner Agent → Markdown spec
166
+ ↓ generate --manifest
167
+ .ai-workflow-manifest.json + spec file
168
+ ↓ generate (existing)
169
+ Playwright test skeleton
170
+ ↓ push (existing)
171
+ ADO Test Case with @tc:ID writeback
172
+ ↓ CI runs tests
173
+ CTRF / Playwright JSON results
174
+ ↓ publish-test-results (existing + flaky detection)
175
+ ADO Test Run results
176
+ ↓ failures → create_issue_on_failure (new, GitHub Issues or ADO Bugs)
177
+ GitHub Issue / ADO Bug → Healer Agent → fix PR
178
+ ado-sync becomes the connective tissue across all 4 use cases in that scope document. Right now you cover the right half. Items 1–3 above close the loop on Use Cases 3 and 4.
179
+