Skip to content

fix: preserve verdict state and skip cancelled preview gates - #1139

Merged
kyle-compute merged 2 commits into
stagingfrom
fix/verdict-state-machine
Aug 10, 2026
Merged

fix: preserve verdict state and skip cancelled preview gates#1139
kyle-compute merged 2 commits into
stagingfrom
fix/verdict-state-machine

Conversation

@kyle-compute

@kyle-compute kyle-compute commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • centralize all task verdict lifecycle mutations in a typed oddish.core.verdict_state transition module
  • preserve the last published verdict while replacement QA is queued or running, and restore it when append, retry, quota cancellation, or a no-op abandons that replacement
  • keep terminal QA failure as the only transition that discards a superseded payload
  • add and document a database invariant preventing published verdict payloads from being paired with a missing or failed status
  • include fix(ci): the preview gate skips cancelled runs #1079 so superseded, cancelled PR Preview runs skip the required preview gate instead of publishing a false failure

Verdict root cause

tasks.verdict represents the last published result, while verdict_status also tracks an in-flight replacement pass. Callers were mutating those columns independently. In particular, clear_inflight_verdict only preserved a result when the status was already SUCCESS; after a replacement moved the status to QUEUED or RUNNING, append/retry reconciliation could clear the status while leaving the payload behind.

The new state module makes the published-result and replacement-attempt contract explicit and is now the only runtime writer for the task verdict columns.

Preview gate

This incorporates the substantive commit from #1079 with its original author attribution. The Require working preview job now uses !cancelled() instead of always(): it still runs when fork or promotion dependencies are skipped, but a run superseded by cancel-in-progress no longer reports a false failing required check while its replacement is building.

Migration

verdict_state_001 adds ck_tasks_published_verdict_status as NOT VALID, repairs historical rows, then validates it:

  • payload + missing status becomes SUCCESS
  • payload + FAILED discards the stale payload
  • both SQL NULL and JSONB null are treated as unpublished

Validation

  • 71 focused and Postgres integration tests passed across verdict transitions, append/gating, quota cancellation, retry, manual QA rerun, cleanup, migration, and QA stage transitions
  • verified fresh Alembic upgrade and downgrade/repair/upgrade against PostgreSQL 16
  • workflow YAML and repository hygiene hooks pass for the incorporated fix(ci): the preview gate skips cancelled runs #1079 change
  • Ruff, Ruff format, Black, and targeted mypy validation pass

Note

Medium Risk
Changes core task QA verdict semantics and many enqueue/cancel/retry paths plus a new DB constraint; behavior is well covered by tests but mistakes could affect dashboard verdict visibility and merge gates.

Overview
Introduces oddish.core.verdict_state as the sole writer for tasks.verdict* columns. Replacement QA now uses queue_verdict / start_verdict so the last published payload stays visible while status is QUEUED/RUNNING; abandon, cancel, and no-op paths restore SUCCESS on that payload instead of clearing it. Terminal QA failure remains the only path that drops a superseded result (fail_verdict). Call sites across QA backfill/rerun, trial retry, append reconciliation, quota cancellation, queue advancement, cleanup, and QA handlers stop calling ad-hoc clears (clear_inflight_verdict, full _reset_task_verdict on backfill).

Adds migration verdict_state_001 and model check ck_tasks_published_verdict_status: a non-null verdict must not pair with missing or FAILED status, with a data repair pass before validation.

PR preview workflow: require-working-preview uses !cancelled() instead of always() so superseded cancel-in-progress runs do not publish a failing check for a commit whose newer run is still building.

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

@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
oddish-app Ready Ready Preview Aug 10, 2026 10:09pm

@kyle-compute kyle-compute changed the title fix(qa): centralize published verdict transitions fix: preserve verdict state and skip cancelled preview gates Aug 10, 2026
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Oddish preview

Commit: 3e2dea0843a5d7288dbbf37848fc05f0b41223ab

Surface Link Target
Frontend https://pr-1139.oddish.app Vercel preview for 3e2dea0
Backend oddish-pr-1139 oddish-pr-1139
Database project ujauvqwjfcsqjygyyauo project ujauvqwjfcsqjygyyauo

Vercel deployment URL: https://oddish-cl833trc7.oddish.app

Plan:

  • Frontend deploy: true
  • Backend deploy: true
  • Migrations: true

This comment is updated by the PR Preview workflow.

@cursor cursor Bot 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.

Risk: medium. Approved — Cursor Bugbot completed with no findings requiring human review; Cursor Security Agent was not present. No reviewers assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

@kyle-compute
kyle-compute merged commit 7f06406 into staging Aug 10, 2026
20 checks passed
@kyle-compute
kyle-compute deleted the fix/verdict-state-machine branch August 10, 2026 22:11
Sign up for free to 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