Skip to content

fix(canary): distinguish a goldens harness error from real drift - #325

Merged
LukasWodka merged 1 commit into
developfrom
fix/canary-harness-error-not-drift
Jul 14, 2026
Merged

fix(canary): distinguish a goldens harness error from real drift#325
LukasWodka merged 1 commit into
developfrom
fix/canary-harness-error-not-drift

Conversation

@LukasWodka

@LukasWodkaLukasWodka commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What

Fixes the Cursor Bugbot "Canary treats script failures as drift" (Medium) finding, surfaced on the #323 develop→main promotion.

head-drift-canary.yml set drift=true on any non-zero exit from scripts/sync-validator-goldens.sh --check. But that exit also fires on harness failures — missing deps, a bad DATA_INGESTORS_DIR, a generator crash — so the tracking issue reported "DRIFT — verdicts/values changed" even when parity was never evaluated, sending someone down the pin-bump playbook to chase an infra bug.

Fix

sync-validator-goldens.sh --check now uses reserved exit codes so consumers can distinguish the cases:

codemeaning
0in sync
2harness error — could not regenerate (deps / DATA_INGESTORS_DIR / generator crash); parity not evaluated
3drift — the ingestor's verdicts or read-path values changed

The required goldens-drift check is unaffected — it reds on any non-zero, and both 2 and 3 are non-zero.

The canary maps them:

  • exit 3drift=true → advisory tracking issue (run stays green, as before).
  • exit 2 / unexpectedevaluated=false → reported as "could not evaluate — harness error" with a note to fix the harness rather than bump the pin.
  • "All clear" now also requires evaluated=true, so a harness error can't be silently reported as all-clear.

Verification

  • --check with no data-ingestors → exits 2, prints HARNESS ERROR, and does not mutate goldens.json
  • actionlint clean, shellcheck clean, YAML valid

Once merged to develop, #323 inherits it and Bugbot re-clears.


Note

Low Risk
Advisory CI reporting and shell script exit semantics only; blocking goldens-drift still fails on any non-zero exit.

Overview
The HEAD-drift canary no longer treats every non-zero exit from sync-validator-goldens.sh --check as goldens drift. --check now documents and uses reserved exit codes: 0 in sync, 2 harness failure (generator/deps/DATA_INGESTORS_DIR — parity never ran), 3 real verdict/value drift. Generator failures exit 2 after restoring goldens.json instead of being lumped with drift.

head-drift-canary.yml maps those codes: exit 3drift=true; exit 2 or other failures → evaluated=false with messaging that parity was not checked. Tracking issues distinguish harness vs drift in the table and body, use pin_actionable so harness-only failures do not show the pin-bump playbook, refresh issue title on update, and require evaluated=true for the "All clear" step.

The blocking goldens-drift job still fails on any non-zero exit (2 or 3); behavior there is unchanged.

Reviewed by Cursor Bugbot for commit 69ed892. Bugbot is set up for automated code reviews on this repo. Configure here.

@LukasWodkaLukasWodka self-assigned this Jul 14, 2026
@LukasWodka
LukasWodka requested a review from saadqbalJuly 14, 2026 18:11
@LukasWodka

Copy link
Copy Markdown
ContributorAuthor

@BugBot run

@LukasWodka

Copy link
Copy Markdown
ContributorAuthor

👋 Heads-up — Code review queue is at 47 / 30

Above the WIP limit. The team convention is to review existing PRs before opening new work.

Open PRs currently in Code review (oldest first):

Pull from review before opening new work. (This is a nudge from the kanban WIP check, not a block.)

Comment thread.github/workflows/head-drift-canary.yml
@LukasWodka

Copy link
Copy Markdown
ContributorAuthor

@BugBot run

@LukasWodka
LukasWodkaforce-pushed the fix/canary-harness-error-not-drift branch from 95fec50 to 16466b1CompareJuly 14, 2026 18:20
Comment thread.github/workflows/head-drift-canary.yml
Comment thread.github/workflows/head-drift-canary.yml
The HEAD-drift canary set drift=true on ANY non-zero exit from
sync-validator-goldens.sh --check. But that exit also covers harness
failures -- missing deps, a bad DATA_INGESTORS_DIR, a generator crash -- so the
tracking issue reported "DRIFT -- verdicts/values changed" even when parity was
never evaluated, sending someone down the pin-bump playbook for an infra bug.
(Cursor Bugbot, Medium, surfaced on the #323 promotion.)
sync-validator-goldens.sh --check now uses reserved exit codes so consumers
can tell the two apart:
0 in sync
2 HARNESS ERROR -- could not regenerate; parity NOT evaluated (not drift)
3 DRIFT -- verdicts / read-path values changed
The required goldens-drift check is unaffected (it reds on any non-zero).
The canary adapts the WHOLE tracking issue to the signal via a pin_actionable
flag (real drift OR source diff OR unreachable pin):
- pin_actionable -> drift framing: the pin-bump Playbook, the "HEAD has
drifted" title, and the "close when the pin bump lands" footer.
- harness-only (evaluated=false, no source diff, pin reachable) -> harness
framing: NO Playbook, a "could not run (harness error)" title, and a "fix
the harness, do NOT bump the pin" footer.
The harness-error note is purely factual (no bump/don't-bump wording) so it
never contradicts the Playbook when a harness error co-occurs with a real
source diff. The title is recomputed from the current signal and refreshed on
EVERY run (issue edit, not only create) so a persistent issue's title never
lags the latest failure mode. "All clear" requires evaluated=true so it cannot
mask a harness failure.
Verified: --check with no data-ingestors exits 2 with a HARNESS ERROR message
and does not mutate goldens.json; the reporting script, exercised across
harness-only, harness+source-diff, real-drift, and existing-vs-new-issue
scenarios, produces a self-consistent row / note / playbook / footer / title
each time; actionlint + shellcheck clean; YAML valid.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@LukasWodka

Copy link
Copy Markdown
ContributorAuthor

@BugBot run

@LukasWodka
LukasWodkaforce-pushed the fix/canary-harness-error-not-drift branch from 16466b1 to 69ed892CompareJuly 14, 2026 18:28

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 69ed892. Configure here.

@LukasWodka
LukasWodka merged commit 8900ba8 into developJul 14, 2026
21 checks passed
@LukasWodka
LukasWodka deleted the fix/canary-harness-error-not-drift branch July 14, 2026 18:48
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@LukasWodka@saadqbal