@tea-agent/loop-agent 0.13.0-alpha.0 → 0.13.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/AGENTS.md +4 -0
- package/CHANGELOG.md +57 -53
- package/README.md +12 -3
- package/dist/application/dag/generate-task-dag.js +28 -58
- package/dist/application/evaluation/candidate-hash.js +75 -0
- package/dist/application/evaluation/candidate.js +52 -0
- package/dist/application/evaluation/replay.js +289 -0
- package/dist/application/evaluation/types.js +130 -0
- package/dist/cli/command-definitions.js +17 -4
- package/dist/cli/program.js +8 -4
- package/dist/commands/eval.js +235 -0
- package/dist/commands/init.js +131 -24
- package/dist/executors/pi-sdk-executor.js +38 -24
- package/dist/executors/shell-executor.js +226 -15
- package/dist/executors/shell-presets.js +20 -0
- package/dist/executors/shell-verification.js +7 -0
- package/dist/governance/manifest-types.js +1 -0
- package/dist/infrastructure/evaluation/candidate-store.js +439 -0
- package/dist/infrastructure/evaluation/store.js +40 -0
- package/dist/task/config-types.js +23 -0
- package/dist/worker/observe/routes.js +18 -3
- package/dist/worker/observe/spec-evidence.js +1 -1
- package/dist/worker/observe/static/dom.js +160 -1
- package/dist/worker/observe/static/state.js +14 -0
- package/dist/worker/observe/static/views/dag-inspector.js +35 -4
- package/dist/worker/observe/static/views/dag.js +9 -0
- package/dist/worker/observe/static/views/dashboard.js +702 -445
- package/dist/worker/observe/static/views/session-timeline.js +15 -1
- package/dist/workflows/dag/backend-test-analysis-contract.js +120 -0
- package/dist/workflows/dag/backend-test-case-manifest.js +503 -0
- package/dist/workflows/dag/backend-test-execution-contract.js +353 -0
- package/dist/workflows/dag/backend-test-result-contract.js +568 -0
- package/dist/workflows/dag/decision-envelope.js +57 -2
- package/dist/workflows/dag/dynamic-runtime/map.js +90 -2
- package/dist/workflows/dag/frontend-implementation-contract.js +240 -0
- package/dist/workflows/dag/frontend-project-capability.js +309 -0
- package/dist/workflows/dag/frontend-repair.js +341 -0
- package/dist/workflows/dag/frontend-risk.js +161 -0
- package/dist/workflows/dag/frontend-verification-trace.js +190 -0
- package/dist/workflows/dag/init-hybrid.js +2407 -297
- package/dist/workflows/dag/node-execution.js +9 -0
- package/dist/workflows/dag/prompt.js +9 -0
- package/dist/workflows/dag/repair-artifact.js +43 -3
- package/dist/workflows/dag/report.js +35 -1
- package/dist/workflows/dag/runner.js +28 -2
- package/dist/workflows/dag/skill-instructions.js +4 -2
- package/dist/workflows/dag/task-demand-routing.js +383 -0
- package/dist/workflows/dag/types.js +71 -13
- package/dist/workflows/dag/upstream-artifacts.js +1 -0
- package/dist/workflows/dag/validate.js +59 -1
- package/docs/README.md +6 -3
- package/docs/agent-dag-recovery-playbook.md +5 -3
- package/docs/agent-dag-runner.md +3 -3
- package/docs/architecture/README.md +3 -3
- package/docs/architecture/dag-execution.md +1 -1
- package/docs/architecture/evolution.md +13 -13
- package/docs/architecture/facts-and-state.md +1 -1
- package/docs/architecture/runtime-boundaries.md +7 -7
- package/docs/architecture/system-overview.md +3 -3
- package/docs/architecture/worker-and-feature.md +3 -3
- package/docs/design/README.md +124 -42
- package/docs/development-principles.md +4 -4
- package/docs/exec-plans/active/README.md +12 -11
- package/docs/exec-plans/completed/README.md +33 -0
- package/docs/feature-workflow.md +114 -39
- package/docs/init-surface.manifest.json +30 -3
- package/docs/loop-agent-harness.md +9 -8
- package/docs/production-readiness.md +1 -1
- package/docs/progress/README.md +23 -1
- package/docs/reports/README.md +65 -6
- package/docs/skills/vetted-skill-registry.md +2 -0
- package/docs/templates/agent-dag.schema.json +29 -1
- package/docs/templates/agent-dag.supervised-implementation.json +127 -8
- package/docs/templates/backend-test-analysis.schema.json +44 -0
- package/docs/templates/backend-test-case-manifest.schema.json +190 -0
- package/docs/templates/backend-test-dag.classify.prompt.md +75 -0
- package/docs/templates/backend-test-dag.generate-pytest.prompt.md +81 -16
- package/docs/templates/backend-test-dag.json +311 -40
- package/docs/templates/backend-test-dag.retrospect.prompt.md +44 -30
- package/docs/templates/backend-test-dag.review-cases.prompt.md +10 -8
- package/docs/templates/backend-test-execution.schema.json +133 -0
- package/docs/templates/backend-test-result.schema.json +99 -0
- package/docs/templates/branch-merge-report.md +93 -0
- package/docs/templates/frontend-design-contract.md +9 -0
- package/docs/templates/frontend-eval/fixtures/failures/01-type-build-error.md +17 -0
- package/docs/templates/frontend-eval/fixtures/failures/02-unit-component-test-fail.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/03-fixture-schema-drift.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/04-missing-loading-empty-error-state.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/05-forbidden-write-writeset-expansion.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/06-unapproved-dependency-add.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/07-mock-production-on.md +21 -0
- package/docs/templates/frontend-eval/fixtures/functional/01-simple-component-style.md +29 -0
- package/docs/templates/frontend-eval/fixtures/functional/02-form-validation.md +28 -0
- package/docs/templates/frontend-eval/fixtures/functional/03-list-detail-page.md +28 -0
- package/docs/templates/frontend-eval/fixtures/functional/04-api-mock.md +29 -0
- package/docs/templates/frontend-eval/fixtures/functional/05-permission-auth-gated-ui.md +27 -0
- package/docs/templates/frontend-eval/fixtures/functional/06-ssr-server-client-boundary.md +28 -0
- package/docs/templates/frontend-eval/fixtures/functional/07-shared-public-component-api.md +28 -0
- package/docs/templates/frontend-eval/fixtures/functional/08-pure-local-no-remote.md +27 -0
- package/docs/templates/frontend-eval/metrics.md +138 -0
- package/docs/templates/frontend-eval/smoke-targets.md +53 -0
- package/docs/templates/frontend-implementation-contract.schema.json +27 -0
- package/docs/templates/frontend-task-constraints.md +10 -0
- package/docs/templates/frontend-task-requirement.md +9 -0
- package/docs/templates/frontend-test-dag.generate-cases.prompt.md +5 -0
- package/docs/templates/frontend-test-dag.json +23 -0
- package/docs/templates/frontend-test-dag.retrieve-context.prompt.md +3 -0
- package/docs/templates/frontend-test-dag.retrospect.prompt.md +3 -0
- package/docs/templates/frontend-test-dag.review-cases.prompt.md +3 -0
- package/docs/templates/frontend-test-dag.review-execution.prompt.md +3 -0
- package/docs/templates/knowledge-graph-bootstrap-dag.json +1 -1
- package/docs/templates/knowledge-sync-dag.json +1 -0
- package/docs/verification-matrix.md +4 -1
- package/examples/decision-gate-agent-dag.json +4 -4
- package/examples/hybrid-loop-agent-dag.json +1 -1
- package/package.json +2 -2
- package/scripts/kb-bootstrap-init-skeleton.sh +2 -1
- package/scripts/kb-graph-incremental-prepare.mjs +19 -5
- package/scripts/kb-graph-promote.mjs +12 -1
- package/skills/ai-engineering-context/SKILL.md +2 -2
- package/skills/analyze-product-dependencies/SKILL.md +67 -0
- package/skills/analyze-product-dependencies/agents/openai.yaml +4 -0
- package/skills/analyze-product-dependencies/references/api-documentation-schema.md +30 -0
- package/skills/analyze-product-dependencies/references/dependency-analysis-schema.md +28 -0
- package/skills/analyze-product-dependencies/references/example.md +76 -0
- package/skills/analyze-product-dependencies/references/forward-test-cases.md +35 -0
- package/skills/analyze-product-dependencies/references/input-contract.md +11 -0
- package/skills/analyze-product-dependencies/references/scouting-rules.md +61 -0
- package/skills/analyze-product-dependencies/scripts/test-validators.mjs +267 -0
- package/skills/analyze-product-dependencies/scripts/validate-api-documentation.mjs +101 -0
- package/skills/analyze-product-dependencies/scripts/validate-dependency-analysis.mjs +142 -0
- package/skills/analyze-product-dependencies/scripts/validate-product-requirement-input.mjs +76 -0
- package/skills/analyze-product-dependencies/scripts/validation-helpers.mjs +146 -0
- package/skills/analyze-product-requirements/SKILL.md +90 -0
- package/skills/analyze-product-requirements/agents/openai.yaml +4 -0
- package/skills/analyze-product-requirements/references/acceptance-criteria.md +91 -0
- package/skills/analyze-product-requirements/references/clarification-and-knowledge.md +56 -0
- package/skills/analyze-product-requirements/references/example.md +86 -0
- package/skills/analyze-product-requirements/references/forward-test-cases.md +66 -0
- package/skills/analyze-product-requirements/references/product-analysis-schema.md +32 -0
- package/skills/analyze-product-requirements/references/product-requirement-schema.md +33 -0
- package/skills/analyze-product-requirements/references/requirement-clarification-schema.md +35 -0
- package/skills/analyze-product-requirements/scripts/test-validators.mjs +193 -0
- package/skills/analyze-product-requirements/scripts/validate-product-analysis.mjs +69 -0
- package/skills/analyze-product-requirements/scripts/validate-product-requirement.mjs +97 -0
- package/skills/analyze-product-requirements/scripts/validate-requirement-clarification.mjs +98 -0
- package/skills/analyze-product-requirements/scripts/validation-helpers.mjs +156 -0
- package/skills/browser-tools/SKILL.md +196 -0
- package/skills/browser-tools/browser-content.js +103 -0
- package/skills/browser-tools/browser-cookies.js +35 -0
- package/skills/browser-tools/browser-eval.js +53 -0
- package/skills/browser-tools/browser-hn-scraper.js +108 -0
- package/skills/browser-tools/browser-nav.js +44 -0
- package/skills/browser-tools/browser-pick.js +162 -0
- package/skills/browser-tools/browser-screenshot.js +34 -0
- package/skills/browser-tools/browser-start.js +86 -0
- package/skills/browser-tools/package-lock.json +2556 -0
- package/skills/browser-tools/package.json +19 -0
- package/skills/frontend-design-review/SKILL.md +6 -1
- package/skills/frontend-design-review/references/review-checklist.md +25 -4
- package/skills/frontend-implementation/SKILL.md +25 -30
- package/skills/frontend-implementation/references/code-standards.md +20 -22
- package/skills/frontend-implementation/references/node-contracts.md +17 -53
- package/skills/frontend-review/SKILL.md +10 -4
- package/skills/frontend-review/references/review-findings.md +8 -3
- package/skills/frontend-verification/SKILL.md +22 -9
- package/skills/frontend-verification/references/verification-checklist.md +17 -5
- package/skills/grill-with-docs/SKILL.md +5 -5
- package/skills/grill-with-docs/adr-format.md +3 -3
- package/skills/init-capability-evolution/SKILL.md +5 -5
- package/skills/loop-agent/SKILL.md +5 -5
- package/skills/loop-agent/references/README.md +3 -3
- package/skills/loop-agent/references/command-reference.md +98 -24
- package/skills/loop-agent/references/docs-converge.md +15 -15
- package/skills/loop-agent/references/harness-policy.md +2 -2
- package/skills/loop-agent/references/hybrid-dag.md +32 -22
- package/skills/loop-agent/references/multi-worktree.md +1 -1
- package/skills/loop-agent/references/orchestrator-and-interventions.md +8 -8
- package/skills/loop-agent/references/task-workflow.md +1 -1
- package/skills/loop-agent/references/verification-and-failure-handling.md +6 -4
- package/skills/playwright-cli/SKILL.md +420 -0
- package/skills/playwright-cli/references/element-attributes.md +23 -0
- package/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/skills/playwright-cli/references/request-mocking.md +87 -0
- package/skills/playwright-cli/references/running-code.md +241 -0
- package/skills/playwright-cli/references/session-management.md +225 -0
- package/skills/playwright-cli/references/storage-state.md +275 -0
- package/skills/playwright-cli/references/test-generation.md +433 -0
- package/skills/playwright-cli/references/tracing.md +139 -0
- package/skills/playwright-cli/references/video-recording.md +143 -0
- package/skills/playwright-cli-case-generator/SKILL.md +74 -0
- package/skills/requesting-code-review/SKILL.md +1 -1
- package/skills/systematic-debugging/CREATION-LOG.md +3 -3
- package/skills/systematic-debugging/SKILL.md +1 -1
- package/skills/systematic-debugging/test-academic.md +1 -1
- package/skills/systematic-debugging/test-pressure-1.md +1 -1
- package/skills/systematic-debugging/test-pressure-2.md +1 -1
- package/skills/systematic-debugging/test-pressure-3.md +1 -1
- package/skills/verification-before-completion/SKILL.md +1 -1
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://tea-agent.dev/schemas/backend-test-case-manifest-v1.json",
|
|
4
|
+
"title": "Backend Test Case Manifest v1",
|
|
5
|
+
"description": "Run-owned AC → BE-* case → automation mapping. Coverage ratios are deterministic gate outputs; models must not invent percentages. Conditional required fields mirror Zod: generated requires file+symbol; skipped|unsupported requires gapReason; each evidence gap requires acId and/or caseId.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["schemaVersion", "sourceBinding", "cases", "evidenceGaps"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"schemaVersion": { "const": 1 },
|
|
11
|
+
"sourceBinding": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"additionalProperties": false,
|
|
14
|
+
"required": [
|
|
15
|
+
"taskId",
|
|
16
|
+
"requirementPath",
|
|
17
|
+
"requirementSha256",
|
|
18
|
+
"referencePaths",
|
|
19
|
+
"requirementIds"
|
|
20
|
+
],
|
|
21
|
+
"properties": {
|
|
22
|
+
"taskId": { "type": "string", "minLength": 1 },
|
|
23
|
+
"requirementPath": { "type": "string", "minLength": 1 },
|
|
24
|
+
"requirementSha256": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"pattern": "^[a-f0-9]{64}$"
|
|
27
|
+
},
|
|
28
|
+
"referencePaths": {
|
|
29
|
+
"type": "array",
|
|
30
|
+
"items": { "type": "string", "minLength": 1 }
|
|
31
|
+
},
|
|
32
|
+
"requirementIds": {
|
|
33
|
+
"type": "array",
|
|
34
|
+
"items": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"pattern": "^(?:REQ|BR|AC)-[A-Z0-9]+(?:-[A-Z0-9]+)*$"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"cases": {
|
|
42
|
+
"type": "array",
|
|
43
|
+
"items": {
|
|
44
|
+
"type": "object",
|
|
45
|
+
"additionalProperties": false,
|
|
46
|
+
"required": [
|
|
47
|
+
"caseId",
|
|
48
|
+
"acIds",
|
|
49
|
+
"title",
|
|
50
|
+
"category",
|
|
51
|
+
"automationStatus"
|
|
52
|
+
],
|
|
53
|
+
"properties": {
|
|
54
|
+
"caseId": {
|
|
55
|
+
"type": "string",
|
|
56
|
+
"pattern": "^BE-[A-Z0-9]+(?:-[A-Z0-9]+)*-\\d{3}$"
|
|
57
|
+
},
|
|
58
|
+
"acIds": {
|
|
59
|
+
"type": "array",
|
|
60
|
+
"minItems": 1,
|
|
61
|
+
"items": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"pattern": "^AC-[A-Z0-9]+(?:-[A-Z0-9]+)*$"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"title": { "type": "string", "minLength": 1 },
|
|
67
|
+
"category": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"enum": [
|
|
70
|
+
"positive",
|
|
71
|
+
"negative",
|
|
72
|
+
"boundary",
|
|
73
|
+
"state-transition",
|
|
74
|
+
"auth",
|
|
75
|
+
"timeout",
|
|
76
|
+
"concurrency",
|
|
77
|
+
"other"
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
"automationStatus": {
|
|
81
|
+
"type": "string",
|
|
82
|
+
"enum": ["planned", "generated", "skipped", "unsupported"]
|
|
83
|
+
},
|
|
84
|
+
"endpointRef": { "type": "string", "minLength": 1 },
|
|
85
|
+
"ruleRefs": {
|
|
86
|
+
"type": "array",
|
|
87
|
+
"items": { "type": "string", "minLength": 1 }
|
|
88
|
+
},
|
|
89
|
+
"file": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"minLength": 1,
|
|
92
|
+
"description": "Repo-relative posix path required when automationStatus=generated"
|
|
93
|
+
},
|
|
94
|
+
"symbol": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"minLength": 1,
|
|
97
|
+
"description": "pytest function name required when automationStatus=generated; must bind to caseId"
|
|
98
|
+
},
|
|
99
|
+
"gapReason": {
|
|
100
|
+
"type": "string",
|
|
101
|
+
"minLength": 1,
|
|
102
|
+
"description": "Required when automationStatus is skipped or unsupported"
|
|
103
|
+
},
|
|
104
|
+
"evidenceRef": { "type": "string", "minLength": 1 }
|
|
105
|
+
},
|
|
106
|
+
"allOf": [
|
|
107
|
+
{
|
|
108
|
+
"if": {
|
|
109
|
+
"properties": {
|
|
110
|
+
"automationStatus": { "const": "generated" }
|
|
111
|
+
},
|
|
112
|
+
"required": ["automationStatus"]
|
|
113
|
+
},
|
|
114
|
+
"then": {
|
|
115
|
+
"required": ["file", "symbol"]
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"if": {
|
|
120
|
+
"properties": {
|
|
121
|
+
"automationStatus": {
|
|
122
|
+
"enum": ["skipped", "unsupported"]
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"required": ["automationStatus"]
|
|
126
|
+
},
|
|
127
|
+
"then": {
|
|
128
|
+
"required": ["gapReason"]
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"evidenceGaps": {
|
|
135
|
+
"type": "array",
|
|
136
|
+
"items": {
|
|
137
|
+
"type": "object",
|
|
138
|
+
"additionalProperties": false,
|
|
139
|
+
"required": ["description"],
|
|
140
|
+
"properties": {
|
|
141
|
+
"acId": {
|
|
142
|
+
"type": "string",
|
|
143
|
+
"pattern": "^AC-[A-Z0-9]+(?:-[A-Z0-9]+)*$"
|
|
144
|
+
},
|
|
145
|
+
"caseId": {
|
|
146
|
+
"type": "string",
|
|
147
|
+
"pattern": "^BE-[A-Z0-9]+(?:-[A-Z0-9]+)*-\\d{3}$"
|
|
148
|
+
},
|
|
149
|
+
"description": { "type": "string", "minLength": 1 },
|
|
150
|
+
"evidenceRef": { "type": "string", "minLength": 1 }
|
|
151
|
+
},
|
|
152
|
+
"anyOf": [
|
|
153
|
+
{ "required": ["acId"] },
|
|
154
|
+
{ "required": ["caseId"] }
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"coverageSummary": {
|
|
159
|
+
"type": "object",
|
|
160
|
+
"additionalProperties": false,
|
|
161
|
+
"required": [
|
|
162
|
+
"explicitAcCount",
|
|
163
|
+
"coveredAcCount",
|
|
164
|
+
"gappedAcCount",
|
|
165
|
+
"caseCount",
|
|
166
|
+
"generatedCount",
|
|
167
|
+
"plannedCount",
|
|
168
|
+
"skippedCount",
|
|
169
|
+
"unsupportedCount",
|
|
170
|
+
"acCoverageRatio"
|
|
171
|
+
],
|
|
172
|
+
"properties": {
|
|
173
|
+
"explicitAcCount": { "type": "integer", "minimum": 0 },
|
|
174
|
+
"coveredAcCount": { "type": "integer", "minimum": 0 },
|
|
175
|
+
"gappedAcCount": { "type": "integer", "minimum": 0 },
|
|
176
|
+
"caseCount": { "type": "integer", "minimum": 0 },
|
|
177
|
+
"generatedCount": { "type": "integer", "minimum": 0 },
|
|
178
|
+
"plannedCount": { "type": "integer", "minimum": 0 },
|
|
179
|
+
"skippedCount": { "type": "integer", "minimum": 0 },
|
|
180
|
+
"unsupportedCount": { "type": "integer", "minimum": 0 },
|
|
181
|
+
"acCoverageRatio": {
|
|
182
|
+
"type": "number",
|
|
183
|
+
"minimum": 0,
|
|
184
|
+
"maximum": 1,
|
|
185
|
+
"description": "Deterministic coveredAcCount/explicitAcCount (or 1 when no explicit AC)"
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Backend Test DAG Classify Prompt Template
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Use this prompt for a **read-only classification** node: `executor: "pi"`, `role: "reviewer"`, `writePolicy: "read-only"`. The agent reads the run-owned Backend Test Result v1 artifact and returns structured failure classification JSON.
|
|
6
|
+
|
|
7
|
+
Do **not** create a new executor type. Do **not** write repository files.
|
|
8
|
+
|
|
9
|
+
## Recommended DAG Node Shape
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"id": "classify-backend-test-result-pi",
|
|
14
|
+
"depends_on": ["parse-backend-test-result-shell"],
|
|
15
|
+
"complexity": "MED",
|
|
16
|
+
"executor": "pi",
|
|
17
|
+
"role": "reviewer",
|
|
18
|
+
"writePolicy": "read-only",
|
|
19
|
+
"allowedPaths": ["**"],
|
|
20
|
+
"forbiddenPaths": [".harness/**", "artifacts/**"],
|
|
21
|
+
"outputContract": "Pure JSON classification: category in {ProductBug,TestBug,EnvFailure,ContractMismatch,FlakyTest,Unknown}, evidence[], confidence (capped), notes. No file writes.",
|
|
22
|
+
"subtask_prompt_markdown": "./backend-test-dag.classify.prompt.md"
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Prompt Body
|
|
27
|
+
|
|
28
|
+
You are the Backend Test DAG **result classifier** agent.
|
|
29
|
+
|
|
30
|
+
Your job is to classify the structured Backend Test Result v1 produced by `parse-backend-test-result-shell`. Return **exactly one JSON object**. Prefer pure JSON; a single fenced `json` block is tolerated; no trailing prose. Read-only: do not modify code, docs, artifacts, or repository files.
|
|
31
|
+
|
|
32
|
+
### Inputs (authoritative)
|
|
33
|
+
|
|
34
|
+
1. **Result v1** — `$HARNESS_DAG_RUN_DIR/contracts/backend-test-result.json` (schemaId `backend-test-result-v1`).
|
|
35
|
+
2. Optional: execute-node stdout markers (`pytestExitCode=…`, `JUnit report: …`) as secondary evidence only.
|
|
36
|
+
|
|
37
|
+
Do **not** invent pass rates or failure lists from raw logs when Result v1 is present. Counts and `failures[]` come from the result artifact only.
|
|
38
|
+
|
|
39
|
+
### Output JSON shape
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"schemaVersion": 1,
|
|
44
|
+
"category": "ProductBug",
|
|
45
|
+
"confidence": 0.0,
|
|
46
|
+
"evidence": ["result.outcome=completed-with-failures", "failures[0].name=…"],
|
|
47
|
+
"notes": "short rationale",
|
|
48
|
+
"forbiddenCategoriesHonored": ["FlakyTest"]
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Categories
|
|
53
|
+
|
|
54
|
+
| Category | When |
|
|
55
|
+
|----------|------|
|
|
56
|
+
| **ProductBug** | Assertion failures that indicate implementation/API behavior mismatch (only when collection/command/report are healthy). |
|
|
57
|
+
| **TestBug** | Broken test code, wrong expectations, bad fixtures, or collection/import errors clearly in tests. |
|
|
58
|
+
| **EnvFailure** | Missing env, service down, tooling/runtime failure, command-error. |
|
|
59
|
+
| **ContractMismatch** | Execution/analysis contract assumptions violated (wrong testRoot/mode, missing readiness). |
|
|
60
|
+
| **FlakyTest** | **Only** with multi-run historical evidence of intermittent pass/fail. |
|
|
61
|
+
| **Unknown** | Insufficient evidence. |
|
|
62
|
+
|
|
63
|
+
### Hard constraints (MUST)
|
|
64
|
+
|
|
65
|
+
1. **Single-run failure MUST NOT use `FlakyTest`.** Prefer `Unknown`, `TestBug`, or `ProductBug`.
|
|
66
|
+
2. If `executionStatus` or `outcome` is `collection-error`, `command-error`, or `report-error`, **MUST NOT** use `ProductBug`. Prefer `EnvFailure`, `TestBug`, or `Unknown`.
|
|
67
|
+
3. If `outcome=passed` with `failed=0` and `error=0`, set `category` to `Unknown` (or omit product diagnosis) and note all-pass; do not invent bugs.
|
|
68
|
+
4. `confidence` caps: ≤ `0.75` for assertion failures; ≤ `0.6` for env/collection/command/report errors; `1.0` only for all-pass with no issues.
|
|
69
|
+
5. `evidence[]` must cite concrete result fields (`outcome`, `executionStatus`, `failed`, `failures[].name`, `pytestExitCode`).
|
|
70
|
+
|
|
71
|
+
### Non-goals
|
|
72
|
+
|
|
73
|
+
- Do not rewrite Result v1.
|
|
74
|
+
- Do not decide final DAG success/failure (that is `backend-test-outcome-gate-shell`).
|
|
75
|
+
- Do not implement M3 case manifest / Task Pool auto follow-up.
|
|
@@ -11,16 +11,16 @@ Do **not** create a new executor type. This is a standard `executor: pi` writer
|
|
|
11
11
|
```json
|
|
12
12
|
{
|
|
13
13
|
"id": "generate-backend-pytest-pi",
|
|
14
|
-
"depends_on": ["review-backend-cases-gate-shell"],
|
|
14
|
+
"depends_on": ["review-backend-cases-gate-shell", "backend-test-execution-contract-shell"],
|
|
15
15
|
"complexity": "HIGH",
|
|
16
16
|
"executor": "pi",
|
|
17
17
|
"role": "implementer",
|
|
18
18
|
"toolProfile": "write",
|
|
19
19
|
"writePolicy": "exclusive",
|
|
20
|
-
"writeSet": ["testcase/**/test_*.py"],
|
|
21
|
-
"allowedPaths": ["
|
|
20
|
+
"writeSet": ["testcase/**/test_*.py", "testcase/**/helpers/**", "testcase/**/factories/**"],
|
|
21
|
+
"allowedPaths": ["**"],
|
|
22
22
|
"forbiddenPaths": [".harness/**", "artifacts/**"],
|
|
23
|
-
"outputContract": "Pytest test files under
|
|
23
|
+
"outputContract": "Pytest test files under testcase/ with 1:1 mapping to functional test case IDs; optional helpers/factories. Summary lists generated files, test function count, and any skipped cases with reasons.",
|
|
24
24
|
"subtask_prompt_markdown": "./backend-test-dag.generate-pytest.prompt.md"
|
|
25
25
|
}
|
|
26
26
|
```
|
|
@@ -38,10 +38,12 @@ Your job is to convert reviewed test cases under `testcase/md/` into pytest auto
|
|
|
38
38
|
|
|
39
39
|
### Inputs
|
|
40
40
|
|
|
41
|
-
1. **Reviewed test cases** — files under `testcase/md/` (approved by `review-backend-cases-pi`).
|
|
42
|
-
2. **
|
|
41
|
+
1. **Reviewed test cases** — files under `testcase/md/` (approved by `review-backend-cases-pi` / `review-backend-cases-gate-shell`).
|
|
42
|
+
2. **Validated Backend Test Analysis v1** — run-owned `contracts/backend-test-analysis.json` from `backend-test-analysis-contract-shell`.
|
|
43
|
+
3. **Validated Backend Test Execution Contract v1** — run-owned `contracts/backend-test-execution.json` from `backend-test-execution-contract-shell` (fixtures, env *names*, `testRoot`, `targetMode`, authenticationMode).
|
|
44
|
+
4. **Target project conventions** — read `conftest.py`, `pytest.ini` / `pyproject.toml` to understand conventions, but do NOT modify them.
|
|
43
45
|
|
|
44
|
-
Do NOT re-read source documents. Use
|
|
46
|
+
Do NOT re-read source documents for free-form analysis. Use only reviewed cases and the validated contracts. Use only fixture/env/testRoot facts already present in the execution contract; never invent production credentials or secret values.
|
|
45
47
|
|
|
46
48
|
### Conversion Rules
|
|
47
49
|
|
|
@@ -53,10 +55,14 @@ Do NOT re-read source documents. Use the reviewed cases only.
|
|
|
53
55
|
|
|
54
56
|
#### Write Boundary
|
|
55
57
|
|
|
56
|
-
- Only **create new**
|
|
58
|
+
- Only **create new** files under writeSet:
|
|
59
|
+
- `testcase/**/test_*.py`
|
|
60
|
+
- `testcase/**/helpers/**` (optional pure helpers)
|
|
61
|
+
- `testcase/**/factories/**` (optional test data factories)
|
|
57
62
|
- Do NOT modify existing files: `conftest.py`, `pytest.ini`, `pyproject.toml`, `setup.cfg`, `__init__.py`, or any other framework/config file
|
|
58
|
-
- Reuse existing fixtures; if required
|
|
63
|
+
- Reuse existing fixtures; if required helpers are missing, create NEW helper/factory modules under the writeSet paths above — never edit root conftest
|
|
59
64
|
- Read existing framework files to understand conventions, but treat them as immutable
|
|
65
|
+
- Do NOT write production code, `.env`, secrets, or credential files
|
|
60
66
|
|
|
61
67
|
#### Naming Conflict Resolution
|
|
62
68
|
|
|
@@ -86,8 +92,9 @@ def test_BE_ORDER_001_create_order_with_valid_data():
|
|
|
86
92
|
|
|
87
93
|
#### Fixture Strategy
|
|
88
94
|
|
|
89
|
-
- Reuse existing project fixtures from `conftest.py` when available
|
|
90
|
-
- Do not create or modify fixture/configuration files
|
|
95
|
+
- Reuse existing project fixtures from `conftest.py` when available (read-only)
|
|
96
|
+
- Do not create or modify root fixture/configuration files (`conftest.py`, pytest.ini, …)
|
|
97
|
+
- Optional NEW helpers/factories may live under `testcase/**/helpers/**` or `testcase/**/factories/**` only
|
|
91
98
|
- Prefer `@pytest.fixture(scope="function")` for test isolation
|
|
92
99
|
- Use `@pytest.mark.parametrize` for boundary condition cases with multiple inputs
|
|
93
100
|
|
|
@@ -98,12 +105,70 @@ def test_BE_ORDER_001_create_order_with_valid_data():
|
|
|
98
105
|
- Do NOT add workarounds, skips, or try/except blocks to hide failures without explicit justification
|
|
99
106
|
- Report all failures honestly in the output; the downstream `execute-backend-pytest-shell` node captures exit codes and stdout/stderr as-is
|
|
100
107
|
|
|
101
|
-
####
|
|
108
|
+
#### Test Data Preparation Rules (MUST follow)
|
|
109
|
+
|
|
110
|
+
**When Setup is Needed**
|
|
111
|
+
|
|
112
|
+
Setup phase is REQUIRED only when test cases need pre-existing data:
|
|
113
|
+
- Query/Read APIs: need data to exist before querying
|
|
114
|
+
- Update/Delete APIs: need data to exist before modifying
|
|
115
|
+
- State transition tests: need data in specific state
|
|
116
|
+
|
|
117
|
+
Setup phase is NOT needed for:
|
|
118
|
+
- Create APIs: testing the creation itself
|
|
119
|
+
- Validation tests: testing input validation with invalid data
|
|
120
|
+
|
|
121
|
+
**Data Setup Strategy**
|
|
122
|
+
|
|
123
|
+
When setup is needed:
|
|
124
|
+
1. Use `@pytest.fixture(scope='module')` or `@pytest.fixture(scope='session')` to prepare shared test data
|
|
125
|
+
2. All test cases in the file share the same pre-constructed data
|
|
126
|
+
|
|
127
|
+
**Data Construction Priority**
|
|
128
|
+
|
|
129
|
+
1. **API-first**: Use documented APIs from `analyze-inputs-pi` / reviewed cases
|
|
130
|
+
2. **Reuse existing conftest fixtures** (read-only)
|
|
131
|
+
3. **Direct DB writes are last resort** and only via safe test-DB fixtures with rollback/isolation
|
|
132
|
+
4. If neither API nor safe DB fixture exists, **skip with an explicit gap note** — do not invent credentials or touch live data
|
|
133
|
+
|
|
134
|
+
**API Data Construction**
|
|
135
|
+
|
|
136
|
+
- Prefer the `analyze-inputs-pi` API Endpoints section and reviewed cases for method/path/fields
|
|
137
|
+
- Chain API calls only when cases document multi-step preconditions
|
|
138
|
+
- Store created resource IDs in fixtures for reuse
|
|
139
|
+
- Do **not** broadly search host route/controller trees for secrets, `.env`, private keys, or production configs
|
|
140
|
+
- Read host API definitions only when needed to resolve a field name already referenced by reviewed cases
|
|
141
|
+
|
|
142
|
+
**Database Data Construction (restricted)**
|
|
143
|
+
|
|
144
|
+
- Allowed only via existing `conftest.py` test-DB fixtures with transaction rollback or equivalent isolation
|
|
145
|
+
- Never hardcode connection strings, passwords, tokens, or cloud credentials
|
|
146
|
+
- Never target production/shared non-test databases
|
|
147
|
+
- If isolation is unclear, report the gap instead of writing DB rows
|
|
148
|
+
|
|
149
|
+
#### Assertion Rules (MUST follow)
|
|
150
|
+
|
|
151
|
+
**Positive Path (成功场景)**
|
|
152
|
+
|
|
153
|
+
MUST assert ALL of the following:
|
|
154
|
+
1. HTTP status code: as defined in API spec (e.g. 200, 201)
|
|
155
|
+
2. Response structure: key fields exist in response body
|
|
156
|
+
3. Specific values: each field equals expected value from test case
|
|
157
|
+
4. Data type: each field is correct type
|
|
158
|
+
|
|
159
|
+
**Negative Path (异常场景)**
|
|
160
|
+
|
|
161
|
+
MUST assert ALL of the following:
|
|
162
|
+
1. HTTP status code: as defined in API spec (e.g. 400, 404, 500)
|
|
163
|
+
2. Error code field: field name from API spec (e.g. code, error_code, errcode, ret)
|
|
164
|
+
3. Error message field: field name from API spec (e.g. message, msg, errmsg, error)
|
|
165
|
+
|
|
166
|
+
**Field Name Resolution**
|
|
167
|
+
|
|
168
|
+
Field names MUST come from the upstream `analyze-inputs-pi` output (API Endpoints section), NOT hardcoded. For example:
|
|
169
|
+
- If API spec defines `{"ret": 0, "msg": "success"}`, assert `response.json()["ret"]` and `response.json()["msg"]`
|
|
170
|
+
- If API spec defines `{"code": 4001, "message": "error"}`, assert `response.json()["code"]` and `response.json()["message"]`
|
|
102
171
|
|
|
103
|
-
- Use `assert` statements, not `unittest` assertions
|
|
104
|
-
- Assert specific values, not just "no exception"
|
|
105
|
-
- For API tests: assert status code, response body keys, and specific field values
|
|
106
|
-
- For database tests: assert record state after operation
|
|
107
172
|
|
|
108
173
|
#### Conditional Test Implementation (include ONLY if test cases exist)
|
|
109
174
|
|