- Fix SaveConfig: add cfg.Commit() so credentials actually persist to disk - Fix TestResolveConfig and TestNewFromConfig: isolate from real config file by setting HOME to temp dir, preventing env/config bleed - Add RouteTypeName, GetRoutes, and GetNetworks unit tests with httptest mocks (coverage 39% → 55%) - Update CLAUDE.md: add error handling and test isolation conventions - Update docs: fix Go version (1.25 → 1.26), remove stale replace directive references, add cmd/unifi/ to architecture diagram Co-Authored-By: Virgil <virgil@lethean.io>
994 B
994 B
CLAUDE.md
UniFi network controller API client for querying devices, clients, networks, routes, and sites.
Module: forge.lthn.ai/core/go-netops
Commands
go test ./... # run all tests
go test -race ./... # race detector (required before commit)
go test -v -run Name ./... # single test
go vet ./... # vet check
Standards
- UK English
go test -race ./...andgo vet ./...must pass before commit- Conventional commits:
type(scope): description - Co-Author:
Co-Authored-By: Virgil <virgil@lethean.io> - Errors must use
log.E()fromgo-log, neverfmt.Errorf - Config tests must isolate from real
~/.core/config.yamlviat.Setenv("HOME", t.TempDir())
Docs
docs/architecture.md— package structure, key types, design decisions, API patternsdocs/development.md— prerequisites, build/test, test patterns, coding standardsdocs/history.md— extraction origin, known limitations, future plans