summaryrefslogtreecommitdiff
path: root/internal/daemon
AgeCommit message (Collapse)Author
2026-04-14fix: shadowing, version.Tag, prealloc LoadRecords (ask 54)Paul Buetow
- CreateKey: avoid shadowing named return err on rand.Read - daemon Run: rename slog logger to slogLog vs stdlib log package - version: rename Version to Tag to avoid version.Version stutter - LoadRecords: COUNT(*) then make slice with capacity Made-with: Cursor
2026-04-14fix(r3): use errors.Is for sentinel error comparisonsPaul Buetow
Replace direct == checks with errors.Is so wrapped errors are handled correctly (authkeys Verify, daemon server/EOF, Magefile uninstall). Refs: ask r3, 100 Go Mistakes #51 Made-with: Cursor
2026-04-14daemon: NewHandler returns error instead of panicking (l3)Paul Buetow
Replace Handler with NewHandler(statsDir) (http.Handler, error) when the auth store cannot be opened, matching Run's error wrapping. Tests use a small helper; add coverage for open failure on a read-only stats dir. Made-with: Cursor
2026-04-14daemon: set http.Server timeouts for Run (k3)Paul Buetow
Configure ReadHeaderTimeout, ReadTimeout, WriteTimeout, and IdleTimeout on the daemon listener to mitigate slowloris and stuck clients. Made-with: Cursor
2026-04-14test(daemon): race-safe log buffers in Run tests (j3)Paul Buetow
Use a mutex-wrapped buffer for slog and io.Copy so polling String() does not race concurrent writes from Run and background goroutines. Made-with: Cursor
2026-04-14test: microservice coverage for task 63Paul Buetow
Add table-driven HTTP and unit tests for report (all formats, negatives), upload/auth boundaries, upload helpers, readiness, Run and logging. Extend authkeys tests for Close, CreateKey validation, and post-close errors. Add CLI tests for defaultListenFromEnv and create-client-key with -auth-db only. Add mage CoverMicroservice for local/CI-style coverage measurement. Use context.Background and os.Chdir for Go 1.21-compatible tests. Made-with: Cursor
2026-04-14daemon: add /livez and /readyz HTTP probes for KubernetesPaul Buetow
Liveness: GET /livez matches GET /health (200, process serving). Readiness: GET /readyz verifies stats-dir exists, is a directory, and is readable and writable; if -auth-db resolves outside stats-dir, that directory is checked too. Failures return 503 Service Unavailable. Refs: ask task 53 Made-with: Cursor
2026-04-14docs,test: HTTP upload API and curl auth example (ask 23)Paul Buetow
Document daemon plain-HTTP mode, PUT /upload paths for five uptimed files, Bearer token header, and env flags. Add table-driven test asserting each kind maps to the expected filename in stats-dir. Made-with: Cursor
2026-04-14task 13: upload API keys in SQLite, Bearer auth, create-client-key CLIPaul Buetow
- Add internal/authkeys with SHA-256 hashed tokens and KeyCount gate - PUT /upload/{host}/{kind} for uptimed files; auth when any key exists - Daemon -auth-db and Config.AuthDB; plain HTTP unchanged - CLI: goprecords --create-client-key HOSTNAME (-stats-dir|-auth-db) Made-with: Cursor
2026-04-14Add HTML OutputFormat and report API support (ask task 03)Paul Buetow
- Add FormatHTML with parse/string and HTMLReporter on existing report path - Emit minimal HTML document with escaped title, description, and pre table - Daemon /report sets text/html Content-Type for HTML format - Integration fixtures and tests for HTML Made-with: Cursor
2026-04-14daemon: stdout-only slog logging for HTTP (task 43)Paul Buetow
- Route http.Server ErrorLog and request access lines through slog text to stdout (or Config.LogOutput for tests). - Log daemon_listen on start and http_request per request (method, path, status, duration_ms). - CLI daemon: flag usage and missing-stats-dir message on stdout. Made-with: Cursor
2026-04-14z2: HTTP report query aliases and Gemtext Content-TypePaul Buetow
Accept Category, Metric, and OutputFormat as alternate query keys alongside category, metric, output-format. Serve Gemtext reports with text/gemini; assert Content-Type in daemon tests. Builds on y2 daemon GET /report reusing ParseReportQuery and WriteReports. Made-with: Cursor
2026-04-14Add --daemon plain HTTP server (y2)Paul Buetow
Long-lived goprecords --daemon with -stats-dir and -listen, env GOPRECORDS_STATS_DIR and GOPRECORDS_LISTEN. Serves GET /health and GET /report (query params match report flags). Uses standard http.Server; no TLS. Made-with: Cursor