| Age | Commit message (Collapse) | Author |
|
without full Kernel tables.
- Link foo.zone stylesheet and mirror header/heading/quote layout for HTML reports.
- Default -all stats order matches foo.zone (Host Uptime through Score, then KernelMajor and KernelName; full Kernel last when include-kernel).
- Daemon root HTML uses include-kernel=false like the public stats page.
- Refresh HTML integration fixtures.
Made-with: Cursor
|
|
Serve aggregated uptime stats as HTML on GET /. Cache rendered output for 10 minutes. Bump version to 0.3.1.
Made-with: Cursor
|
|
Document the full HTTP API surface, bump the version for the new daemon/upload/report capabilities, and add Docker build assets so goprecords can be packaged and deployed in f3s.
Made-with: Cursor
|
|
Document Record, Open, CreateSchema, ResetRecords, ImportFromDir, LoadRecords
in storage; Reporter and reporters in goprecords; Fields and Parse in
recordline; Config and Run in daemon.
Made-with: Cursor
|
|
Add negative and edge-case tests for CreateSchema, ResetRecords,
LoadRecords, and ImportFromDir: closed DB, canceled context, missing
schema, invalid stats path, skipped parse lines, ordering/fields.
Made-with: Cursor
|
|
- Replace embedded Aggregate with Stats field to avoid promoted MetaScore pitfall
- Forward AddRecord and IsActive to Stats
- Replace package-level uploadKinds map with uploadKindExtension switch
Made-with: Cursor
|
|
Move runImport, runQuery, runReportFromFiles, runDaemon,
runCreateClientKey, and runTests into dedicated cmd_*.go files.
Keep Execute routing in cli.go. defaultListenFromEnv stays with daemon.
Made-with: Cursor
|
|
- Return io.WriteString errors from WriteReports via writeReportString
- Split ParseReportQuery into small URL parsing helpers
- Extract serveUploadPut and uploadAuthorized from upload handler closure
- Build report header with strings.Builder
Made-with: Cursor
|
|
Replace four switch-on-Metric sites with map[Metric]metricExtractor and
extractorFor fallback to uptime behavior. Add tests for unknown metric
and aggregate Downtime/Lifespan parity.
Made-with: Cursor
|
|
Move flag/query config to report_config.go and table formatting helpers
to report_format.go; keep Reporter types, WriteReports, and table builders
in report.go (SRP).
Made-with: Cursor
|
|
- 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
|
|
Remove OpenDB/CreateSchema/ResetRecords/ImportFromDir/ImportFromFS
wrappers and sqlite blank import from goprecords; keep LoadAggregates.
CLI and integration tests call storage.* directly. Storage-focused tests
live under internal/storage.
Made-with: Cursor
|
|
Decouple Aggregator and ImportFromDir from direct os.Open by routing
through io/fs: NewAggregatorFS, ImportFromFS, recordsdir.ListNonEmptyFilesFS.
NewAggregator and ImportFromDir wrap os.DirFS for backward compatibility.
Add fstest.MapFS tests for recordsdir, aggregate, and ImportFromFS.
Made-with: Cursor
|
|
Extract ListNonEmptyFiles and HostFromFileName into internal/recordsdir
for aggregate and storage ImportFromDir. Behavior unchanged.
Made-with: Cursor
|
|
Use strings.ToLower for POLA (CLI/HTTP). Extend parse tests with mixed-case
and lowercase inputs.
Made-with: Cursor
|
|
Guard Lifespan and Downtime against uint64 underflow when LastSeen < FirstBoot
or Uptime exceeds lifespan. Track per-host max BootTime with uint64 in
LoadAggregates to match file aggregation and avoid int64 conversion bugs.
Tests: lifespan underflow, downtime edge cases, LastKernel near MaxInt64.
Made-with: Cursor
|
|
Check CreateSchema in integration test runner so failures report
'create schema' instead of failing later on import. Extract
testImportExportOnDB for the canceled-context regression test.
Made-with: Cursor
|
|
Return ok=false when strconv.ParseUint fails instead of using zero
values. Add tests for non-numeric and empty numeric fields.
Made-with: Cursor
|
|
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
|
|
Use fmt.Errorf("load records: %%w", err) so import/query failures carry
context. Add TestLoadAggregatesWrapsLoadRecordsError.
Made-with: Cursor
|
|
Call db.PingContext in storage.Open and authkeys.OpenStore; close DB and
return wrapped errors on failure. Add tests for canceled context and
invalid directory path.
Made-with: Cursor
|
|
Deduplicate parseRecordLine from goprecords and storage; shared
recordline.Parse with Fields type. Tests live in recordline package;
DB import path still covered by goprecords TestImportFromDir.
Made-with: Cursor
|
|
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
|
|
Configure ReadHeaderTimeout, ReadTimeout, WriteTimeout, and IdleTimeout
on the daemon listener to mitigate slowloris and stuck clients.
Made-with: Cursor
|
|
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
|
|
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
|
|
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
|
|
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
|
|
- 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
|
|
- 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
|
|
- 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
|
|
- Add internal/cli tests for stable entry points: -version/--version,
file-based report (-stats-dir), import/query, test subcommand, -daemon/--daemon
validation, and subcommand recognition.
- Assert RegisterReportFlags keeps required flag names and defaults (CLI/HTTP).
- Run integration import/export against a temp SQLite file instead of
fixtures/test_import.db to avoid flaky readonly errors under parallel tests.
Made-with: Cursor
|
|
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
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Amp-Thread-ID: https://ampcode.com/threads/T-019ca323-dde1-73ac-97f0-cebfae5922a5
Co-authored-by: Amp <amp@ampcode.com>
|
|
Extract per-file import logic into importFile helper. ImportFromDir
reduced from 82 to 45 lines. Uses defer f.Close() for cleaner resource
management.
Task: 26d657e0-5d41-4953-adb7-38322618505a
Amp-Thread-ID: https://ampcode.com/threads/T-019ca323-dde1-73ac-97f0-cebfae5922a5
Co-authored-by: Amp <amp@ampcode.com>
|
|
Extract RunIntegrationTests into internal/goprecords with focused helpers:
testReportFixtures, testStatsOrder, testImportExport. main.go reduced
from 220 to 139 lines, with runTests now a thin 5-line wrapper.
Task: 7247d93e-e4af-4e8d-8fdc-116e0b06c7d3
Amp-Thread-ID: https://ampcode.com/threads/T-019ca323-dde1-73ac-97f0-cebfae5922a5
Co-authored-by: Amp <amp@ampcode.com>
|
|
Add ReportConfig, ReportFlags, RegisterReportFlags, and WriteReports to
the internal goprecords package. Both runQuery and runReportFromFiles now
use these shared functions, eliminating duplicated flag definitions and
report-rendering loops. main.go reduced from 313 to 220 lines.
Task: d8f7af80-1aca-4dea-9a20-b8f95640acb7
Amp-Thread-ID: https://ampcode.com/threads/T-019ca323-dde1-73ac-97f0-cebfae5922a5
Co-authored-by: Amp <amp@ampcode.com>
|
|
Extract record line parsing into a shared parseRecordLine function in
types.go, replacing duplicated parsing logic in aggregate.go and db.go.
Also simplifies lastKernelFromFile to use the shared function.
Task: a6e5c545-a37d-41a8-8a98-f3edb28ab662
Amp-Thread-ID: https://ampcode.com/threads/T-019ca323-dde1-73ac-97f0-cebfae5922a5
Co-authored-by: Amp <amp@ampcode.com>
|
|
Added test suites:
- types_test.go: Tests for Aggregate, HostAggregate, Epoch, Category, Metric,
OutputFormat, word wrapping, and formatting functions
- report_test.go: Tests for Reporter creation and report generation across
different categories, metrics, and output formats
- aggregate_test.go: Tests for file-based aggregation, context cancellation,
and helper functions
- db_test.go: Tests for database operations including schema creation, imports,
record reset, and aggregate loading
Coverage improved from 17.6% to 82.1%, exceeding the 70% target.
Amp-Thread-ID: https://ampcode.com/threads/T-019c7c73-58f9-7516-958d-f30eb17a3bff
Co-authored-by: Amp <amp@ampcode.com>
|
|
Performance improvement:
- Use transactions for database imports (118x speedup)
- Import time reduced from 11.2s to 0.076s
Amp-Thread-ID: https://ampcode.com/threads/T-019c7c73-58f9-7516-958d-f30eb17a3bff
Co-authored-by: Amp <amp@ampcode.com>
|