Commit graph

46 commits

Author SHA1 Message Date
206d6886aa docs(03): mark phase 3 plans autonomous for overnight execution 2026-04-10 06:12:46 +00:00
1a9931f900 docs(03): create phase 3 plans — dashboard, intake UI, PWA (5 plans, 2 waves)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 06:12:02 +00:00
22c504247d docs(03): auto-generated context (frontend phase) 2026-04-10 06:01:54 +00:00
7b322653e7 docs(phase-2): complete phase execution 2026-04-10 06:01:10 +00:00
dcb388c7ea docs(02): phase 2 verification + human UAT 2026-04-10 06:01:06 +00:00
16cfc48644 docs(02-03): complete intake handler plan summary 2026-04-10 05:56:50 +00:00
59aa89b199 feat(02-03): wire POST /api/intake route, real WAQ handler, and NetBox defaults in config
- router.go: NewRouter accepts intakeHandler http.Handler, registers POST /api/intake
- config.go: adds NetBoxDefaultDeviceTypeID/RoleID/SiteID fields with defaults and env bindings
- main.go: creates netbox.Client, ai.Orchestrator, inventory.CatalogUpdater, handlers.IntakeHandler
- main.go: replaces NoOpHandler with NewNetBoxOpHandler(nbClient) for WAQ worker
- main.go: uses typed interface variable for WAQ to avoid nil-interface-wrapping bug
2026-04-10 05:55:41 +00:00
4fc9362519 feat(02-03): POST /api/intake handler with orchestrator and NetBox wiring
- IntakeHandler with IntakeOrchestrator/IntakeNetBoxClient/IntakeCatalogUpdater/IntakeWAQ interfaces
- Validates 1-3 photos, base64-encodes, calls Analyze, allocates HW-ID
- Quick-add mode: confidence >= threshold skips review, creates NetBox record immediately
- WAQ enqueue on NetBox failure returns 202 with queued=true
- nil WAQ + NetBox down returns 503
- Six unit tests: reject-0, reject-4, high-confidence, low-confidence, quick-add, netbox-down
- [Rule 1 - Bug] PatchCustomFields signature changed int -> int64 to match NetBoxOpsClient interface
- [Rule 1 - Bug] UpdateCatalogStatus signature changed int -> int64 for consistency with CreateDevice return type
2026-04-10 05:54:33 +00:00
e3a5fef306 docs(02-02): complete orchestrator, WAQ handler, research stub plan
- SUMMARY.md: 5 orchestrator tests, 6 handler tests all passing
- Commits: 799acd2 (orchestrator + research stub), 73eab56 (WAQ handler)
- All STRIDE threats T-02-05 through T-02-08 mitigated
2026-04-10 05:50:01 +00:00
73eab561cf feat(02-02): WAQ real NetBox op handler replacing NoOpHandler
- NewNetBoxOpHandler routes create_device → CreateDevice, patch_custom_fields → PatchCustomFields
- NetBoxOpsClient interface enables test injection without importing netbox package
- Unknown op types return error (re-queued by worker, not silently dropped — T-02-08)
- JSON payloads decoded into typed structs (T-02-07 tampering mitigation)
- 6 handler tests all passing (TDD green); NoOpHandler untouched in worker.go
2026-04-10 05:48:30 +00:00
799acd26ef feat(02-02): three-tier orchestrator with confidence routing and research stub
- Orchestrator.Analyze: tier1 → confidence check → tier2 escalation if < threshold
- CatalogStatus mapped from confidence: >= threshold → StatusIndexed, else StatusNeedsResearch
- Both tiers fail gracefully: returns zero-value IntakeResult + StatusNeedsResearch, err nil
- ResearchClient interface + NoOpResearchClient stub for Phase 7 SearXNG
- 5 TestOrchestrator* tests all passing (TDD green)
2026-04-10 05:47:41 +00:00
3eed2e9c63 docs(02-01): complete AI package foundation plan
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 05:46:05 +00:00
8c03780230 feat(02-01): AI package foundation — types, interface, mock, prompts, config extension
- internal/ai/types.go: IntakeRequest, IntakeResult, TierConfig, AIConfig domain types
- internal/ai/client.go: AIClient interface + TierClient (go-openai, BaseURL tier-routing)
- internal/ai/mock.go: MockAIClient test double with HighConfidenceResult/LowConfidenceResult fixtures
- internal/ai/prompts/intake.go: BuildIntakePrompt() JSON-extraction prompt template
- internal/config/config.go: Config.AI AIConfig field, tier defaults, env bindings, ai_config.json merge
- ai_config.json: template config with placeholder Tier2 API key
- .gitignore: add ai_config.local.json pattern for real keys (T-02-01 mitigation)
- All tests pass: TestMockAIClient, TestMockAIClientError, TestTierClientConstruction, TestAIConfigDefaults
2026-04-10 05:45:13 +00:00
6040ecc3cc feat(02-01): install go-openai and add CreateDevice to NetBox client
- go get github.com/sashabaranov/go-openai v1.41.2
- Add CreateDevice(ctx, name, assetTag, deviceTypeID, roleID, siteID) → (int64, error)
- Add DeleteDevice(ctx, id) for test cleanup
- Use Int32As* oneOf helpers for go-netbox v4 FK fields
- TestCreateDeviceValidation PASS; TestCreateDeviceLive SKIP (no live token)
2026-04-10 05:42:51 +00:00
7bebe2ed93 docs(02): create phase 2 AI pipeline plans (4 plans, 4 waves)
Wave 1: go-openai dep, CreateDevice gap, AIClient interface + mock + config
Wave 2: three-tier orchestrator, WAQ real handler, SearXNG stub
Wave 3: POST /api/intake handler, router wiring, quick add mode
Wave 4: oMLX integration test + memory checkpoint

