ccqa 1.1.0 → 1.1.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/dist/bin/ccqa.mjs +29 -36
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/bin/ccqa.mjs
CHANGED
|
@@ -5527,7 +5527,7 @@ async function runLiveSpecs(specs, opts) {
|
|
|
5527
5527
|
if (userPromptBundle !== null) meta("prompt", userPromptBundle.loaded.join(" + "));
|
|
5528
5528
|
const userPromptSuffix = userPromptBundle?.text ?? null;
|
|
5529
5529
|
const failureAnalysisEnabled = opts.failureAnalysis !== false;
|
|
5530
|
-
const
|
|
5530
|
+
const driftAuditEnabled = failureAnalysisEnabled && opts.driftAudit !== false;
|
|
5531
5531
|
const auth = failureAnalysisEnabled ? driftAuthAvailable() : {
|
|
5532
5532
|
ok: false,
|
|
5533
5533
|
reason: "disabled"
|
|
@@ -5562,12 +5562,12 @@ async function runLiveSpecs(specs, opts) {
|
|
|
5562
5562
|
row: null
|
|
5563
5563
|
};
|
|
5564
5564
|
const row = await buildLiveReportRow(outcome, {
|
|
5565
|
-
driftBySpec,
|
|
5566
5565
|
auth,
|
|
5567
5566
|
diff,
|
|
5568
5567
|
baseRef,
|
|
5569
5568
|
reportDir,
|
|
5570
|
-
failureAnalysisEnabled
|
|
5569
|
+
failureAnalysisEnabled,
|
|
5570
|
+
driftAuditEnabled
|
|
5571
5571
|
}, opts, cwd);
|
|
5572
5572
|
await opts.report?.upsert(row);
|
|
5573
5573
|
return {
|
|
@@ -5587,13 +5587,13 @@ async function runLiveSpecs(specs, opts) {
|
|
|
5587
5587
|
};
|
|
5588
5588
|
}
|
|
5589
5589
|
/**
|
|
5590
|
-
* Build one spec's report row: the live-run base row plus
|
|
5591
|
-
*
|
|
5592
|
-
*
|
|
5590
|
+
* Build one spec's report row: the live-run base row plus (for a failed spec)
|
|
5591
|
+
* the drift audit and failure-analysis fields. Runs inside the pool worker so
|
|
5592
|
+
* the row can be upserted incrementally the moment the spec finishes. The
|
|
5593
|
+
* drift audit only runs for failed specs — passing specs get no driftIssues,
|
|
5594
|
+
* matching the deterministic path.
|
|
5593
5595
|
*/
|
|
5594
5596
|
async function buildLiveReportRow(r, ctx, opts, cwd) {
|
|
5595
|
-
const key = `${r.featureName}/${r.specName}`;
|
|
5596
|
-
const driftForSpec = ctx.driftBySpec.get(key) ?? null;
|
|
5597
5597
|
const base = await liveRunToReportResult({
|
|
5598
5598
|
featureName: r.featureName,
|
|
5599
5599
|
specName: r.specName,
|
|
@@ -5601,6 +5601,7 @@ async function buildLiveReportRow(r, ctx, opts, cwd) {
|
|
|
5601
5601
|
result: r.result,
|
|
5602
5602
|
reportDir: ctx.reportDir
|
|
5603
5603
|
});
|
|
5604
|
+
const driftForSpec = ctx.driftAuditEnabled && r.result.status === "failed" ? await runDriftAuditOne(r, opts, cwd) : null;
|
|
5604
5605
|
const analysis = ctx.failureAnalysisEnabled && r.result.status === "failed" ? await analyzeOneLiveFailure(r, ctx.diff, ctx.baseRef, driftForSpec, ctx.auth, opts, cwd) : void 0;
|
|
5605
5606
|
return {
|
|
5606
5607
|
...base,
|
|
@@ -5624,39 +5625,31 @@ function analysisFieldsFor(a, status, failureAnalysisEnabled) {
|
|
|
5624
5625
|
return {};
|
|
5625
5626
|
}
|
|
5626
5627
|
/**
|
|
5627
|
-
* Run `analyzeDrift`
|
|
5628
|
-
*
|
|
5629
|
-
*
|
|
5630
|
-
*
|
|
5631
|
-
*
|
|
5632
|
-
* but do not change the live-run exit code.
|
|
5628
|
+
* Run `analyzeDrift` for one failed spec, used as evidence for its
|
|
5629
|
+
* failure-analysis prompt and shown in its report row. Mirrors the
|
|
5630
|
+
* deterministic path (src/run/pipeline.ts), which also scopes the audit to
|
|
5631
|
+
* failed specs only. Drift findings are advisory — they never change the
|
|
5632
|
+
* live-run exit code.
|
|
5633
5633
|
*/
|
|
5634
|
-
async function
|
|
5635
|
-
const
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
const results = await analyzeDrift({
|
|
5644
|
-
targets,
|
|
5634
|
+
async function runDriftAuditOne(r, opts, cwd) {
|
|
5635
|
+
const key = `${r.featureName}/${r.specName}`;
|
|
5636
|
+
info(`drift audit: ${key}`);
|
|
5637
|
+
const blocks = await loadAvailableBlocks(cwd);
|
|
5638
|
+
const [result] = await analyzeDrift({
|
|
5639
|
+
targets: [{
|
|
5640
|
+
featureName: r.featureName,
|
|
5641
|
+
specName: r.specName
|
|
5642
|
+
}],
|
|
5645
5643
|
cwd,
|
|
5646
|
-
blocks
|
|
5644
|
+
blocks,
|
|
5647
5645
|
...opts.model ? { model: opts.model } : {},
|
|
5648
|
-
...opts.language ? { language: opts.language } : {}
|
|
5649
|
-
onSpecStart: (t) => info(` checking ${t.featureName}/${t.specName}`)
|
|
5646
|
+
...opts.language ? { language: opts.language } : {}
|
|
5650
5647
|
});
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
else {
|
|
5655
|
-
warn(`drift audit failed for ${key}: ${r.error}`);
|
|
5656
|
-
out.set(key, null);
|
|
5657
|
-
}
|
|
5648
|
+
if (!result || !result.ok) {
|
|
5649
|
+
warn(`drift audit failed for ${key}: ${result?.error ?? "no result"}`);
|
|
5650
|
+
return null;
|
|
5658
5651
|
}
|
|
5659
|
-
return
|
|
5652
|
+
return result.issues.length > 0 ? result.issues : null;
|
|
5660
5653
|
}
|
|
5661
5654
|
/**
|
|
5662
5655
|
* Resolve `spec.session` names to a single state file to restore, fetching
|
package/dist/package.json
CHANGED