feat(jobs+shopfloor): live-step priority chain + done-job filter

Fix the Shop Floor plant kanban so cards land in the right column:
- fp.job._compute_active_step_id walks priority chain
  (in_progress > paused > ready > pending), not just in_progress
- fp.job._compute_card_state edge case respects job.state='done'
  (no more bogus 'contract_review' label on done jobs)
- fp.job.step._compute_area_kind reads kind.area_kind directly;
  legacy _STEP_KIND_TO_AREA dict removed (50+ lines deleted)
- /fp/landing/plant_kanban filters out done/cancelled jobs from
  the live board

Migration 19.0.10.25.0 backfills template metadata (codes,
descriptions, icons, kind_id) on 30 unfinished library templates
and repoints recipe nodes for 6 unambiguous name patterns
(Blasting -> blast, Ready For X -> gating, De-Masking -> demask,
Scheduling -> gating, Nickel Strip -> wet_process,
Pre-Meas/Check Sulfamate -> inspect).

Battle test bt_s24_between_steps.py covers between-step routing,
paused step lifecycle, and done-job board filter.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-24 17:06:53 -04:00
parent 7b90f210b9
commit b06d28e7f6
7 changed files with 346 additions and 75 deletions

View File

@@ -65,9 +65,13 @@ class PlantKanbanController(http.Controller):
else env['fp.work.centre'])
paired_area = paired.area_kind if paired else None
# Base domain — every job with active recipe steps
# Base domain — only in-flight jobs.
# 2026-05-24 (spec 2026-05-24-shopfloor-live-step-fix-design.md
# Defect 4 / Change 3): done + cancelled jobs drop off the live
# board. They stay reachable via smart buttons, the Plating Jobs
# backend list, and history reports.
domain = [
('state', 'in', ('confirmed', 'in_progress', 'done')),
('state', 'in', ('confirmed', 'in_progress')),
]
filters = filters or {}
if filters.get('overdue'):
@@ -161,12 +165,19 @@ def fields_today_ts():
def _resolve_card_area(job):
"""Pick the column a card lives in.
Active-step area_kind wins. When there's no active step the card
lives in Receiving (covers contract_review + no_parts edge cases).
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.
See spec 2026-05-24-shopfloor-live-step-fix-design.md Change 4.
"""
if job.active_step_id and job.active_step_id.area_kind:
return job.active_step_id.area_kind
# Fallback: receiving column
# Orphan fallback represents a data integrity issue, not a
# normal state. Cards here have NO steps assigned at all.
return 'receiving'