Covers requirements: AI-01 through AI-09 (AI-04 stub only; full impl Phase 7)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 05:40:22 +00:00
6460b27bfc docs(02): research AI pipeline phase — go-openai vision, mock interface, orchestrator patterns 2026-04-10 05:32:17 +00:00
5313dfb501 docs(02): auto-generated context (autonomous mode) 2026-04-10 05:28:22 +00:00
8d8026c110 docs(phase-1): complete phase execution 2026-04-10 05:27:36 +00:00
b4fc5c5f08 test(01): persist human verification items as UAT 2026-04-10 05:27:29 +00:00
28e2f5a879 Merge branch 'worktree-agent-a86e8ac9' 2026-04-10 05:23:48 +00:00
1707496027 docs(01-04): complete HW-ID, quality gate, tag sync plan
- SUMMARY.md: 8 files created, 16 unit tests pass, 3 integration skipped
- normalizeTags deviation documented (slug dedup fix)
- T-04-01/T-04-02 mitigations confirmed in catalog_updater and tags
2026-04-10 05:23:13 +00:00
8f902edcd7 docs(01-05): complete DragonFlyDB write-ahead queue plan summary
- Integration tests ran and passed against DragonFlyDB at 10.5.0.10:6379
- Documents custom URL parser deviation for slash-in-password fix
- Notes NoOpHandler stub for Phase 2 replacement
2026-04-10 05:22:54 +00:00
52e3e9cd9c docs(01-03): complete NetBox provisioning plan summary 2026-04-10 05:22:44 +00:00
1f9621fcaa feat(01-04): quality gate state machine, tag sync, catalog updater
- CatalogStatus type with forward-only state machine (draft→indexed→…→complete)
- Transition() enforces valid transitions, returns error with 'invalid transition' message
- ParseCatalogStatus() validates known status strings
- HardwareRecord domain type composing netbox.Device with quality gate state
- CatalogUpdater.UpdateCatalogStatus() validates transition then PatchCustomFields
- SyncTags() normalizes tags (slug form) and ensures they exist in NetBox
- normalizeTags deduplicates across case/whitespace/space-vs-hyphen variants
- ensureTag uses go-netbox v4 NewTagRequest(name, slug) / ExtrasTagsCreate
- All 12 state machine table-driven tests pass
2026-04-10 05:22:22 +00:00
d1192c3380 feat(01-05): WAQ retry worker and graceful shutdown wiring
- Add RunWorker: BLPOP loop with context cancellation and retryInterval backoff
- Add NoOpHandler: Phase 1 placeholder that drains ops with a log line
- Drop ops after maxAttempts with warning log (T-05-03 mitigation)
- Update main.go: non-fatal WAQ init, graceful HTTP shutdown on SIGINT/SIGTERM
2026-04-10 05:22:10 +00:00
49a729a1a6 feat(01-03): add location hierarchy provisioning and provision CLI script
- ProvisionLocationHierarchy: idempotent Site/Location/Rack creation
- ensureSite/ensureLocation/ensureRack using go-netbox v4 typed requests
- CheckNetBoxInventoryPlugin via /api/plugins/ endpoint
- scripts/provision-netbox.go CLI with go:build ignore tag
2026-04-10 05:22:02 +00:00
e07ad922eb feat(01-05): write-ahead queue core (Enqueue, Dequeue, Len)
- Add PendingOp struct with UUID, type, payload, created_at, attempts
- Add WAQ type backed by DragonFlyDB via go-redis v9
- Implement Enqueue (RPUSH), Dequeue (BLPOP), Len (LLEN)
- Custom URL parser handles passwords with forward slashes
- Unit tests pass; integration test passes against DragonFlyDB at 10.5.0.10:6379
2026-04-10 05:21:28 +00:00
9b4cc9a661 feat(01-03): implement custom field provisioning with go-netbox v4
- Define hwlabCustomFields slice with all 8 HWLab custom field specs
- Implement ProvisionCustomFields with idempotent check-before-create
- Implement createCustomField using WritableCustomFieldRequest
- Implement customFieldSpec lookup for testing
2026-04-10 05:21:23 +00:00
e1cee31620 feat(01-04): HW-XXXXX sequential ID allocation
- formatHWID/parseHWID with HW-NNNNN regex validation
- AllocateNextHWID with optimistic-lock retry (3 attempts)
- getHighestHWIDNumber scans all devices for highest existing asset_tag
- hwIDExists checks specific asset_tag via DcimDevicesList filter
- Unit tests for format/parse covering valid and invalid cases
2026-04-10 05:20:41 +00:00
07130d2ceb test(01-03): add failing tests for custom field spec and provisioning 2026-04-10 05:20:37 +00:00
f15c0c7ea7 docs(01-02): complete NetBox client plan summary
- SUMMARY.md for plan 01-02 with go-netbox v4 API notes and deviation log
2026-04-10 05:18:13 +00:00
17a2eb6f9f feat(01-02): custom field read/write wrappers (NB-02)
- Add ParseCustomFields: safe type-assertion mapping from map[string]interface{}
- Add BuildCustomFieldsPatch: selective flat patch map (avoids clearing unset fields)
- Add BuildFullCustomFieldsPatch: full custom fields patch for initial record creation
- Add PatchCustomFields method on Client using PatchedWritableDeviceWithConfigContextRequest
- Add custom_fields_test.go with 5 unit tests and 1 skippable integration round-trip test
2026-04-10 05:17:11 +00:00
9f3ed9fddc feat(01-02): NetBox client wrapper with device CRUD (NB-01)
- Add internal/netbox/types.go with Device and CustomFields domain types
- Add internal/netbox/client.go with NewClient, Ping, ListDevices, GetDevice
- Add client_test.go with validation unit tests and skippable integration tests
- go-netbox v4.3.0 dependency added
2026-04-10 05:16:17 +00:00
6595e345a2 feat(01-foundation-01): viper config loader and SPA fallback fix
- Add internal/config/config.go with viper-backed Config struct
- Explicit BindEnv calls for reliable env var -> config mapping (mapstructure v2 compat)
- Config loads from config.json + .env, env vars take precedence
- Add config.json with non-secret defaults (port, timeouts, URLs)
- Fix SPA fallback: spaHandler serves index.html for unknown paths (client-side routing)
- All 5 tests pass: TestHealth, TestLoadDefaults, TestLoadEnvOverride, TestLoadNetBoxURL
- Add Makefile with build/dev/test/clean targets
2026-04-10 01:27:54 +00:00
77e5a78d5a feat(01-foundation-01): Go module init, chi server, go:embed SPA scaffold
- Initialize module git.georgsen.dk/hwlab with Go 1.23
- Install chi v5.2.5, go-redis v9.18.0, viper v1.21.0, godotenv v1.5.1, uuid v1.6.0, go-netbox v4.3.0
- Create health handler GET /api/health returning {status:ok, version:0.1.0}
- Create chi router with Logger/Recoverer/RealIP middleware and SPA fallback
- Embed web/dist via assets.go at module root (go:embed cannot use .. paths)
- Create stub web/dist/index.html with ClickHouse dark theme
- TestHealth passes
2026-04-10 01:17:03 +00:00
b1e4db0b6d docs(01): fix plan checker blockers (research resolution, catalog updater) 2026-04-10 01:11:41 +00:00
c9ad50fdf2 docs(01-foundation): create phase 1 plans (5 plans, 2 waves)
Plans 01-02 are Wave 1 (parallel). Plans 03-04-05 are Wave 2.
All 11 requirements covered: INF-01, INF-02, INF-03, NB-01 through NB-07.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 01:07:55 +00:00
73eec3ee76 docs(phase-1): add validation strategy 2026-04-10 00:58:10 +00:00
104663dd19 docs(phase-1): research foundation phase — Go scaffold, NetBox, DragonFlyDB WAQ
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 00:57:19 +00:00
477624dcd3 docs(01): auto-generated context (infrastructure phase) 2026-04-10 00:49:04 +00:00
56d3b4da12 chore: add environment config 2026-04-10 00:48:19 +00:00
1a51cbc323 docs: create roadmap (7 phases) 2026-04-10 00:04:27 +00:00
f7e5e72686 docs: define v1 requirements 2026-04-10 00:01:35 +00:00
5d7c5e90a2 docs: complete project research 2026-04-09 23:35:26 +00:00
1374c3bc3b chore: add project config 2026-04-09 22:40:53 +00:00
ff93f4f744 docs: initialize project 2026-04-09 22:35:48 +00:00