feat(api): .kc item dependencies + resolve API (Phase 3) #143

Closed
opened 2026-02-18 20:58:52 +00:00 by forbes · 0 comments
Owner

Implement CAD-extracted dependency indexing and resolution endpoints as specified in KC_SERVER.md Sections 3.2 and 4.2.

Depends on: #141 (Phase 1 -- commit extraction populates item_dependencies)
Supports: SILO_VIEWPORT Phase 5 (Dependency Table widget)

Commit-time Extraction

Extend the Phase 1 extraction pipeline to also parse silo/dependencies.json and upsert rows into item_dependencies. Each commit replaces all dependency rows for that revision.

API Endpoints (Section 4.2)

Method Path Auth Description
GET /api/items/{pn}/dependencies viewer Raw dependency list from last .kc commit
GET /api/items/{pn}/dependencies/resolve viewer Resolve UUIDs to current part numbers + file availability

The /resolve endpoint joins item_dependencies against items to map child_uuid -> part_number, checks file existence on disk, and returns a resolved: bool + file_available: bool for each link. This is the data source for the Dependency Table widget's status column.

Relationship to existing BOM

The item_dependencies table is the CAD-authoritative record. The existing relationships table is the server-authoritative BOM (editable via web UI/API). BOM merge (per BOM_MERGE.md) reconciles the two. This issue does NOT implement BOM merge -- just the indexing and query endpoints.

Implementation scope

  • Extend internal/kc/extract.go to parse dependencies.json
  • internal/db/item_dependencies.go -- repository (replace-on-commit, list, resolve with JOIN)
  • internal/api/dependency_handlers.go -- HTTP handlers
  • Register routes in routes.go

Acceptance criteria

  • Committing a .kc with silo/dependencies.json populates item_dependencies
  • GET /dependencies returns the raw list
  • GET /dependencies/resolve returns part numbers, resolved status, and file availability
  • Unresolvable UUIDs return resolved: false, part_number: null
Implement CAD-extracted dependency indexing and resolution endpoints as specified in [KC_SERVER.md](docs/KC_SERVER.md) Sections 3.2 and 4.2. **Depends on:** #141 (Phase 1 -- commit extraction populates item_dependencies) **Supports:** SILO_VIEWPORT Phase 5 (Dependency Table widget) ## Commit-time Extraction Extend the Phase 1 extraction pipeline to also parse `silo/dependencies.json` and upsert rows into `item_dependencies`. Each commit replaces all dependency rows for that revision. ## API Endpoints (Section 4.2) | Method | Path | Auth | Description | |--------|------|------|-------------| | `GET` | `/api/items/{pn}/dependencies` | viewer | Raw dependency list from last .kc commit | | `GET` | `/api/items/{pn}/dependencies/resolve` | viewer | Resolve UUIDs to current part numbers + file availability | The `/resolve` endpoint joins item_dependencies against items to map child_uuid -> part_number, checks file existence on disk, and returns a `resolved: bool` + `file_available: bool` for each link. This is the data source for the Dependency Table widget's status column. ## Relationship to existing BOM The `item_dependencies` table is the **CAD-authoritative** record. The existing `relationships` table is the **server-authoritative** BOM (editable via web UI/API). BOM merge (per BOM_MERGE.md) reconciles the two. This issue does NOT implement BOM merge -- just the indexing and query endpoints. ## Implementation scope - Extend `internal/kc/extract.go` to parse dependencies.json - `internal/db/item_dependencies.go` -- repository (replace-on-commit, list, resolve with JOIN) - `internal/api/dependency_handlers.go` -- HTTP handlers - Register routes in routes.go ## Acceptance criteria - Committing a .kc with silo/dependencies.json populates item_dependencies - GET /dependencies returns the raw list - GET /dependencies/resolve returns part numbers, resolved status, and file availability - Unresolvable UUIDs return resolved: false, part_number: null
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/silo#143