rungate 0.2.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/.claude/agents/aditi.md +47 -0
- package/.claude/agents/marcus.md +50 -0
- package/.claude/agents/quinn.md +58 -0
- package/.claude/agents/rook.md +47 -0
- package/.claude/agents/serena.md +46 -0
- package/.claude/rungate.json +11 -0
- package/.fallowrc.json +28 -0
- package/.github/copilot-instructions.md +20 -0
- package/.rungate/conformity-findings.json +648 -0
- package/AGENTS.md +106 -0
- package/CODE-MAP.md +50 -0
- package/HARNESS.md +88 -0
- package/bun.lock +26 -0
- package/bunfig.toml +2 -0
- package/config/brief-policies.json +28 -0
- package/config/ceremony-profiles.json +212 -0
- package/config/consumer-cascade-map.json +24 -0
- package/config/doc-cascade-map.json +24 -0
- package/config/eval.json +84 -0
- package/config/profiles/account-plan.yaml +36 -0
- package/config/profiles/campaign.yaml +94 -0
- package/config/prove-evidence.schema.json +65 -0
- package/config/spec-policies.json +36 -0
- package/config/workflow-schema.json +281 -0
- package/gates/SCHEMA-GUIDE.md +121 -0
- package/gates/ac-quality.test.ts +106 -0
- package/gates/adversarial.test.ts +274 -0
- package/gates/brief-assembler.test.ts +429 -0
- package/gates/brief-assembler.ts +334 -0
- package/gates/bunfig.toml +2 -0
- package/gates/chain.test.ts +91 -0
- package/gates/e2e-smoke.test.ts +234 -0
- package/gates/error-classifier.test.ts +249 -0
- package/gates/error-classifier.ts +89 -0
- package/gates/orchestrator.test.ts +950 -0
- package/gates/orchestrator.ts +569 -0
- package/gates/preload.ts +77 -0
- package/gates/prompts/ac-adversary.md +20 -0
- package/gates/prompts/evidence-validator.md +22 -0
- package/gates/prompts/prove-reproducer.md +53 -0
- package/gates/prove.test.ts +164 -0
- package/gates/run-gate.ts +936 -0
- package/gates/schema-parity.test.ts +197 -0
- package/gates/schema.ts +362 -0
- package/gates/self-heal.test.ts +511 -0
- package/gates/self-heal.ts +121 -0
- package/gates/ship-orchestrator.test.ts +379 -0
- package/gates/ship-orchestrator.ts +363 -0
- package/gates/test-fixtures/broken-no-environments.json +60 -0
- package/gates/test-fixtures/valid-standard.json +54 -0
- package/gates/test-utils.ts +43 -0
- package/gates/witness.ts +220 -0
- package/gates/workflow.test.ts +1053 -0
- package/hooks/AgentBriefGuard.hook.ts +586 -0
- package/hooks/AgentVerdictCapture.hook.ts +134 -0
- package/hooks/AutoVerifyGate.hook.ts +76 -0
- package/hooks/GateEnforcement.hook.ts +273 -0
- package/hooks/IssueCloseGuard.hook.ts +116 -0
- package/hooks/MergeGuard.hook.ts +55 -0
- package/hooks/StaleTTLCleanup.hook.ts +133 -0
- package/hooks/VerifyPhaseLock.hook.ts +81 -0
- package/hooks/WorkflowStateGuard.hook.ts +37 -0
- package/hooks/lib/agentDetection.ts +70 -0
- package/hooks/lib/findWorkflow.ts +101 -0
- package/hooks/lib/parseStdin.ts +37 -0
- package/hooks/lib/paths.ts +111 -0
- package/hooks/lib/utils.ts +81 -0
- package/lib/conformity.ts +959 -0
- package/lib/paths.ts +23 -0
- package/lib/rungate-schema.ts +60 -0
- package/lib/signal-phrases.ts +7 -0
- package/package.json +20 -0
- package/prompts/ac-adversary.md +20 -0
- package/prompts/ac-format.md +34 -0
- package/prompts/aditi.md +29 -0
- package/prompts/blast-radius.md +29 -0
- package/prompts/coding-principles.md +34 -0
- package/prompts/container-rebuild.md +29 -0
- package/prompts/container-verify.md +28 -0
- package/prompts/discovery.md +27 -0
- package/prompts/environment.md +28 -0
- package/prompts/escalation-decision-tree.md +38 -0
- package/prompts/evidence-hierarchy.md +31 -0
- package/prompts/evidence-validator.md +22 -0
- package/prompts/marcus.md +29 -0
- package/prompts/prevention.md +26 -0
- package/prompts/prove-reproducer.md +43 -0
- package/prompts/quinn-decision-tree.md +31 -0
- package/prompts/quinn-ui-brief.md +106 -0
- package/prompts/quinn.md +29 -0
- package/prompts/rca.md +28 -0
- package/prompts/read-before-write.md +30 -0
- package/prompts/regression.md +26 -0
- package/prompts/rook.md +29 -0
- package/prompts/serena.md +28 -0
- package/prompts/testing-strategy.md +34 -0
- package/reference/migration-manifest.json +554 -0
- package/reference/prompts/agent-aditi.md +38 -0
- package/reference/prompts/agent-marcus.md +38 -0
- package/reference/prompts/agent-quinn.md +38 -0
- package/reference/prompts/agent-rook.md +37 -0
- package/reference/prompts/agent-serena.md +37 -0
- package/reference/prompts/council-skill.md +170 -0
- package/reference/prompts/goal-skill.md +235 -0
- package/reference/prompts/prove-skill.md +283 -0
- package/reference/prompts/quinn-standard.md +246 -0
- package/reference/prompts/ship-convergence.md +65 -0
- package/reference/prompts/ship-escalation.md +43 -0
- package/reference/prompts/ship-iteration.md +382 -0
- package/reference/prompts/ship-pending-patches.md +246 -0
- package/reference/prompts/ship-reference.md +250 -0
- package/reference/prompts/ship-skill.md +347 -0
- package/reference/prompts/ship-templates.md +215 -0
- package/reference/scripts/batch-status.sh +68 -0
- package/reference/scripts/chain-compat-check.sh +67 -0
- package/reference/scripts/context-audit.sh +314 -0
- package/reference/scripts/dead-export-check.sh +61 -0
- package/reference/scripts/generate-qc-tables.sh +92 -0
- package/reference/scripts/harness-init.sh +111 -0
- package/reference/scripts/pai-054-baseline-check.sh +40 -0
- package/reference/scripts/prove-smoke-test.sh +112 -0
- package/reference/scripts/setup-keychain-salt.sh +12 -0
- package/reference/scripts/skill-optimizer-friday.sh +88 -0
- package/reference/scripts/skill-qc-test.sh +351 -0
- package/reference/scripts/skill-synthesize-tonight.sh +66 -0
- package/reference/specs/HARNESS-EXTRACTION-SPEC.md +263 -0
- package/reference/specs/harness-v3-bash-deletion-plan.md +65 -0
- package/reference/specs/harness-v3-migration-plan.md +188 -0
- package/scripts/decision-reconcile.sh +74 -0
- package/scripts/decision-reconcile.ts +152 -0
- package/scripts/extract-constraints.ts +260 -0
- package/scripts/generate-code-map.ts +339 -0
- package/scripts/git-hooks/pre-commit +76 -0
- package/scripts/git-hooks/pre-push +271 -0
- package/scripts/harness-skill-check.sh +52 -0
- package/scripts/lib/gap-emit.sh +65 -0
- package/scripts/lib/jq-update.sh +30 -0
- package/scripts/lib/resolve-slug.sh +30 -0
- package/scripts/lib/verify-spec-compliance.sh +102 -0
- package/scripts/prove-backfill.sh +87 -0
- package/scripts/scaffold-project.ts +1488 -0
- package/scripts/scaffold-rungate-config.ts +91 -0
- package/scripts/self-containment-check.sh +109 -0
- package/scripts/skill-qc-validator.sh +402 -0
- package/scripts/slug-resolver.sh +14 -0
- package/scripts/sync-spec-tests.ts +236 -0
- package/specs/BOOTSTRAP-DATA-FLOW-SPEC.md +2493 -0
- package/specs/BOOTSTRAP-TEST-PLAN.md +571 -0
- package/specs/HARNESS-GATES.md +256 -0
- package/specs/HARNESS-SKILL-CHAIN.md +286 -0
- package/specs/HARNESS-SKILL-CONTRACT.md +93 -0
- package/specs/HARNESS-STANDARD.md +488 -0
- package/specs/SPEC-TEMPLATE.md +53 -0
- package/specs/bootstrap-data-flow.png +0 -0
- package/specs/harness-automation-matrix.md +314 -0
- package/specs/harness-automation-matrix.rules.json +64 -0
- package/test/anti.test.ts +80 -0
- package/test/contract-negative.test.ts +86 -0
- package/test/contract.test.ts +158 -0
- package/test/external-deps.test.ts +48 -0
- package/test/fixtures/golden-project/.env.example +3 -0
- package/test/fixtures/golden-project/Makefile +7 -0
- package/test/fixtures/golden-project/docs/adr/ADR-001-framework.md +23 -0
- package/test/fixtures/golden-project/docs/setup-guide.md +10 -0
- package/test/fixtures/golden-project/package.json +10 -0
- package/test/fixtures/golden-project/specs/api-spec.md +20 -0
- package/test/fixtures/golden-project/src/auth.ts +8 -0
- package/test/fixtures/golden-project/src/db.ts +11 -0
- package/test/fixtures/golden-project/src/index.ts +19 -0
- package/test/fixtures/golden-project/src/utils/format.ts +3 -0
- package/test/fixtures/golden-project/test/auth.test.ts +15 -0
- package/test/fixtures/golden-project/tsconfig.json +12 -0
- package/test/meta-sc-coverage.test.ts +159 -0
- package/test/phase-0.test.ts +846 -0
- package/test/phase-1.test.ts +617 -0
- package/test/phase-2.test.ts +620 -0
- package/test/phase-3.test.ts +99 -0
- package/test/scaffold-conformity.test.ts +8 -0
- package/test/schema-canary.test.ts +51 -0
- package/test/spec-compliance-auto.test.ts +64 -0
- package/test/spec-compliance.test.ts +295 -0
- package/test/spec-discovery.test.ts +68 -0
- package/test/spec-drift.test.ts +5 -0
- package/test/structure.test.ts +165 -0
- package/test/unit/agent-brief-guard-ship.test.ts +293 -0
- package/test/unit/extract-constraints.test.ts +145 -0
- package/test/unit/issue-close-guard.test.ts +204 -0
- package/test/unit/scaffold-project.test.ts +417 -0
- package/test/unit/skill-cooccurrence.test.ts +177 -0
- package/test/unit/skill-sequence-logger.test.ts +244 -0
- package/test/unit/workflow-state-guard.test.ts +95 -0
- package/workflows/batch-ship.js +295 -0
- package/workflows/council.js +481 -0
- package/workflows/prove.js +560 -0
- package/workflows/ship.js +789 -0
- package/workflows/verify.js +236 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { test, expect, describe } from "bun:test";
|
|
2
|
+
import { classifyFailures, type FailureCategory, type Classification } from "./error-classifier";
|
|
3
|
+
|
|
4
|
+
function fail(check: string, detail = ""): { check: string; result: string; detail: string } {
|
|
5
|
+
return { check, result: "FAIL", detail };
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
describe("error-classifier", () => {
|
|
9
|
+
describe("STATE category", () => {
|
|
10
|
+
test("workflow-state.json validates", () => {
|
|
11
|
+
const c = classifyFailures([fail("workflow-state.json validates", "schema error")]);
|
|
12
|
+
expect(c.category).toBe("STATE");
|
|
13
|
+
expect(c.retryable).toBe(true);
|
|
14
|
+
expect(c.regressionTarget).toBeUndefined();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test("sourceSpecs-required", () => {
|
|
18
|
+
const c = classifyFailures([fail("sourceSpecs-required")]);
|
|
19
|
+
expect(c.category).toBe("STATE");
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test("discovery-evidence", () => {
|
|
23
|
+
const c = classifyFailures([fail("discovery-evidence")]);
|
|
24
|
+
expect(c.category).toBe("STATE");
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test("spec-elements-in-acs", () => {
|
|
28
|
+
const c = classifyFailures([fail("spec-elements-in-acs")]);
|
|
29
|
+
expect(c.category).toBe("STATE");
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test("no 'DA should'", () => {
|
|
33
|
+
const c = classifyFailures([fail("no 'DA should'")]);
|
|
34
|
+
expect(c.category).toBe("STATE");
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test("checks containing threshold", () => {
|
|
38
|
+
const c = classifyFailures([fail("weak-threshold-check")]);
|
|
39
|
+
expect(c.category).toBe("STATE");
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test("checks containing statement", () => {
|
|
43
|
+
const c = classifyFailures([fail("statement-length-check")]);
|
|
44
|
+
expect(c.category).toBe("STATE");
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test("checks containing schema", () => {
|
|
48
|
+
const c = classifyFailures([fail("schema-version-check")]);
|
|
49
|
+
expect(c.category).toBe("STATE");
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe("CODE category", () => {
|
|
54
|
+
test("tests-pass", () => {
|
|
55
|
+
const c = classifyFailures([fail("tests-pass", "3 tests failed")]);
|
|
56
|
+
expect(c.category).toBe("CODE");
|
|
57
|
+
expect(c.retryable).toBe(true);
|
|
58
|
+
expect(c.regressionTarget).toBe("BUILD");
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test("tsc-pass", () => {
|
|
62
|
+
const c = classifyFailures([fail("tsc-pass", "type errors")]);
|
|
63
|
+
expect(c.category).toBe("CODE");
|
|
64
|
+
expect(c.regressionTarget).toBe("BUILD");
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test("code-committed", () => {
|
|
68
|
+
const c = classifyFailures([fail("code-committed")]);
|
|
69
|
+
expect(c.category).toBe("CODE");
|
|
70
|
+
expect(c.regressionTarget).toBe("BUILD");
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test("brief-ac-alignment", () => {
|
|
74
|
+
const c = classifyFailures([fail("brief-ac-alignment")]);
|
|
75
|
+
expect(c.category).toBe("CODE");
|
|
76
|
+
expect(c.regressionTarget).toBe("BUILD");
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
describe("DISCOVERY category", () => {
|
|
81
|
+
test("ac-issue-alignment", () => {
|
|
82
|
+
const c = classifyFailures([fail("ac-issue-alignment")]);
|
|
83
|
+
expect(c.category).toBe("DISCOVERY");
|
|
84
|
+
expect(c.retryable).toBe(true);
|
|
85
|
+
expect(c.regressionTarget).toBe("DISCOVERY");
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test("issue-goal-captured", () => {
|
|
89
|
+
const c = classifyFailures([fail("issue-goal-captured")]);
|
|
90
|
+
expect(c.category).toBe("DISCOVERY");
|
|
91
|
+
expect(c.regressionTarget).toBe("DISCOVERY");
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test("sizing-declared", () => {
|
|
95
|
+
const c = classifyFailures([fail("sizing-declared")]);
|
|
96
|
+
expect(c.category).toBe("DISCOVERY");
|
|
97
|
+
expect(c.regressionTarget).toBe("DISCOVERY");
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
describe("ENVIRONMENT category", () => {
|
|
102
|
+
test("container-has-fix", () => {
|
|
103
|
+
const c = classifyFailures([fail("container-has-fix")]);
|
|
104
|
+
expect(c.category).toBe("ENVIRONMENT");
|
|
105
|
+
expect(c.retryable).toBe(true);
|
|
106
|
+
expect(c.regressionTarget).toBeUndefined();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
test("local-api-validated", () => {
|
|
110
|
+
const c = classifyFailures([fail("local-api-validated")]);
|
|
111
|
+
expect(c.category).toBe("ENVIRONMENT");
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test("local-ui-validated", () => {
|
|
115
|
+
const c = classifyFailures([fail("local-ui-validated")]);
|
|
116
|
+
expect(c.category).toBe("ENVIRONMENT");
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test("prod-rebuild-pass", () => {
|
|
120
|
+
const c = classifyFailures([fail("prod-rebuild-pass")]);
|
|
121
|
+
expect(c.category).toBe("ENVIRONMENT");
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test("prod-smoke-pass", () => {
|
|
125
|
+
const c = classifyFailures([fail("prod-smoke-pass")]);
|
|
126
|
+
expect(c.category).toBe("ENVIRONMENT");
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
test("prod-quinn-pass", () => {
|
|
130
|
+
const c = classifyFailures([fail("prod-quinn-pass")]);
|
|
131
|
+
expect(c.category).toBe("ENVIRONMENT");
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
test("code-pushed", () => {
|
|
135
|
+
const c = classifyFailures([fail("code-pushed")]);
|
|
136
|
+
expect(c.category).toBe("ENVIRONMENT");
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
test("branch-merged", () => {
|
|
140
|
+
const c = classifyFailures([fail("branch-merged")]);
|
|
141
|
+
expect(c.category).toBe("ENVIRONMENT");
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
describe("NON_RETRYABLE category", () => {
|
|
146
|
+
test("failure containing auth", () => {
|
|
147
|
+
const c = classifyFailures([fail("github-auth-check", "auth token expired")]);
|
|
148
|
+
expect(c.category).toBe("NON_RETRYABLE");
|
|
149
|
+
expect(c.retryable).toBe(false);
|
|
150
|
+
expect(c.regressionTarget).toBeUndefined();
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
test("failure containing credential", () => {
|
|
154
|
+
const c = classifyFailures([fail("credential-check", "no credentials")]);
|
|
155
|
+
expect(c.category).toBe("NON_RETRYABLE");
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
test("failure containing permission", () => {
|
|
159
|
+
const c = classifyFailures([fail("permission-denied", "insufficient")]);
|
|
160
|
+
expect(c.category).toBe("NON_RETRYABLE");
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test("failure containing timeout", () => {
|
|
164
|
+
const c = classifyFailures([fail("api-timeout", "30s exceeded")]);
|
|
165
|
+
expect(c.category).toBe("NON_RETRYABLE");
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
test("unknown check defaults to NON_RETRYABLE", () => {
|
|
169
|
+
const c = classifyFailures([fail("totally-unknown-check-xyz")]);
|
|
170
|
+
expect(c.category).toBe("NON_RETRYABLE");
|
|
171
|
+
expect(c.retryable).toBe(false);
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
describe("priority ordering", () => {
|
|
176
|
+
test("NON_RETRYABLE beats everything", () => {
|
|
177
|
+
const c = classifyFailures([
|
|
178
|
+
fail("tests-pass"), // CODE
|
|
179
|
+
fail("api-timeout"), // NON_RETRYABLE
|
|
180
|
+
fail("container-has-fix"), // ENVIRONMENT
|
|
181
|
+
]);
|
|
182
|
+
expect(c.category).toBe("NON_RETRYABLE");
|
|
183
|
+
expect(c.retryable).toBe(false);
|
|
184
|
+
expect(c.failures).toHaveLength(3);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
test("DISCOVERY beats CODE", () => {
|
|
188
|
+
const c = classifyFailures([
|
|
189
|
+
fail("tests-pass"), // CODE
|
|
190
|
+
fail("ac-issue-alignment"), // DISCOVERY
|
|
191
|
+
]);
|
|
192
|
+
expect(c.category).toBe("DISCOVERY");
|
|
193
|
+
expect(c.regressionTarget).toBe("DISCOVERY");
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
test("CODE beats STATE", () => {
|
|
197
|
+
const c = classifyFailures([
|
|
198
|
+
fail("workflow-state.json validates"), // STATE
|
|
199
|
+
fail("tsc-pass"), // CODE
|
|
200
|
+
]);
|
|
201
|
+
expect(c.category).toBe("CODE");
|
|
202
|
+
expect(c.regressionTarget).toBe("BUILD");
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
test("STATE beats ENVIRONMENT", () => {
|
|
206
|
+
const c = classifyFailures([
|
|
207
|
+
fail("container-has-fix"), // ENVIRONMENT
|
|
208
|
+
fail("sourceSpecs-required"), // STATE
|
|
209
|
+
]);
|
|
210
|
+
expect(c.category).toBe("STATE");
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
test("all categories mixed picks NON_RETRYABLE", () => {
|
|
214
|
+
const c = classifyFailures([
|
|
215
|
+
fail("container-has-fix"), // ENVIRONMENT
|
|
216
|
+
fail("sourceSpecs-required"), // STATE
|
|
217
|
+
fail("tests-pass"), // CODE
|
|
218
|
+
fail("ac-issue-alignment"), // DISCOVERY
|
|
219
|
+
fail("permission-check"), // NON_RETRYABLE
|
|
220
|
+
]);
|
|
221
|
+
expect(c.category).toBe("NON_RETRYABLE");
|
|
222
|
+
expect(c.failures).toHaveLength(5);
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
describe("edge cases", () => {
|
|
227
|
+
test("empty failures array", () => {
|
|
228
|
+
const c = classifyFailures([]);
|
|
229
|
+
expect(c.category).toBe("NON_RETRYABLE");
|
|
230
|
+
expect(c.retryable).toBe(false);
|
|
231
|
+
expect(c.failures).toHaveLength(0);
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
test("single failure preserves detail", () => {
|
|
235
|
+
const c = classifyFailures([fail("tests-pass", "AssertionError in foo.test.ts")]);
|
|
236
|
+
expect(c.failures[0].detail).toBe("AssertionError in foo.test.ts");
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
test("NON_RETRYABLE keyword in detail field does not trigger", () => {
|
|
240
|
+
const c = classifyFailures([fail("tests-pass", "auth module test failed")]);
|
|
241
|
+
expect(c.category).toBe("CODE");
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
test("case-insensitive NON_RETRYABLE check matching", () => {
|
|
245
|
+
const c = classifyFailures([fail("AUTH-TOKEN-EXPIRED")]);
|
|
246
|
+
expect(c.category).toBe("NON_RETRYABLE");
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export type FailureCategory = "STATE" | "CODE" | "DISCOVERY" | "ENVIRONMENT" | "NON_RETRYABLE";
|
|
2
|
+
|
|
3
|
+
export interface Classification {
|
|
4
|
+
category: FailureCategory;
|
|
5
|
+
regressionTarget?: "BUILD" | "DISCOVERY";
|
|
6
|
+
retryable: boolean;
|
|
7
|
+
failures: Array<{ check: string; result: string; detail: string }>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const PRIORITY: FailureCategory[] = ["NON_RETRYABLE", "DISCOVERY", "CODE", "STATE", "ENVIRONMENT"];
|
|
11
|
+
|
|
12
|
+
const STATE_CHECKS = new Set([
|
|
13
|
+
"workflow-state.json validates",
|
|
14
|
+
"sourceSpecs-required",
|
|
15
|
+
"discovery-evidence",
|
|
16
|
+
"spec-elements-in-acs",
|
|
17
|
+
"no 'DA should'",
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
const CODE_CHECKS = new Set([
|
|
21
|
+
"tests-pass",
|
|
22
|
+
"tsc-pass",
|
|
23
|
+
"code-committed",
|
|
24
|
+
"brief-ac-alignment",
|
|
25
|
+
]);
|
|
26
|
+
|
|
27
|
+
const DISCOVERY_CHECKS = new Set([
|
|
28
|
+
"ac-issue-alignment",
|
|
29
|
+
"issue-goal-captured",
|
|
30
|
+
"sizing-declared",
|
|
31
|
+
]);
|
|
32
|
+
|
|
33
|
+
const ENVIRONMENT_CHECKS = new Set([
|
|
34
|
+
"container-has-fix",
|
|
35
|
+
"local-api-validated",
|
|
36
|
+
"local-ui-validated",
|
|
37
|
+
"prod-rebuild-pass",
|
|
38
|
+
"prod-smoke-pass",
|
|
39
|
+
"prod-quinn-pass",
|
|
40
|
+
"code-pushed",
|
|
41
|
+
"branch-merged",
|
|
42
|
+
]);
|
|
43
|
+
|
|
44
|
+
const STATE_KEYWORDS = ["threshold", "statement", "schema"];
|
|
45
|
+
const NON_RETRYABLE_KEYWORDS = ["auth", "credential", "permission", "timeout"];
|
|
46
|
+
|
|
47
|
+
function categorizeCheck(check: string): FailureCategory {
|
|
48
|
+
const lower = check.toLowerCase();
|
|
49
|
+
|
|
50
|
+
if (NON_RETRYABLE_KEYWORDS.some((kw) => lower.includes(kw))) return "NON_RETRYABLE";
|
|
51
|
+
if (STATE_CHECKS.has(check)) return "STATE";
|
|
52
|
+
if (CODE_CHECKS.has(check)) return "CODE";
|
|
53
|
+
if (DISCOVERY_CHECKS.has(check)) return "DISCOVERY";
|
|
54
|
+
if (ENVIRONMENT_CHECKS.has(check)) return "ENVIRONMENT";
|
|
55
|
+
if (STATE_KEYWORDS.some((kw) => lower.includes(kw))) return "STATE";
|
|
56
|
+
|
|
57
|
+
return "NON_RETRYABLE";
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const CATEGORY_META: Record<FailureCategory, { retryable: boolean; regressionTarget?: "BUILD" | "DISCOVERY" }> = {
|
|
61
|
+
STATE: { retryable: true },
|
|
62
|
+
CODE: { retryable: true, regressionTarget: "BUILD" },
|
|
63
|
+
DISCOVERY: { retryable: true, regressionTarget: "DISCOVERY" },
|
|
64
|
+
ENVIRONMENT: { retryable: true },
|
|
65
|
+
NON_RETRYABLE: { retryable: false },
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export function classifyFailures(
|
|
69
|
+
failures: Array<{ check: string; result: string; detail: string }>,
|
|
70
|
+
): Classification {
|
|
71
|
+
if (failures.length === 0) {
|
|
72
|
+
return { category: "NON_RETRYABLE", retryable: false, failures: [] };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const categories = new Set<FailureCategory>();
|
|
76
|
+
for (const f of failures) {
|
|
77
|
+
categories.add(categorizeCheck(f.check));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const winner = PRIORITY.find((p) => categories.has(p)) ?? "NON_RETRYABLE";
|
|
81
|
+
const meta = CATEGORY_META[winner];
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
category: winner,
|
|
85
|
+
retryable: meta.retryable,
|
|
86
|
+
regressionTarget: meta.regressionTarget,
|
|
87
|
+
failures,
|
|
88
|
+
};
|
|
89
|
+
}
|