Files
tiny-forge/plans/observability-proxy-mgmt/CONTEXT.md
T
alexei.dolgolyov c38b7d4c78 feat(observability): phase 1 - schema, models & event log backend
Add database foundation for observability features:
- event_log table with severity/source filtering and pagination
- standalone_proxies table for user-created reverse proxies
- stale_threshold_days setting (default 7 days)
- Auto-persist warn/error events from event bus to database
- SSE broadcast of persistent events for real-time UI updates
- Frontend types and API functions for downstream UI phases
2026-03-30 10:59:13 +03:00

53 lines
1.9 KiB
Markdown

# Feature Context: Observability & Proxy Management
## Configuration
- **Development mode:** Automated
- **Execution mode:** Orchestrator
- **Strategy:** Incremental
- **Build (full):** `make build`
- **Build (frontend):** `cd web && npm install && npm run build`
- **Build (backend):** `go build -o docker-watcher ./cmd/server`
- **Test:** `go test ./...`
- **Lint (backend):** `go vet ./...`
- **Lint (frontend):** `cd web && npm run check`
- **Dev server:** `make dev` (port: 8080)
## Current State
Feature branch just created. No implementation yet. Codebase is fully working on main.
## Temporary Workarounds
(none yet)
## Cross-Phase Dependencies
- Phases 2 & 3 depend on Phase 1 (schema, event_log table, store methods)
- Phases 4, 5, 6, 7 depend on their respective backend phases (1-3) for API endpoints
- Phase 8 depends on Phases 1-3 for backend infrastructure and event system
## Deferred Work
(none yet)
## Failed Approaches
(none yet)
## Review Findings Log
(none yet)
## Phase Execution Log
| Phase | Agent Used | Test Writer | Parallel | Notes |
|-------|-----------|-------------|----------|-------|
| (none yet) | | | | |
## Environment & Runtime Notes
- Build is currently blocked on Go 1.25 transitive dep from Docker SDK — may need to use Go 1.24 toolchain
- SQLite has MaxOpenConns=1, so all DB operations are serialized
- Frontend is embedded into Go binary via embed.FS
## Implementation Notes
- Event bus (`internal/events/bus.go`) uses buffered channels (64 cap), non-blocking publish
- NPM client (`internal/npm/client.go`) handles JWT auth with auto-refresh
- Store uses additive migrations — new `ALTER TABLE` statements are appended to runMigrations(), errors ignored for idempotency
- New tables use `CREATE TABLE IF NOT EXISTS` in the schema constant
- All API responses use envelope pattern: `{success: bool, data?: T, error?: string}`
- Frontend types in `web/src/lib/types.ts` mirror Go models
- API functions centralized in `web/src/lib/api.ts`