feat(plating): recipe-level cert suppression Booleans

Adds five requires_* Booleans on fusion.plating.process.node
(requires_coc, requires_thickness_report, requires_nadcap_cert,
requires_mill_test, requires_customer_specific), default True.

Recipe is SUPPRESS-ONLY: when False, the recipe never produces that
cert type even if the customer/part requested it. Default True =
existing recipes keep producing the same cert set they produce today.

Surfaced on recipe-level form (node_type == 'recipe'); resolver reads
from job.recipe_id which is always a top-level recipe node.

Post-migrate backfills NULL -> TRUE on existing nodes.

Sub: docs/superpowers/specs/2026-05-27-recipe-cert-toggles-design.md
Task: T2.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-27 01:57:32 -04:00
parent 89267a9f41
commit a5063cc816
3 changed files with 92 additions and 1 deletions

View File

@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1
"""Post-migrate for 19.0.22.0.0 — Recipe-level cert suppression Booleans.
Backfills NULL -> TRUE on the five new requires_* columns on
fusion.plating.process.node (requires_coc, requires_thickness_report,
requires_nadcap_cert, requires_mill_test, requires_customer_specific).
Default TRUE = inherit current behaviour for every existing recipe
(zero migration surprises — every existing recipe keeps producing
the same cert set it produces today).
Idempotent: safe to re-run.
Spec: docs/superpowers/specs/2026-05-27-recipe-cert-toggles-design.md
"""
import logging
_logger = logging.getLogger(__name__)
def migrate(cr, version):
if not version:
return
_logger.info(
'19.0.22.0.0 post-migrate: backfilling recipe cert-suppression '
'requires_* Booleans to TRUE on fusion.plating.process.node rows'
)
for col in (
'requires_coc',
'requires_thickness_report',
'requires_nadcap_cert',
'requires_mill_test',
'requires_customer_specific',
):
cr.execute(
"UPDATE fusion_plating_process_node SET %s = TRUE "
"WHERE %s IS NULL" % (col, col)
)
_logger.info(' %s: %d rows updated', col, cr.rowcount)