|
| 1 | +# Fix SOLIDWORKS Drawing Metadata Inheritance Multi-Agent Plan |
| 2 | + |
| 3 | +## Objective |
| 4 | + |
| 5 | +Resolve missing BR number/description/revision on SOLIDWORKS drawings by capturing drawing→model references, resolving PRP formulas from the referenced model, and syncing drawing metadata without overwriting drawings as the source of truth. |
| 6 | + |
| 7 | +## Agent Overview |
| 8 | + |
| 9 | +| Agent | Responsibility | Owns | Dependencies | |
| 10 | +|-------|---------------|------|--------------| |
| 11 | +| Agent 1 | TypeScript sync + references + logging | `src/lib/commands/handlers/*` | None | |
| 12 | +| Agent 2 | SolidWorks service PRP resolution | `solidworks-service/BluePLM.SolidWorksService/DocumentManagerAPI.cs` | None | |
| 13 | + |
| 14 | +## Shared Files |
| 15 | + |
| 16 | +| File | Owner | Rule | |
| 17 | +|------|-------|------| |
| 18 | +| None | — | No shared file edits expected | |
| 19 | + |
| 20 | +--- |
| 21 | + |
| 22 | +## Agent 1: TS Metadata + References |
| 23 | + |
| 24 | +### Prompt |
| 25 | + |
| 26 | +> Implement drawing metadata inheritance and reference extraction for BluePLM with enterprise-level code quality. |
| 27 | +> |
| 28 | +> **Scope:** |
| 29 | +> - Add drawing support to reference extraction in [`src/lib/commands/handlers/sync.ts`](bluePLM/src/lib/commands/handlers/sync.ts), [`src/lib/commands/handlers/checkin.ts`](bluePLM/src/lib/commands/handlers/checkin.ts), and [`src/lib/commands/handlers/extractReferences.ts`](bluePLM/src/lib/commands/handlers/extractReferences.ts) |
| 30 | +> - Update drawing metadata extraction in [`src/lib/commands/handlers/sync.ts`](bluePLM/src/lib/commands/handlers/sync.ts) to resolve PRP by reading the **first referenced model** |
| 31 | +> - Add logging for: PRP detection, parent reference chosen, missing parent, and inheritance outcome |
| 32 | +> - Ensure drawings remain source of truth (do not push DB values back into drawings) |
| 33 | +> - Document backfill path via **Sync SW Metadata** for existing drawings |
| 34 | +> |
| 35 | +> **Boundaries:** |
| 36 | +> - OWNS: `src/lib/commands/handlers/sync.ts`, `src/lib/commands/handlers/checkin.ts`, `src/lib/commands/handlers/extractReferences.ts`, `src/lib/commands/handlers/syncSwMetadata.ts` |
| 37 | +> - Do NOT modify: `solidworks-service/*`, database schema files |
| 38 | +> |
| 39 | +> **Quality Requirements:** |
| 40 | +> - Enterprise-level code quality and organization |
| 41 | +> - Proper TypeScript types (no `any`) |
| 42 | +> - Error handling and edge cases covered (missing parent, DM unavailable) |
| 43 | +> - Clean, readable, documented code |
| 44 | +> |
| 45 | +> **Deliverables:** |
| 46 | +> - Updated TS logic for drawing metadata and references |
| 47 | +> - Logs that allow debugging inheritance behavior |
| 48 | +> - Report in `AGENT1_REPORT.md` |
| 49 | +> |
| 50 | +> **When complete:** Run `npm run typecheck` and report results. |
| 51 | +
|
| 52 | +### Boundary |
| 53 | + |
| 54 | +- **OWNS (exclusive write):** `src/lib/commands/handlers/sync.ts`, `src/lib/commands/handlers/checkin.ts`, `src/lib/commands/handlers/extractReferences.ts`, `src/lib/commands/handlers/syncSwMetadata.ts` |
| 55 | +- **READS (no modify):** `solidworks-service/BluePLM.SolidWorksService/DocumentManagerAPI.cs` |
| 56 | + |
| 57 | +### Tasks |
| 58 | + |
| 59 | +- [ ] Add `.slddrw` to reference extraction paths (sync/check-in/extractReferences) |
| 60 | +- [ ] Implement drawing metadata inheritance via first referenced model |
| 61 | +- [ ] Add logging for PRP detection + parent resolution + missing parent |
| 62 | +- [ ] Ensure Sync SW Metadata updates existing drawings without pushing DB → file |
| 63 | + |
| 64 | +### Deliverables |
| 65 | + |
| 66 | +- TS changes merged with clear logging and safe fallbacks |
| 67 | + |
| 68 | +--- |
| 69 | + |
| 70 | +## Agent 2: SolidWorks Service PRP Resolution |
| 71 | + |
| 72 | +### Prompt |
| 73 | + |
| 74 | +> Implement drawing PRP resolution in the SolidWorks Document Manager service with enterprise-level code quality. |
| 75 | +> |
| 76 | +> **Scope:** |
| 77 | +> - Update [`solidworks-service/BluePLM.SolidWorksService/DocumentManagerAPI.cs`](bluePLM/solidworks-service/BluePLM.SolidWorksService/DocumentManagerAPI.cs) to call `ReadDrawingReferencedModelProperties` when drawing properties are empty or PRP references are detected |
| 78 | +> - Use the **first referenced model** for deterministic inheritance |
| 79 | +> - Add concise diagnostic logging for the resolution path and missing parent |
| 80 | +> |
| 81 | +> **Boundaries:** |
| 82 | +> - OWNS: `solidworks-service/BluePLM.SolidWorksService/DocumentManagerAPI.cs` |
| 83 | +> - Do NOT modify: any TypeScript files |
| 84 | +> |
| 85 | +> **Quality Requirements:** |
| 86 | +> - Enterprise-level code quality and organization |
| 87 | +> - Error handling and edge cases covered |
| 88 | +> - Clean, readable, documented code |
| 89 | +> |
| 90 | +> **Deliverables:** |
| 91 | +> - Updated C# service with drawing PRP resolution |
| 92 | +> - Report in `AGENT2_REPORT.md` |
| 93 | +
|
| 94 | +### Boundary |
| 95 | + |
| 96 | +- **OWNS (exclusive write):** `solidworks-service/BluePLM.SolidWorksService/DocumentManagerAPI.cs` |
| 97 | +- **READS (no modify):** `src/lib/commands/handlers/*` |
| 98 | + |
| 99 | +### Tasks |
| 100 | + |
| 101 | +- [ ] Detect PRP refs or empty drawing properties in `GetCustomProperties` |
| 102 | +- [ ] Resolve via `ReadDrawingReferencedModelProperties` using first reference |
| 103 | +- [ ] Log resolution path and missing parent scenarios |
| 104 | + |
| 105 | +### Deliverables |
| 106 | + |
| 107 | +- C# service enhancement for drawing property resolution |
| 108 | + |
| 109 | +--- |
| 110 | + |
| 111 | +## Verification Checklist (Cross-Agent) |
| 112 | + |
| 113 | +- [ ] Create new part, assign BR number, description, revision |
| 114 | +- [ ] Check in part |
| 115 | +- [ ] Create drawing from part in SOLIDWORKS |
| 116 | +- [ ] Sync drawing to bluePLM |
| 117 | +- [ ] Verify drawing shows BR number, description, revision in file browser |
| 118 | +- [ ] Verify drawing shows metadata in details panel |
| 119 | +- [ ] Check `file_references` table has drawing→part relationship |
| 120 | +- [ ] Run Sync SW Metadata on an existing drawing and confirm DB updates |
| 121 | +- [ ] Test missing parent model (drawing references unsynced file) and confirm logs + no overwrite |
0 commit comments