refactor(analytics): simplify JSON report storage #15

Merged
eleith merged 2 commits from feat/analytics-json into main 2026-11-07 19:36:33 +00:00

Summary

Simplify prepared analytics storage and separate shared report logic from SQL persistence, without changing the visible admin or visit-recording semantics.

  • Add pure @goto/analytics for canonical versioned JSON contracts, UTC period/day helpers, one batch encoding boundary, and lightweight readers.
  • Replace opaque report keys/shared period/empty/selection handling with explicit overview/domain/link identities and separate summary_json / details_json columns in analytics_reports.
  • Keep cards/tables on small summaries; details contain self-contained daily points and browser/OS breakdowns. Remove stored weekly/monthly series; no Chart.js or client grouping work is included.
  • Validate and serialize the batch before report invalidation/pruning. Keep the DB publisher focused on mapping pre-encoded rows and atomic SQL publication, without reparsing/recomputing reports.
  • Preserve grouped snapshot queries, request-time outcomes, finite retention, zero-policy handling and the existing hourly workflow/jitter. Migration 0007_analytics_reports replaces only the derived cache; retained raw visits remain the rebuild source.
  • Update workspace dependencies, private-package release metadata, both CI providers' dependency gates, and development source mounts/build ownership for the new package.

Commit structure

  1. feat(analytics): add shared report document contracts — pure package, helpers/codecs, focused tests and workspace metadata.
  2. refactor(analytics): switch to daily JSON report storage — coordinated persistence/worker/admin cutover, integration wiring and obsolete code removal.

Validation

  • Four independent review categories and affected correction re-reviews clean: readability, correctness/security, test quality and explicit reference parity.
  • Full pnpm verify passes: schema, builds, typechecks (Svelte 0 errors/0 warnings), formatting/lint, 508 workspace unit tests, 6 development-script tests, 7 Chromium integrations and 5 worker service cases.
  • Fresh pruned web/worker artifacts pass an isolated outside-repository smoke: dependencies contained, new cache preparation/pruning, separate daily JSON readers, six authenticated SSR scopes, valid-only/base metrics, compiled Piscina persistence and natural shutdown.
  • Frozen/offline dependency restore, changeset status, whitespace and committed-source hash checks pass.
  • SQL projection regression test observes real SQLite statements, protecting summary-only versus details-only reads without full SQL snapshots.

No raw capture, authentication, public configuration or visible layout changes; no new analytics HTTP service or compatibility/rollback framework. Performance has not been benchmarked, and Docker execution remains owner-only. Local configuration, databases, seeded data, credentials and planning/review evidence are excluded.

## Summary Simplify prepared analytics storage and separate shared report logic from SQL persistence, without changing the visible admin or visit-recording semantics. - Add pure `@goto/analytics` for canonical versioned JSON contracts, UTC period/day helpers, one batch encoding boundary, and lightweight readers. - Replace opaque report keys/shared period/empty/selection handling with explicit overview/domain/link identities and separate `summary_json` / `details_json` columns in `analytics_reports`. - Keep cards/tables on small summaries; details contain self-contained daily points and browser/OS breakdowns. Remove stored weekly/monthly series; no Chart.js or client grouping work is included. - Validate and serialize the batch before report invalidation/pruning. Keep the DB publisher focused on mapping pre-encoded rows and atomic SQL publication, without reparsing/recomputing reports. - Preserve grouped snapshot queries, request-time outcomes, finite retention, zero-policy handling and the existing hourly workflow/jitter. Migration `0007_analytics_reports` replaces only the derived cache; retained raw visits remain the rebuild source. - Update workspace dependencies, private-package release metadata, both CI providers' dependency gates, and development source mounts/build ownership for the new package. ## Commit structure 1. `feat(analytics): add shared report document contracts` — pure package, helpers/codecs, focused tests and workspace metadata. 2. `refactor(analytics): switch to daily JSON report storage` — coordinated persistence/worker/admin cutover, integration wiring and obsolete code removal. ## Validation - Four independent review categories and affected correction re-reviews clean: readability, correctness/security, test quality and explicit reference parity. - Full `pnpm verify` passes: schema, builds, typechecks (Svelte 0 errors/0 warnings), formatting/lint, **508 workspace unit tests**, **6 development-script tests**, **7 Chromium integrations** and **5 worker service cases**. - Fresh pruned web/worker artifacts pass an isolated outside-repository smoke: dependencies contained, new cache preparation/pruning, separate daily JSON readers, six authenticated SSR scopes, valid-only/base metrics, compiled Piscina persistence and natural shutdown. - Frozen/offline dependency restore, changeset status, whitespace and committed-source hash checks pass. - SQL projection regression test observes real SQLite statements, protecting summary-only versus details-only reads without full SQL snapshots. No raw capture, authentication, public configuration or visible layout changes; no new analytics HTTP service or compatibility/rollback framework. Performance has not been benchmarked, and Docker execution remains owner-only. Local configuration, databases, seeded data, credentials and planning/review evidence are excluded.
eleith-gitea-agent Bot added 2 commits 2026-11-07 19:30:50 +00:00
refactor(analytics): switch to daily JSON report storage
ci/woodpecker/pr/cli Pipeline was successful
ci/woodpecker/pr/config Pipeline was successful
ci/woodpecker/pr/db Pipeline was successful
ci/woodpecker/pr/web Pipeline was successful
ci/woodpecker/pr/worker Pipeline was successful
ci/woodpecker/push/cli Pipeline was successful
ci/woodpecker/push/config Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/web Pipeline was successful
ci/woodpecker/push/worker Pipeline was successful
ac0c9b48a5
eleith merged commit ac0c9b48a5 into main 2026-11-07 19:36:33 +00:00
eleith deleted branch feat/analytics-json 2026-11-07 19:36:33 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: eleith/goto#15