Repository navigation
feat(stats): per-group missing-money counts and security log totals - #193
Merged
Merged
Conversation
/summary/buckets/by: every CostBucketGroup now carries unpriced_requests and no_usage_requests, counted with the same NO_PRICE / NO_USAGE conditions as CostBucket and CostGroup, for every dim (model, provider, client). A group whose cost is 0 can now be told apart as "no price", "no usage" or genuinely free, and the groups of a bucket add up to that bucket's own counts. GET /security/events: SecurityEventsPage gains `total` (every event that matches the guard and time window, not just this page) and `by_outcome` (SecurityOutcomeCounts: recorded / replaced / cut / blocked, all four always present; they add up to `total`). The page and the count share one WHERE clause (SECURITY_FILTER); `before` is a cursor, not a filter, so every page of the same window reports the same total. `more` stays. Db::security_events now returns the whole tw_api::SecurityEventsPage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
fylorn
added a commit
that referenced
this pull request
Sep 25, 2026
v0.48.0 was published before the template landed, so its page holds only GitHub's generated list. release-notes/0.48.0.md summarizes it from #191-#198 so the page can be rewritten from the template: - upgrade notes: CONTROL_API_VERSION 21, so ThinkWatch Lite 2026.9.16 (core 0.47.0, protocol 20) does not connect to it and a server used with that app stays on 0.47.0; the request store's schema 20, which empties the request history on the first start (and again on the way back); the /in-flight shape, RequestStarted.session and the removed ChatgptUsage fields; - session and route on the start event, requests a rule decided without an upstream, the replayable /in-flight snapshot and the new /live fields, and /summary/routes (#197); - per-group unpriced and no-usage counts, and security log totals (#193); - the signed-in account on a ChatGPT account upstream (#195); - releases published from one job, the server guide and the crate metadata (#191), and the test port fix (#192). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fylorn
added a commit
that referenced
this pull request
Sep 25, 2026
v0.48.0 was published before the template landed, so its page holds only GitHub's generated list. release-notes/0.48.0.md summarizes it from #191-#198 so the page can be rewritten from the template: - upgrade notes: CONTROL_API_VERSION 21, so ThinkWatch Lite 2026.9.16 (core 0.47.0, protocol 20) does not connect to it and a server used with that app stays on 0.47.0; the request store's schema 20, which empties the request history on the first start (and again on the way back); the /in-flight shape, RequestStarted.session and the removed ChatgptUsage fields; - session and route on the start event, requests a rule decided without an upstream, the replayable /in-flight snapshot and the new /live fields, and /summary/routes (#197); - per-group unpriced and no-usage counts, and security log totals (#193); - the signed-in account on a ChatGPT account upstream (#195); - releases published from one job, the server guide and the crate metadata (#191), and the test port fix (#192). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fylorn
added a commit
that referenced
this pull request
Sep 25, 2026
…summary (#196) * ci(release): write the release page from a template, with an English summary #191 made the publish job write the release once, with GitHub's generated list of pull requests as its only text and the tag as its title. A release is now titled "ThinkWatch Core <version>", and its text has, in order: - an English summary from release-notes/<version>.md, when that file exists; - a table of the files for each platform; - the commands that install this version on a Linux server and switch an existing installation to it (install.sh --version, twcore upgrade --version --restart); - how to verify a download against its .sha256; - GitHub's generated list of pull requests. scripts/release_notes.py builds the text; the publish job fetches the generated list itself (releases/generate-notes) and hands the finished text to action-gh-release, which no longer generates anything. The "only once" rule from #191 stays: a release that already exists keeps its text. A rehearsal (workflow_dispatch) now writes the text into the run summary, using the version in Cargo.toml. scripts/release_notes_test.py checks that the table links exactly the files in release.yml's FILES list, that the install and upgrade options exist, and that every file in release-notes/ renders; the Linux CI job runs it before compiling. release-notes/0.47.0.md summarizes 0.47.0 from #183-#190; the live v0.47.0 release page now carries it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * release-notes: summarize 0.48.0 v0.48.0 was published before the template landed, so its page holds only GitHub's generated list. release-notes/0.48.0.md summarizes it from #191-#198 so the page can be rewritten from the template: - upgrade notes: CONTROL_API_VERSION 21, so ThinkWatch Lite 2026.9.16 (core 0.47.0, protocol 20) does not connect to it and a server used with that app stays on 0.47.0; the request store's schema 20, which empties the request history on the first start (and again on the way back); the /in-flight shape, RequestStarted.session and the removed ChatgptUsage fields; - session and route on the start event, requests a rule decided without an upstream, the replayable /in-flight snapshot and the new /live fields, and /summary/routes (#197); - per-group unpriced and no-usage counts, and security log totals (#193); - the signed-in account on a ChatGPT account upstream (#195); - releases published from one job, the server guide and the crate metadata (#191), and the test port fix (#192). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * release-notes(0.48.0): say where the key is kept without naming the keychain Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Two protocol gaps the redesigned desktop UI had to paper over.
/summary/buckets/by: every group says how much of its money is missingCostBucketGroupgains two fields, with exactly the semanticsCostBucketandCostGroupalready use (the sameNO_PRICE/NO_USAGESQL conditions):unpriced_requestsSummary::unpriced_requestsno_usage_requestsSummary::no_usage_requestsFilled for every dim (
model,provider,client). A group whose cost is 0 can now be told apart as "no price", "no usage" or genuinely free (e.g. afree-billing upstream), and the groups of one bucket add up to that bucket's own counts in/summary/buckets.GET /security/events: the total for the window, by outcomeSecurityEventsPagegains:totalguardandfrom_ms/to_mswindow — not just this pageby_outcomeSecurityOutcomeCountstotalwererecorded/replaced/cut/blocked; all four keys always present (0 when none); they add up tototalNew type
SecurityOutcomeCounts { recorded: number, replaced: number, cut: number, blocked: number }(one field perSecurityOutcomevariant).SECURITY_FILTERintw-store/src/db.rs), so the header number and what paging can reach are the same set.beforeis a paging cursor, not a filter: every page of the same window reports the sametotal/by_outcome.moreis unchanged. The count only readssecurity_events(the join torequestsnever adds or drops an event). No schema change.Db::security_eventsnow returns the wholetw_api::SecurityEventsPage; the handler passes it through.No new endpoints, no new message codes, no changes to the first-layer crates (
tw-dialect,tw-guard,tw-breaker).Tests
tw-store:every_group_in_a_bucket_says_how_much_of_its_money_is_missing(all three dims across two buckets, including a free-billing group and an empty window; groups sum to the plain bucket); the two cost-state definition tests now also covercost_buckets_by.tw-store:the_total_counts_the_whole_window_not_just_the_page(9 events, pages of 4; total stays 9 on every page),the_total_is_what_paging_to_the_end_yields_under_every_filter(guard and time filters, including an empty filtered set),an_empty_window_counts_zero_of_everything.tw-control: the log test now checkstotal/by_outcomeon the first page, the next page and a filtered query;the_log_counts_past_one_page_and_an_empty_window_counts_zero(150 events with the default page of 100; the exact JSON for an empty window); newtests/summary.rschecks the/summary/buckets/byJSON for all three dims and an empty window.cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warningsandcargo test --workspacepass locally.🤖 Generated with Claude Code