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 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 driftBySpec = failureAnalysisEnabled && opts.driftAudit !== false ? await runDriftAudit(specs, opts, cwd) : /* @__PURE__ */ new Map();
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 drift findings and
5591
- * (for a failed spec) the failure-analysis fields. Runs inside the pool worker
5592
- * so the row can be upserted incrementally the moment the spec finishes.
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` against every spec and return a
5628
- * `featureName/specName driftIssues` map. This is a static spec↔code audit,
5629
- * so it takes the spec list directly and runs before execution — each worker
5630
- * then has its spec's drift context in hand for the failure-analysis prompt.
5631
- * Drift findings are advisory — they show in the report (report.json / hub UI)
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 runDriftAudit(specs, opts, cwd) {
5635
- const targets = specs.map((s) => ({
5636
- featureName: s.featureName,
5637
- specName: s.specName
5638
- }));
5639
- const out = /* @__PURE__ */ new Map();
5640
- if (targets.length === 0) return out;
5641
- blank();
5642
- info(`drift audit: ${targets.length} spec${targets.length > 1 ? "s" : ""}`);
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: await loadAvailableBlocks(cwd),
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
- for (const r of results) {
5652
- const key = `${r.target.featureName}/${r.target.specName}`;
5653
- if (r.ok) out.set(key, r.issues.length > 0 ? r.issues : null);
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 out;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccqa",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "description": "Browser test recorder powered by Claude Code and agent-browser",
6
6
  "repository": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccqa",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "description": "Browser test recorder powered by Claude Code and agent-browser",
6
6
  "repository": {