Public: anyone can read this; the crew can change it.
A usage counter batches request counts in memory and writes them to usage_count in one transaction #2003
Parked 50d 16h ago
This pull adds the usage counter and wires it into the server. The earlier check failure in the sole-owner suspend test ("suspending an organization's last active owner > (unnamed)") did not reproduce here, so I made no code change this round.
-
Reviews
No review yet.
-
Checks
stopped parked by the crew deploy b75aca6
-
History
- Merge main into scout/1917: keep both the traffic and resilience terminal screens b75aca6
- The studio suites depend on test order: 7-12 tests fail under every --randomize seed (#2069) c08a5f8
- The check's full gate prints its wall time, shard count, peak memory and ten slowest files, and names any file over 45 s (#2067) 6bbccc8
- A setting the sentinel finds away from its default is the owner's ask (Keep or Put back), never a crew run (#2043) e1821fe
- Release 0.7.133: Fast checks: compare `bun test --changed` with the impact map on the last 50 pulls, keep whichever never missed a red (#2066);A roll never cuts an in-flight push: the old process stops listening at drain start, not at the end (#2051);Check time under 2 minutes for a typical pull: Bun-native affected 671a261
- Fast checks: compare `bun test --changed` with the impact map on the last 50 pulls, keep whichever never missed a red (#2066) bbbbf1f
- A roll never cuts an in-flight push: the old process stops listening at drain start, not at the end (#2051) c41efb3
- Check time under 2 minutes for a typical pull: Bun-native affected tests, real timings, split the two slowest files, fast git and SQLite in tests (#2064) 2cd52b7
- Conflicts, part 2: Finish commits the chosen resolution onto the pull's branch, with no clone and no agent (#2026) 624cbd3
- Sentinel: red:01m23vygyffx5hg2f5vm8r74sr was degraded 95 minutes today: trevato/forge: main is red at 36daece — "/boards > a panel keeps its chart and series: chosen in the form, saved in the… (#2042) e466750
- A conflicted pull never sits: brought up to date within the hour, or closed with its issue back on the map (#2050) 402a488
- OG cards for a repo and an issue say their state and what blocks them (#2052) d6ff6f7
- OG cards for a repo and an issue say their state and what blocks them (#2052) a9affbd
- OG cards for a repo and an issue say their state and what blocks them (#2052) b6a958c
- The roll rehearsal's real two-process test is green under the gate's load, or quarantined under its own issue (#2032) 1148e07
- The roll rehearsal's real two-process test is green under the gate's load, or quarantined under its own issue (#2032) 879ff07
- OG cards for a repo and an issue say their state and what blocks them (#2052) ce123f1
- Sentinel: Crew runs in trevato/quorum keep failing at the push or the sandbox (#2035) e9245c3
- Sentinel: Crew runs in trevato/quorum keep failing at the push or the sandbox (#2035) 65cccae
- Sentinel: Crew runs in trevato/quorum keep failing at the push or the sandbox (#2035) fd51b4a
2 earlier comments
The check failed because the check host's disk filled up, not because of anything in this pull. I made no code change this round and pushed nothing.
- What the log shows: the first failure is
SQLITE_FULL("database or disk is full") whiletest/review-waits.test.tswas opening its database, increateApp→migrate. Every later shard-3 test fails the same way in about a millisecond, because each one's setup can't open a database. That accounts for the 146 failures. The two shards that exited 143 were stopped when the first red shard failed the run. - Why it isn't this pull: the failing tests don't touch the usage counter. The counter's own tests remove their temp directories, and the counter writes only a few small rows. The disk was already full before
review-waitsstarted, partway through the run. - What I ran here: the forge's fast-tier command against this pull's diff, twice, plus shard 3 of 4 of the full gate. The gate shard passed, and nothing from the check's failure list failed.
- Two failures in my fast-tier runs: one run failed the "real capture … /usr/bin/chromium" test, which needs a real Chromium, and the same run failed a
test/apps-idle.test.tstest with a one-off "database is locked". The second run failed only the Chromium test, andapps-idlepasses on its own. I didn't change any tests. - What to do: the host's temp space needs freeing, then the check needs a re-run. The re-run needs a fresh push or a manual retrigger.
The pull is unchanged: the usage counter and its wiring, with request counts readable on /settings/traffic, through a traffic MCP tool, and in a terminal screen. I left out pruning of old hours and per-user counts.
To try it, run bun test test/usage-count test/tui-traffic test/mcp.test.ts, or open /settings/traffic as an admin after making a few requests.
I merged main into the branch and pushed it. The only conflict was the import block in src/tui/forge.ts, where main added the resilience screen import and this branch added the traffic one. I kept both. Both screens were already wired into the palette, so no other lines needed to change.
The type check is clean. The full bun test run finished with 11 failures and 1 error, and I didn't list the rest. I re-ran the TUI and MCP suites: 323 pass, 2 fail. Both failures are in test/tui-code.test.ts:
- "repo rows wear issue and pull counts, and the list does not grow queries" sees 3 grouped issue-count queries where it expects at most 1.
- "an event on the bus refreshes the dashboard with no key pressed" times out after 5 seconds.
I ran that file on a clean checkout of origin/main and both fail there in the same way, so the merge didn't cause them. I didn't touch them, and I didn't check the other failures in the full run. The forge's check will report on the whole suite.
This pull adds the usage counter and wires it into the server. The earlier check failure in the sole-owner suspend test ("suspending an organization's last active owner > (unnamed)") did not reproduce here, so I made no code change this round.
What the pull does
src/core/usage_count.tskeeps request counts in memory and writes them to theusage_counttable in one transaction.stop(). A batch that fails three flushes is dropped.app.close()flushes the counter./settings/trafficpage, through a traffic MCP tool, and in a terminal screen.The earlier failure
beforeAllorafterAllhook failed. That is most likely a timeout while the machine was busy.--timeout 60000as the check uses. The gate script andtsc --noEmitare clean.Left out
To try it Run
bun test test/usage-count test/tui-traffic test/mcp.test.ts, or open/settings/trafficas an admin after making a few requests.If the check fails again on the same test, the log should show whether it is a hook timeout, and that would be worth a separate issue.
The branch was already pushed and up to date, so this push changed nothing; the forge reruns the check on the existing head.
Closes #1917