GeezerVison is showing github.com — feat(usage-hub): Turso org-usage collector in the quota gatherer (#1049) by dezren39 · Pull Request #2366 · developing-today/code
Conversation
dezren39
commented
Oct 29, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Closes the build half of #1049 (queue task 2984; route verification was triage task 2311).
What
src/quota-gather-map.ts — entryFromTurso: maps a Turso org usage + subscription read onto a quota-current entry (serviceId: "turso", so the §4 pct snapshot records continue the SaaS card's series). Windows carry used value (counts/rows raw, storage + sync in GB), % of the Starter Free limits from the issue (100 DBs, 5 GB storage, 500M rows read, 10M rows written, 3 GB sync), and the subscription current_billing_period_end as resetsAt (cycle end). Missing metrics are omitted — never zeroed; an unusable/failed read is an error entry (previous dated value stands, flagged) — never a fresh-looking zero.
scripts/gather-quota.ts — runTurso: per tick, resolves the platform token from Bitwarden by name only (turso.platform-api-token-muse-cli, the collect-fleet-feed bws pattern; laptop ~/.config/bws/access-token + sandbox paths both handled; TURSO_API_TOKEN env override for manual runs), then GET /v1/organizations/{slug}/usage + /subscription (TURSO_ORG_SLUG default dezren39). Any failure degrades only Turso's own entry, like every other provider. The token value never appears in code, logs, snapshots, or this PR.
test/quota-gather-map.test.ts: 3 new tests pinned to the triage-verified live values (rows_read 1,905,385; rows_written 30,026; storage 1,053,323,264 B; sync 30,408,704 B; 3 DBs; period 2026-10-01T04:00Z → 2026-11-01T04:00Z).
Verification
- Targeted:
bun test test/quota-gather-map.test.ts — 14/14 pass (laptop); bunx tsc --noEmit clean.
- Full aggregator suite: 344 pass, 1 fail pre-existing on clean main (attention action-controls badges, design+impl(aggregator): triage actions on /attention - acknowledge, snooze, escalate, answer - orchestrator-mediated #1152/impl(aggregator): session actions from /sessions and /attention - poke, answer, stop - keeper/orchestrator-mediated #1156 — fails identically without this change).
- Live gather from this branch (worktree outputs redirected):
turso ok 1143ms, entry populated — planLabel starter, databases 3% · storage 21.066% · rows-read 0.381% · rows-written 0.3% · sync 1.014%, resetsAt 2026-11-01T04:00:00.000Z — and 5 §4 snapshot records appended (turso/{databases,storage,rows-read,rows-written,sync}, source api).
Deploy note: no unit changes needed — the gatherer service runs gather-quota.ts from the primary checkout, so this takes effect on the next tick after merge + pm-git-sync.
🤖 Queue worker (repo-worker-code), Lane C — task 2984
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2F33b6f70f3541c4e93f4503d29cbfec051fa1b040d8e0ae9313a51c4ece44a627%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2d33782e706e67)
Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
chatgpt-codex-connector[bot] reacted with thumbs up emoji
Adds a Turso source to the Stage 2 quota gatherer: GET /v1/organizations/{slug}/usage + /subscription (route verified live 2026-10-29, triage task 2311), token resolved from Bitwarden by name (turso.platform-api-token-muse-cli; value never logged/stored), mapped by entryFromTurso in quota-gather-map.ts onto a quota-current entry (serviceId turso) vs Starter Free limits (100 DBs, 5 GB storage, 500M rows read, 10M rows written, 3 GB sync) with the subscription current_billing_period_end as cycle end. recordsFromEntries appends the section-4 pct snapshot records per changed metric, so daily deltas derive from consecutive snapshots. Failures degrade to an error entry (previous dated value stands, flagged) — never zeros; missing metrics are omitted, never zeroed.
Tests: quota-gather-map.test.ts +3 Turso tests (verified-live fixture values) — 14/14 pass on laptop; tsc clean. Full aggregator suite: 344 pass, 1 pre-existing fail (attention action badges, fails identically on clean main). Live gather from this worktree: turso ok in 1.1s, planLabel starter, resetsAt 2026-11-01T04:00:00Z, 5 turso snapshot records appended.
coderabbitai
Bot
commented
Oct 29, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Warning
Review limit reached
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 45 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
15094e53-1ddc-45a0-bf6a-31b92c978d7a
Commits
-
Reviewing files that changed from the base of the PR and between 5a34fa7 and c05770c.
Files selected for processing: 6
-
pm-stack/aggregator/scripts/gather-quota.ts
pm-stack/aggregator/src/quota-current.ts
pm-stack/aggregator/src/quota-gather-map.ts
pm-stack/aggregator/src/sources/live.ts
pm-stack/aggregator/test/quota-current.test.ts
pm-stack/aggregator/test/quota-gather-map.test.ts
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
-
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-10-29T16:26:10.804778Z |
c05770c |
Manual request |
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fce30029ee
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
1. SaaS consumer: overlayTursoUsage in quota-current.ts applies the gatherer Turso entry to the usage() SaaS card (fresh ok replaces metrics/stamp/cycle end; error or stale keeps the dated card plus a dated conflict flag), wired into both live usage() paths in sources/live.ts. 2. Snapshot units: turso databases/storage/sync records now carry native values+units (count/GB) matching the recordsFromSaasServices series instead of pct on the same metric ids; rows stay pct (no native rows series/unit exists). 3. Timeout: the Turso fetch AND its body parse run inside withTimeout with an AbortSignal, so a stalled body cannot hang the tick.
Tests: +3 overlayTursoUsage tests; Turso record expectations updated. Targeted files 51/51 pass, tsc clean, full suite 347 pass / 1 pre-existing fail (attention badges, also on clean main). Live gather re-verified: 5 turso records appended in native units with resetsAt 2026-11-01T04:00:00Z.
|
@codex review
Codex findings from the fce3002 review are fixed in c05770c and each thread has a disposition reply (all three addressed in code + tests). Please re-review the current head.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff.
Reviewed commit: c05770cee7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 21, 2026
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|