Skip to content

Token volume per bucket, and the two security counts a window can report - #20

Merged
fylorn merged 1 commit into
mainfrom
feat/usage-buckets-and-security-summary
Sep 16, 2026
Merged

fylorn merged 1 commit into
mainfrom
feat/usage-buckets-and-security-summary

Conversation

@fylorn

@fylorn fylorn commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Three additions the desktop overview needs.

Grouped cost buckets carry token volume

The trend chart is becoming switchable between money and usage, and the two have different shapes — one opus burst dominates a cost chart and flattens the week around it, while in token terms the same burst sits in proportion.

All four token classes come back separately: their unit prices differ by more than tenfold, so a single sum neither adds back up to the money nor says whether the time went on writing new context or reading cache.

Redactions are recorded

Event::Redacted was deliberately dropped by the recorder as "request detail, not another row" — except the detail was not stored either. The consequence only appears once a user switches outbound redaction from observe to enforce: observe mode leaves evidence in /leaks, enforce mode replaced the secrets in place and left nothing behind, so the panel goes quiet exactly when protection is strongest.

The column is nullable, like tool_calls: "redaction was off" and "redaction was on and replaced nothing" are different facts. Only the count is stored — what was replaced is precisely what must not be written down.

Schema 8 → 9. The migration test that fails whenever a column is added without updating it did its job.

Summary reports the two security counts

flagged_requests and redacted_requests for the window, so a security panel can report what each defence actually saw rather than only which mode it is in.

Gates

cargo fmt --all -- --check, cargo clippy --workspace --all-targets -- -D warnings, cargo test --workspace (61 binaries green), ./scripts/smoke.sh (46 passed, 0 failed).

🤖 Generated with Claude Code

…an report

Three additions the overview needs.

**Grouped cost buckets carry token volume too.** The overview's trend
chart is about to become switchable between money and usage, and those
two have different shapes: one opus burst dominates a cost chart and
flattens the week around it, while in token terms the same burst sits
in proportion. All four token classes are returned separately — their
unit prices differ by more than tenfold, so a single sum neither adds
back up to the money nor says whether the time was spent writing new
context or reading cache.

**Redactions are recorded.** They were deliberately dropped before, as
"request detail, not another row" — except the detail was not stored
either. The consequence only shows up after a user switches outbound
redaction from observe to enforce: observe mode leaves evidence behind
in /leaks, enforce mode replaced the secrets in place and left nothing,
so the panel goes quiet exactly when protection is at its strongest.
The column is nullable, like tool_calls: "redaction was off" and
"redaction was on and replaced nothing" are different facts. Only the
count is stored — what was replaced is precisely what must not be
written down.

**Summary reports flagged and redacted request counts** for the window,
so a security panel can say what each defence actually saw rather than
only which mode it is in.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Thanks for the PR. One thing before review: this targets main, and it should target dev.

main is a release-only line — branch-protected, linear history, and every commit on it is a tagged release snapshot. Routine work lands on dev and reaches main with the next release. GitHub pre-filled main here because it is the default branch, so this is our defaults being unhelpful rather than anything you did wrong.

No need to close and reopen: click Edit next to the PR title and change the base branch to dev. The commits and the discussion carry over.

See CONTRIBUTING.md and CONTRIBUTING.md for the branch contract.

@fylorn
fylorn merged commit 9d4dae1 into main Sep 16, 2026
2 checks passed
@fylorn
fylorn deleted the feat/usage-buckets-and-security-summary branch September 16, 2026 03:24
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