feat(jobs+shopfloor): recipe cleanup migration + no_parts column fix

Migration 19.0.10.26.0/post-migrate.py runs in 5 phases:
1. Resequence recipe 3620 ENP-ALUM-BASIC ops to fix the duplicate-
   sequence bug (Contract Review=10, Incoming Inspection=20,
   Masking=30, Racking=40, then the rest). Also delete the empty
   duplicate ENP-Alum Line sub_process (id 4056).
2. Backfill kind on all kind=other nodes via the extended resolver
   from fusion_plating 19.0.21.3.0
3. Delete all per-part clone recipes (name contains em-dash)
4. Recompute fp.job.step.area_kind on all steps
5. Recompute fp.job.active_step_id + card_state on in-flight jobs

Plant kanban: no_parts cards now always land in the Receiving column
regardless of active_step area_kind. The receiver works Receiving;
that's where the card belongs when parts haven't arrived.

Spec: docs/superpowers/specs/2026-05-24-recipe-cleanup-design.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-24 17:59:33 -04:00
parent 271a995455
commit 9a2975b154
4 changed files with 225 additions and 9 deletions

View File

@@ -165,15 +165,22 @@ def fields_today_ts():
def _resolve_card_area(job):
"""Pick the column a card lives in.
Active-step area_kind wins. With the live-step priority chain
(see fp.job._compute_active_step_id), active_step_id is False only
when the job has NO steps at all (recipe not assigned) OR every
step is `done`. Done jobs are filtered off the board upstream
(state-domain in plant_kanban), so this fallback fires only for
truly orphaned cards.
Active-step area_kind wins, EXCEPT for no_parts cards which always
land in Receiving regardless of active step — the receiver is who
needs to act, and they work the Receiving column. With the
live-step priority chain (see fp.job._compute_active_step_id),
active_step_id is False only when the job has NO steps at all
(recipe not assigned) OR every step is `done`. Done jobs are
filtered off the board upstream (state-domain in plant_kanban),
so the orphan fallback fires only for truly orphaned cards.
See spec 2026-05-24-shopfloor-live-step-fix-design.md Change 4.
See specs 2026-05-24-shopfloor-live-step-fix-design.md Change 4
and 2026-05-24-recipe-cleanup-design.md Change 6.
"""
# no_parts cards belong in Receiving regardless of where the
# active step is — the receiver is who acts.
if job.card_state == 'no_parts':
return 'receiving'
if job.active_step_id and job.active_step_id.area_kind:
return job.active_step_id.area_kind
# Orphan fallback — represents a data integrity issue, not a