Skip to content

Add 'rootstock usage push': send aggregated rollups to the dashboard - #169

Merged
OwenPriceSkelly merged 2 commits into
mainfrom
feat/usage-push
Jul 28, 2026
Merged

Add 'rootstock usage push': send aggregated rollups to the dashboard#169
OwenPriceSkelly merged 2 commits into
mainfrom
feat/usage-push

Conversation

@OwenPriceSkelly

Copy link
Copy Markdown
Member

Summary

The final hop of the usage-stats design from #47: #156 writes per-session records, #159 aggregates them (usage report/compact), and this PR pushes the aggregated monthly rollup rows to the dashboard backend. The receiving endpoint is Garden-AI/rootstock-admin#6.

  • rootstock usage push [--root <path>] [--dry-run] — pushes the same aggregation report shows (rollup files plus not-yet-compacted raw records), filed under the manifest's cluster name. Requires a manifest (manifest init) and the same Modal proxy-auth credentials as manifest push. The backend stores rollups per cluster per month and replaces only the months present in a push, so running it repeatedly — e.g. from the nightly smoke-test cron alongside usage compact — is idempotent and never erases previously pushed history.
  • Privacy: only derived counts leave the cluster. summarize_spool already strips the salted user hashes down to unique_users counts, and the backend drops any users field defensively on ingest.
  • Endpoint URL: derived from api_url by swapping the standard rootstock-admin function name (-manifest-usage). A new optional usage_api_url config field (ROOTSTOCK_USAGE_API_URL env var) overrides it for deployments that don't follow that naming; if neither applies, the command says exactly what to set.
  • The success line names the URL it pushed to — a push to the wrong deployment (dev vs prod) previously looked identical to success, which is how the delta manifest went missing from the almanac in June. --dry-run prints the resolved URL and full payload for the same reason.

Test plan

  • New tests: config derivation/round-trip of usage_api_url (4), and usage push command tests covering missing credentials, non-derivable URL, missing manifest, missing spool, empty spool, --dry-run payload (counts only, no hashes), and a mocked-urlopen POST asserting URL, auth headers, and body (7).
  • Full suite: 597 passed, 2 skipped (LAMMPS not installed). ruff check clean; touched files ruff formated.
  • End-to-end --dry-run against a seeded temp root resolves garden-ai-dev--rootstock-admin-usage.modal.run from the standard manifest URL and emits the expected payload.
  • After rootstock-admin#6 deploys to dev: real round-trip usage pushGET /usage from a login node.

🤖 Generated with Claude Code

OwenPriceSkelly and others added 2 commits July 24, 2026 13:52
The collector (#159) aggregates the usage spool; this adds the last hop
from issue #47 — pushing the aggregated monthly rollup rows to the
rootstock-admin backend's new usage endpoint (Garden-AI/rootstock-admin#6).

- `rootstock usage push [--dry-run]` pushes the same aggregation `report`
  shows, filed under the manifest's cluster name. The backend stores
  rollups per month and replaces only the months present in a push, so
  repeated pushes (e.g. from the smoke-test cron) are idempotent.
- Only derived counts are sent; the salted user hashes stay in the spool
  (summarize_spool already strips them).
- The usage endpoint URL is derived from api_url by swapping the standard
  rootstock-admin function name (-manifest -> -usage); a new optional
  usage_api_url config field / ROOTSTOCK_USAGE_API_URL env var overrides
  it for non-standard deployments.
- The success line names the endpoint it pushed to: dev-vs-prod mixups
  previously looked identical to success (the delta manifest incident).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@OwenPriceSkelly
OwenPriceSkelly merged commit 42e9539 into main Jul 28, 2026
@OwenPriceSkelly
OwenPriceSkelly deleted the feat/usage-push branch July 28, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant