Skip to content

fix: scope automatic DRC re-runs to non-terminal shuttles (#270) - #276

Open
mithro wants to merge 5 commits into
mainfrom
issue/270-drc-requeue-shuttle-scope
Open

fix: scope automatic DRC re-runs to non-terminal shuttles (#270)#276
mithro wants to merge 5 commits into
mainfrom
issue/270-drc-requeue-shuttle-scope

Conversation

@mithro

@mithro mithro commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #270. The automatic DRC re-run task (checks_drc_update_requeue, Celery beat every 60s) re-checked every design on every precheck-version bump, regardless of shuttle status — wasting Docker capacity re-running DRC on designs already in fabrication, manufactured, or on cancelled shuttles, and letting those re-runs compete for the dedicated 25%-capacity DRC-update pool.

This scopes only the automatic task to skip designs whose shuttle is production / completed / cancelled. Designs with no shuttle (drafts) and all pre-fab states (planning / open / full / locked) stay in scope.

The manual "Recheck with Latest" button is deliberately left fully usable in every shuttle state — the shared create_check_drc_update() model method is untouched, so a human can always re-check.

Changes

  • Shuttle.Status.drc_recheck_excluded() (wafer_space/shuttles/models.py) — single source of truth returning [IN_PRODUCTION, COMPLETED, CANCELLED]; mirrors the existing ManufacturabilityCheck.Status.active()/.terminal() pattern.
  • checks_drc_update_requeue (wafer_space/projects/tasks_checks.py) — one .exclude(project_file__project__shuttle__status__in=...) clause on the candidate queryset. .exclude() (not .filter(status__in=included)) is required so NULL-shuttle drafts and any future shuttle status stay in scope.
  • Tests covering the full shuttle-status boundary and a regression guard for the manual path.

Design docs

  • Spec: docs/superpowers/specs/2026-06-25-drc-requeue-shuttle-scope-design.md
  • Plan: docs/superpowers/plans/2026-06-25-drc-requeue-shuttle-scope.md

Test plan

  • test_scopes_by_shuttle_status — parametrized over all 7 shuttle states + no-shuttle draft; asserts only {no-shuttle, planning, open, full, locked} are re-queued and {production, completed, cancelled} are skipped (one candidate per run, so the throttle can't mask which design was chosen).
  • test_not_blocked_by_terminal_shuttle_statuscreate_check_drc_update() still succeeds for production/completed/cancelled designs (manual path unaffected).
  • Shuttle.Status.drc_recheck_excluded() contract test.
  • make lint clean, make type-check clean (278 files), affected suites: 283 passed; full projects + shuttles sweep: 967 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YbruzLzKewfcCUHVoyFnSq

Summary by CodeRabbit

  • Bug Fixes
    • Automatic DRC re-runs now skip designs tied to shuttles in production, completed, or cancelled states.
    • Drafts and pre-fab shuttle states are still eligible for automatic requeue.
    • Manual “Recheck with Latest” remains available and unaffected for all shuttle states.
  • Tests
    • Added contract and task tests validating DRC requeue scoping across shuttle states, plus regression coverage for the manual recheck path.
  • Documentation
    • Added an implementation plan and design spec for the shuttle-scoped DRC requeue behavior.

@mithro mithro added bug Something isn't working backend Backend/Django development labels Jun 25, 2026
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@mithro, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 41 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d86554ee-d765-46eb-803b-d560c6f96119

📥 Commits

Reviewing files that changed from the base of the PR and between aaabf73 and a03c11f.

📒 Files selected for processing (7)
  • docs/superpowers/plans/2026-06-25-drc-requeue-shuttle-scope.md
  • docs/superpowers/specs/2026-06-25-drc-requeue-shuttle-scope-design.md
  • wafer_space/projects/tasks_checks.py
  • wafer_space/projects/tests/test_models.py
  • wafer_space/projects/tests/test_tasks.py
  • wafer_space/shuttles/models.py
  • wafer_space/shuttles/tests/test_models.py

Walkthrough

Adds a shuttle-status exclusion method, applies it to automatic DRC requeue candidate selection, and adds tests covering the exclusion contract, scoped requeueing, and the manual DRC update path.

Changes

DRC requeue shuttle scope

Layer / File(s) Summary
Shuttle status exclusion contract
docs/superpowers/plans/2026-06-25-drc-requeue-shuttle-scope.md, docs/superpowers/specs/2026-06-25-drc-requeue-shuttle-scope-design.md, wafer_space/shuttles/models.py, wafer_space/shuttles/tests/test_models.py
Shuttle.Status.drc_recheck_excluded() returns IN_PRODUCTION, COMPLETED, and CANCELLED, and the new shuttle tests assert that exact excluded set.
Automatic DRC requeue filter
docs/superpowers/plans/2026-06-25-drc-requeue-shuttle-scope.md, docs/superpowers/specs/2026-06-25-drc-requeue-shuttle-scope-design.md, wafer_space/projects/tasks_checks.py, wafer_space/projects/tests/test_tasks.py
checks_drc_update_requeue() excludes checks whose shuttle status is in the new classmethod result, and the parameterized task test checks both created and skipped cases across shuttle states.
Manual DRC update regression
docs/superpowers/plans/2026-06-25-drc-requeue-shuttle-scope.md, wafer_space/projects/tests/test_models.py
create_check_drc_update() still creates a DRC_UPDATE child check for terminal shuttle states, and the added regression test covers that path.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Poem

🐇 I hopped through shuttles, neat and true,
and trimmed the DRC queue down to few.
Terminal pens stayed calm tonight,
while manual rechecks still took flight.
Crunch-crunch, the carrots taste just right.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: limiting automatic DRC re-runs to non-terminal shuttles.
Linked Issues check ✅ Passed The code and tests match issue #270 by excluding terminal shuttles from automatic requeue while leaving the manual recheck path intact.
Out of Scope Changes check ✅ Passed The added documentation files are directly related to issue #270 and its implementation, with no unrelated scope creep evident.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue/270-drc-requeue-shuttle-scope

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mithro
mithro force-pushed the issue/270-drc-requeue-shuttle-scope branch 2 times, most recently from aaabf73 to f0c57e7 Compare July 3, 2026 06:26
@mithro
mithro force-pushed the issue/270-drc-requeue-shuttle-scope branch 2 times, most recently from 0181f91 to c2bb4fc Compare July 16, 2026 10:56
mithro and others added 5 commits August 2, 2026 14:55
…#270)

Automatic DRC re-runs currently re-check every design regardless of shuttle
status. Spec restricts the automatic requeue task to skip designs whose shuttle
is in production/completed/cancelled, while keeping no-shuttle drafts and all
pre-fab states in scope. The manual "Recheck with Latest" path stays unrestricted.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YbruzLzKewfcCUHVoyFnSq
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YbruzLzKewfcCUHVoyFnSq
…270)

Single source of truth for the shuttle states (production/completed/cancelled)
that should be skipped by AUTOMATIC DRC re-runs. Mirrors the existing
ManufacturabilityCheck.Status.active()/.terminal() classmethod pattern.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YbruzLzKewfcCUHVoyFnSq
checks_drc_update_requeue now excludes designs whose shuttle is in
production/completed/cancelled via Shuttle.Status.drc_recheck_excluded().
Uses .exclude() so no-shuttle drafts (NULL status) and any future shuttle
status stay in scope. The shared create_check_drc_update() model method is
untouched, so the manual "Recheck with Latest" path is unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YbruzLzKewfcCUHVoyFnSq
Locks in the requirement that create_check_drc_update() (the shared method
behind the manual "Recheck with Latest" button) succeeds regardless of
shuttle status, so the scope filter never leaks out of the automatic task.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YbruzLzKewfcCUHVoyFnSq
@mithro
mithro force-pushed the issue/270-drc-requeue-shuttle-scope branch from c2bb4fc to a03c11f Compare August 2, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend/Django development bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New DRC version re-runs DRC on all designs in all shuttles (no open-shuttle scope)

1 participant