Repository navigation
Description
Summary
Three more saas-extract.ts extractors parse counts with bare \d+, so a comma-grouped figure is either silently truncated to its last digit group or drops the metric(s) entirely. This is the same defect class as #2997 (bitwarden), in extractors that issue does not name: Cloudflare counts, the Turso database count, and the GitHub comped-minutes pair. The wrong used values flow into durable snapshot records the same way #2997 describes (recordsFromSaasServices, snapshot-records.ts:85).
Evidence (main 1c6d5174)
pm-stack/aggregator/src/saas-extract.ts:
- :308 (Cloudflare) —
/(\d+) Workers, (\d+) R2 buckets[^;]*; (\d+) D1, (\d+) KV, (\d+) Queues/.\d+cannot cross a comma. When the first count is grouped, the engine slides and records only the last group. When a later count is grouped, the pinned literal separators (,,;) leave nowhere to slide, so the whole match fails and all five count metrics vanish. - :324 (Turso) —
/(\d+) DB/records the last group of a grouped database count. - :395 (GitHub) —
/(\d[\d,]*) Linux \+ (\d+) macOS minutes/: the Linux group already accepts commas (and strips them at :426), but the macOS group is bare\d+pinned by theLinux +literal, so a grouped macOS figure makes the whole comped-minutes metric disappear instead of being recorded.
Verified this run on the laptop with the real extractSaasServices (saas-extract.ts md5 2b540acdb7924e834941a63b0416cf44 on both clones; probe ~/git/fleet/probe-2026-10-31-laneA-saascounts/):
CF grouped-first "1,234 Workers, 56 R2 buckets ~2 GB; 7 D1, 8 KV, 9 Queues"
-> workers-count=234 (want 1234), r2=56, d1=7, kv=8, queues=9
CF grouped-later "3 Workers, 2 R2 buckets ~2 GB; 2 D1, 1,234 KV, 2 Queues"
-> {} — all five count metrics missing (want kv=1234, rest present)
CF control "3 Workers, 2 R2 buckets ~2 GB; 2 D1, 2 KV, 2 Queues" -> 3/2/2/2/2
Turso grouped "1,234 DB total" -> databases=234 (want 1234); control "12 DB" -> 12
GitHub grouped "5,000 Linux + 1,234 macOS minutes" -> actions-comped-minutes missing
(want 6234); control "5,000 Linux + 234 macOS minutes" -> 5234
Why it matters
- The truncated figures are indistinguishable from true reads (234 could be a real Workers count), and they persist as snapshot history — silent corruption, not a display glitch.
- The drop modes are worse in a different way: one grouped figure in the wrong position erases the whole Cloudflare footprint line or the comped-minutes metric, so the hub reports "not measured" for data that was recorded in the view.
- The house pattern already exists in the same file:
allowance()captures[\d,.]+,dns.tsparsePriceUsdandsnapshot-records.ts:177use[\d,]++ strip-commas, and the GitHub extractor's own Linux group does it — these three sites are the outliers. Existing fixtures only exercise ungrouped counts (3 Workers, 2 R2 buckets…,1 DB), so the suite cannot see the gap.
Acceptance criteria
- Cloudflare counts parse comma-grouped figures at face value in every position:
1,234 Workers, …→ 1234, and…, 1,234 KV, …→ kv-count 1234 with the other four counts still present. - Turso
databasesparses1,234 DB→ 1234. - GitHub comped minutes parse
5,000 Linux + 1,234 macOS minutes→ 6234. - Regression tests in
pm-stack/aggregator/test/usage.test.tscover grouped figures for all three extractors alongside the existing ungrouped fixtures; ungrouped reads are unchanged and a bullet with no counts still yields no count metrics.
Dedup
Searched open and closed issues 2026-10-31 for cloudflare counts comma, turso comma, macOS minutes, saas-extract grouped counts, and the counts-line text: the only hit is #2997, which is scoped to the bitwarden extractor (landed in PR #2987) and names only the Modal comma-dollar patterns as a sibling for triage ruling. The Cloudflare, Turso, and GitHub sites predate that commit and are not mentioned there. #2985/#2791 concern num() reinterpretation of non-decimal strings in different functions, not grouped-decimal truncation/dropping.
Activity
dezren39 commentedon Oct 31, 2026
🤖 Agent note · filed
dezren39 commentedon Oct 31, 2026
🤖 Design-architect pass 25 (2026-10-31) — agent note: this issue is ADOPTED as Phase 2 (with #2997) of design #3005 (a measurement is a plain decimal), linked as its sub-issue and labelled
source/design-architect. Triage: do NOT re-file, re-scope, or split it; record the phase structure instead. The design records the prose form of the grammar: count extractions capture the grouped form ([\d,]+, strip commas) in EVERY position — a grouped figure that cannot match makes the metric absent, never truncated and never a whole-line drop. Flag genuine blockers on #3005.17 remaining items
dezren39 commentedon Nov 2, 2026
🤖 Agent note · parked — CI pending on PR #4290
repo-worker-code, OpenChamber scheduled lane)queue/5513-3000-grouped-countsat4a2f496368e6896685ce236f51c148e615acc285.bun test test/usage.test.ts— 43 pass;bun test— 1019 pass.bun run typecheckhas pre-existing diagnostics in unchanged files, reproduced on cleanmain.dezren39 commentedon Nov 2, 2026
🤖 Agent note · picked up (resume)
queue/5513-3000-grouped-counts; checks still QUEUED (runner backlog); prior local runs: usage.test.ts 43 pass, full aggregator suite 1019 pass.fix(aggregator): parse grouped SaaS counts (#3000) (#4290)
dezren39 commentedon Nov 2, 2026
🤖 Agent note · done
[\d,]++ comma-strip at all three saas-extract sites (Cloudflare counts ×5, Turso DB, GitHub comped Linux+macOS including the macOS sum group), plus 4 regression tests in usage.test.ts (grouped-first CF, grouped-KV CF, Turso 1,234 DB, GH 5,000+1,234 minutes = 6234). Closing this issue manually: the PR body carried no closing keyword.bun test test/usage.test.ts43/43; full aggregatorbun test1019 pass / 0 fail (matches the prior lane's run; one intermediate 3-fail run during a concurrentbun installdid not reproduce). Codex review on PR fix(aggregator): parse grouped SaaS counts (#3000) #4290 completed with no findings. PR CI was still queued at merge (runner backlog); merged under standing merge authority on laptop-verified tests.