Quality Digital Worker Refactoring · ARAS Direct Connection Verification Report
Verification Date: 2026-08-01
Scope: 7 Quality Digital Workers (NCR / CAPA / AUDIT / QCC / SPC / STAT / FMEA) directly connected to real SCSAI/ARAS 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 workers have been switched from 'reading local quality_* shadow tables' to directly connecting to real SCSAI ItemTypes, aligning with the PPS template.
(Using the sendAML + _val pattern from server/services/pps-sync-service.js). Writes uniformly use the domain-agnostic
CapabilityRuntime.create (create class first if it doesn't exist + business object duplicate check), i.e., the 'Create' capability among the system's '6 Core Capabilities'.
| Worker | 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 NCR/CAPA/Audit/Characteristic | SCSAI Real-time Aggregation |
| FMEA | DFMEA / PFMEA (QP_Module) | SCSAI DFMEA / PFMEA (QP_Module) |
Shared helper: server/core/aras-quality-query.js (_val/_int/_float/isStale/isOverdue/queryItems/createItem).
II. End-to-End Real Verification Results
Scripts: scripts/debug/_verify_quality_aras_e2e.cjs (orchestration) + _verify_quality_worker_child.cjs (independent child process per employee, avoiding local SQLite cascading).
Read Path (Direct ARAS connection, real counts)
| Employee | Real Count | Remarks |
|---|---|---|
| NCR | total=3 (Originated×3) | Real data |
| CAPA | total=3 (In Review×3) | Confirms CAPA is modeled by Deviation/QMS, must use keyed_name not name |
| AUDIT | total=1 (Planned×1) | Real Data |
| QCC | monitored_cards=1 | 1 real quality control card already exists in SCSAI |
| SPC | total=15 Characteristic | 15 items all lack target/tolerance specifications (reflects actual state) |
| 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),
Original helper misread res.id → Could not retrieve created id, cleanup not triggered, SCSAI left with residual test objects.
Fixed the createItem extraction logic in aras-quality-query.js.
- QCC creates orphan objects: The original logic created inspection items even after the QC card creation failed, leaving dangling EXAMINE_ITEMs.
Changed to 'stop on card failure and return the error truthfully', eliminating dirty data.
- Verification script stdout pollution: The loaded rule-engine / sync-aras-meta wrote logs to stdout,
causing JSON parsing to fail. The orchestrator was changed to take the last parsable JSON line.
- Cleaned up orphan test objects generated during verification (2 EXAMINE_ITEMs and leftover TEST/E2E/DBG scans). SCSAI now has no dirty data.
IV. Known Constraints (Not Code Defects)
- QCC's CASC211_JG_Q_CONTROL_CARD is an MES domain object; SCSAI has field/relationship constraints on it.
Creation with minimal fields 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 now reports errors honestly and does not fake success. To seed a real QC 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 the local table pattern. This is a separate TODO item, not within the scope of these 7 employees.
V. Execution Method
```bash
node scripts/debug/_verify_quality_aras_e2e.cjs
`
Requires SCSAI accessibility (ylxt.chat/scplm, database SCPLM). Each employee runs in an independent Node subprocess.
BossAgents