Quality Digital Employee Refactoring · SCSAI Direct Connection Verification Report
Verification Date: 2026-08-01
Scope: 7 Quality Digital Employees (NCR / CAPA / AUDIT / QCC / SPC / STAT / FMEA) directly connected to SCSAI/SCSAI real ItemTypes
Conclusion: Read path 7/7 hit real data; write path unified creation capability closed-loop verification passed; no dirty data residue in SCSAI
I. Refactoring Key Points
All 7 quality employees have been refactored from 'reading local quality_* shadow tables' to directly connecting to SCSAI real ItemTypes, aligning with the PPS template
(sendAML + _val pattern in server/services/pps-sync-service.js). Writes uniformly use the domain-agnostic
CapabilityRuntime.create (create class first if it does not exist + business object duplicate check), which is the 'Create' capability among the system's '6 Core Capabilities'.
| Employee | Directly Connected ItemType | Data Source Annotation |
|------|---------------|-----------|
| NCR | NCR (QS) | SCSAI NCR (QS) |
| CAPA | Quality Corrective Action (QS) | SCSAI Quality Corrective Action (QS) |
| AUDIT | Audit (QS) | SCSAI Audit (QS) |
| QCC | CASC211_JG_Q_CONTROL_CARD / CASC211_JG_EXAMINE_ITEM (MES) | SCSAI CASC211_* (MES) |
| SPC | Characteristic (QP_Module) | SCSAI Characteristic (QP_Module) |
| STAT | Real-time Aggregation of NCR/CAPA/Audit/Characteristic | SCSAI Real-time Aggregation |
| FMEA | DFMEA / PFMEA (QP_Module) | SCSAI DFMEA / PFMEA (QP_Module) |
Shared helper: server/core/SCSAI-quality-query.js (_val/_int/_float/isStale/isOverdue/queryItems/createItem).
II. End-to-End Real Verification Results
Scripts: scripts/debug/_verify_quality_SCSAI_e2e.cjs (orchestration) + _verify_quality_worker_child.cjs (independent child process per employee, avoiding local SQLite cascading).
Read Path (Directly connecting to SCSAI, real counts)
| Employee | Real Count | Remarks |
|---|---|---|
| NCR | total=3 (Originated×3) | Real data |
| CAPA | total=3 (In Review×3) | CAPA is modeled from Deviation/QMS, must use keyed_name instead of name |
| AUDIT | total=1 (Planned×1) | Real data |
| QCC | monitored_cards=1 | There is already 1 real quality control card in SCSAI |
| SPC | total=15 Characteristic | 15 characteristics all lack target/tolerance specifications (reflected as-is) |
| FMEA | DFMEA=2 / PFMEA=1 | Real data |
| STAT | kpi_count=7 (6 red lights) | Real-time aggregation, zero caching |
Write path (unified CapabilityRuntime.create closed loop)
| Employee | Result | Cleanup |
|------|------|------|
| NCR | Created successfully, returns real id | Test object deleted ✅ |
| PFMEA | Created successfully, returns real id | Test object deleted ✅ |
| QCC | CASC211_JG_Q_CONTROL_CARD rejected by SCSAI (MES domain object requires valid fields/relationships) → Error reported honestly, no dangling inspection items created | No residue ✅ |
Passed 29 / Failed 0.
III. Issues Discovered and Fixed During Validation
- CapabilityRuntime.create return value field name: Actually returns item_id (top-level + result.item_id),
The original helper misread res.id → created id could not be retrieved, cleanup not triggered, SCSAI leftover test objects.
Fixed the createItem extraction logic in SCSAI-quality-query.js.
- QCC created orphan objects: original logic created inspection items even after card creation failed, leaving dangling EXAMINE_ITEMs.
Changed to 'stop on card failure and return the actual error', eliminating dirty data.
- Validation script stdout pollution: loaded rule-engine / sync-SCSAI-meta wrote logs to stdout,
causing JSON parsing to fail. Orchestrator changed to take the last parsable JSON line.
- Cleaned up orphan test objects generated during validation (2 EXAMINE_ITEMs and leftover TEST/E2E/DBG from broad scan). SCSAI now has no dirty data.
IV. Known Constraints (Non-Code Defects)
- QCC's CASC211_JG_Q_CONTROL_CARD is an MES domain object; SCSAI imposes field/relationship constraints on it.
Minimal field creation will be rejected. This aligns with the user's statement: 'CASC211 is in the MES domain, and the quality process table relationships are not properly established.'
The employee reported the error honestly, without faking success. To seed a real quality control card, valid MES fields must be provided.
- STAT has no creation actions (pure aggregation), which is by design.
- server/core/quality-process-bridge.js still uses local table syntax; this is a separate TODO, not within the scope of these 7 employees.
V. Execution Method
node scripts/debug/_verify_quality_SCSAI_e2e.cjs
需 SCSAI 可达(ylxt.chat/scplm,库 SCPLM)。每个员工在独立 Node 子进程运行。
BossAgents