- Add 30-01-SUMMARY.md with execution record and deviation docs - Update STATE.md: plan advanced to 2/2, progress 50%, decisions logged - Update ROADMAP.md: phase 30 progress updated (1/2 plans complete) - Update REQUIREMENTS.md: ONBD-01, ONBD-02, ONBD-03 marked complete
7.8 KiB
7.8 KiB
| phase | plan | subsystem | tags | requires | provides | affects | tech-stack | key-files | key-decisions | patterns-established | requirements-completed | duration | completed | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 30-hardware-detection-mode-selection | 01 | api |
|
|
|
|
|
|
|
|
|
15min | 2026-04-02 |
Phase 30 Plan 01: Hardware Detection, Nexus Settings, Model Catalog Summary
Hardware tier detection (Apple Silicon/GPU/CPU-only) via systeminformation with 3s timeout, file-backed mode persistence via Zod-validated nexus-settings service, extended model catalog with tier arrays, and unauthenticated /api/system/providers endpoint
Performance
- Duration: 15 min
- Started: 2026-04-02T23:16:00Z
- Completed: 2026-04-02T23:22:00Z
- Tasks: 2
- Files modified: 8
Accomplishments
- Hardware detection service with Apple Silicon / discrete GPU / CPU-only tiers, 3-second timeout on GPU probe, 5-minute cache
- Nexus settings service persisting mode to
data/nexus-settings.jsonwith Zod validation and graceful default - Extended model catalog with
tierarrays on all 11 variants plus new qwen3:8b family (12 variants total) getRecommendedModelupgraded with optionalhardwareTierparameter for tier-aware filtering- Unauthenticated
GET /api/system/providersendpoint mounted before boardMutationGuard - Board-auth-gated
GET/PATCH /api/nexus/settingsfor mode persistence - 13 passing unit tests covering all hardware tiers, settings CRUD, catalog validation, and tier filtering
Task Commits
- Task 1: Hardware service, nexus-settings service, model catalog, and tests -
766460a1(feat) - Task 2: Hardware and nexus-settings routes, app.ts mounting -
86e30e5c(feat)
Files Created/Modified
server/src/services/hardware.ts- hardwareService factory with Apple Silicon/GPU/cpu_only detection and cacheserver/src/services/nexus-settings.ts- nexusSettingsService with Zod validation and file persistenceserver/src/routes/hardware.ts- Unauthenticated GET /system/providers and /system/providers/recommendationserver/src/routes/nexus-settings.ts- Board-auth-gated GET/PATCH /nexus/settingsserver/src/__tests__/30-hardware-detection.test.ts- 13 unit tests using vi.hoisted() patternserver/src/services/ollama.ts- Added tier?: string[] to CatalogVariant, hardwareTier param to getRecommendedModelserver/src/data/ollama-model-catalog.json- Added tier arrays to all variants, added qwen3 familyserver/src/app.ts- Imported and mounted hardwareRoutes (before api router) and nexusSettingsRoutes (on api router)
Decisions Made
- Used
Promise.racewith a 3000ms timeout forsi.graphics()— this matches the plan spec and ensures GPU probe never blocks the server for more than 3 seconds - Apple Silicon path intentionally skips
si.graphics()entirely — unified memory means GPU VRAM concept doesn't apply - Hardware routes placed before
const api = Router()to remain outsideboardMutationGuard— this is the correct Express mounting position for unauthenticated endpoints - Used
vi.hoisted()to fix the Vitest mock hoisting issue —mockGraphicsFnmust be initialized beforevi.mock()factory runs
Deviations from Plan
Auto-fixed Issues
1. [Rule 1 - Bug] Fixed vi.mock() hoisting issue in test file
- Found during: Task 1 (TDD test implementation)
- Issue:
const mockGraphicsFn = vi.fn()declared beforevi.mock()but Vitest hoistsvi.mock()calls, causing "Cannot access 'mockGraphicsFn' before initialization" error - Fix: Used
vi.hoisted()to initializemockGraphicsFnin a hoisted context, and updated all test references to use it directly instead ofvi.mocked(si.default.graphics) - Files modified: server/src/tests/30-hardware-detection.test.ts
- Verification: All 13 tests pass
- Committed in:
766460a1(Task 1 commit)
2. [Rule 2 - Missing Critical] Added _resetHardwareCache export for test isolation
- Found during: Task 1 (TDD test implementation)
- Issue: Module-level cache in hardware.ts bleeds between tests — hardware tier tests would return stale cached values
- Fix: Exported
_resetHardwareCache()function from hardware.ts, called inbeforeEachin test file - Files modified: server/src/services/hardware.ts, server/src/tests/30-hardware-detection.test.ts
- Verification: Each test runs with fresh detection state
- Committed in:
766460a1(Task 1 commit)
Total deviations: 2 auto-fixed (1 bug, 1 missing critical) Impact on plan: Both fixes necessary for correct test behavior. No scope creep.
Issues Encountered
- Existing test suite has 18 pre-existing failures across 5 test files (skill-registry-routes, agent-permissions-routes, heartbeat-workspace-session, app-hmr-port, plugin-worker-manager) — confirmed pre-existing by stash test, not caused by this plan's changes.
User Setup Required
None - no external service configuration required.
Next Phase Readiness
- Hardware probe API ready for consumption by Plan 02 onboarding UI
- Mode persistence API ready — onboarding can set mode via PATCH /api/nexus/settings
- Model catalog with tier arrays ready — onboarding can show tier-appropriate model recommendations
GET /api/system/providers/recommendationcombines hardware detection + catalog filtering in one call
Phase: 30-hardware-detection-mode-selection Completed: 2026-04-02