Skip to content

Security header: exact match count from core, broken down by outcome - #203

Merged
fylorn merged 2 commits into
devfrom
ui/security-core-data
Sep 25, 2026
Merged

fylorn merged 2 commits into
devfrom
ui/security-core-data

Conversation

@fylorn

@fylorn fylorn commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

What this changes

The Security page header now shows the exact number of matches in the log's window, from SecurityEventsPage.total (core v0.48.0), instead of the count of loaded rows with a "+" once the first page was full ("24 小时内 100+ 次命中"). The count is followed by the breakdown from by_outcome: cut off, refused, replaced, recorded. Each has the same dot colour as the log's Action column, and zero counts are hidden:

● 2 项拦截 ● 2 项观察 ● 1 项关闭 | 24 小时内 7 次命中 ● 1 已切断 ● 4 已替换 ● 2 仅记录

  • The numbers follow the log's range. Loading more pages does not change them. New matches count up (AnimatedNumber in the log's scope). A range switch jumps straight to the new values.
  • While the log loads, a skeleton holds the place. If the log fails to load, the header leaves the count out and the log below shows the error.
  • On narrow windows the count and its breakdown wrap as one unit, so the line never breaks in the middle of the breakdown.
  • English uses the singular for one: "1 match in the last 24 hours".
  • The old approximation (events.length plus "+") is removed, along with the comments that described it.

Also fixed in the log (second commit): after a reload that brings back a whole page of newer entries, the rows that dropped off stay in place while they fade out, and the new rows are listed after them. The same day then got two headings, with duplicate React keys. Rows are now grouped by day instead of by adjacency.

Why

Core now reports the total and the per-outcome counts for the whole window (ThinkWatch-Core#193), and lite pins v0.48.0 since #202. The header no longer has to guess.

How it was verified

  • pnpm typecheck, pnpm test (a new test checks that the outcome order covers all four outcomes, with the red ones first), and pnpm build. Rust is untouched.
  • Full-app preview harness (core 0.48 mocks), headless Chromium:
    • With the default data the header reads 7 matches (1 / 4 / 2).
    • Five matches were added and the page refreshed. Sampling every frame showed 8 distinct frames counting 7 → 12, with the breakdown counting along.
    • Switching to 7 days showed a single frame: the value jumped with no count-up.
    • 150 matches were added (164 in the window). The header showed "164" with no "+". After "Load more" the list grew from 100 to 164 entries and the header was unchanged.
    • Checked zh/en, light/dark, 1100×720 and 820×560, with 4-digit counts (at 820 the breakdown wraps as one unit and nothing overflows), ?empty (0 matches), ?fail=SecurityEvents (count omitted, error in the log) and a slow log read (skeleton).
    • The duplicate-key warning reproduced before the grouping fix (14 rows loaded, then 150 newer entries) and is gone after it.

🤖 Generated with Claude Code

fylorn and others added 2 commits September 25, 2026 13:51
…tcome

The header said "100+" once the log's first page was full, because it
counted the rows the log had loaded. It now shows SecurityEventsPage.total,
the number of matches in the log's window across all pages, followed by
by_outcome (cut off, refused, replaced, recorded; zero counts hidden) with
the same dot colours as the log's Action column.

- Loading more pages leaves the numbers alone; new matches count up
  (AnimatedNumber in the log's scope); switching the range jumps to the
  new values.
- While the log loads, a skeleton holds the place; if it fails, the log
  below shows the error and the header leaves the count out.
- The count and its breakdown wrap together on narrow windows.
- English says "1 match" in the singular.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a reload brings back a whole page of newer entries, the rows that
dropped off stay in place while they fade out and the new rows are listed
after them, so the same day was split in two, with duplicate React keys
on the day headings. Group the rows by day instead of by adjacency.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fylorn
fylorn merged commit 2fa65fd into dev Sep 25, 2026
4 checks passed
@fylorn
fylorn deleted the ui/security-core-data branch September 25, 2026 05:58
fylorn added a commit that referenced this pull request Sep 25, 2026
`pnpm shots` on dev 2fa65fd changes five scenes, because #202 and #203
changed what they show:

- remote-add: the connection test reports core 0.48.0, the version the
  app now pins (a 0.47.0 server would be a version mismatch). The alt
  text in both READMEs says 0.48.0.
- traffic: the request in progress shows its status code and token
  count, replayed from /in-flight.
- routing and dry-run: the map marks the upstream with a request in
  flight.
- security: the header counts the entries by outcome.

The other alt texts still describe their images. The website copies in
docs/screenshots/web/ are regenerated with them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fylorn added a commit that referenced this pull request Sep 25, 2026
`pnpm shots` on dev 2fa65fd changes five scenes, because #202 and #203
changed what they show:

- remote-add: the connection test reports core 0.48.0, the version the
  app now pins (a 0.47.0 server would be a version mismatch). The alt
  text in both READMEs says 0.48.0.
- traffic: the request in progress shows its status code and token
  count, replayed from /in-flight.
- routing and dry-run: the map marks the upstream with a request in
  flight.
- security: the header counts the entries by outcome.

The other alt texts still describe their images. The website copies in
docs/screenshots/web/ are regenerated with them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fylorn added a commit that referenced this pull request Sep 25, 2026
`pnpm shots` on dev 2fa65fd changes five scenes, because #202 and #203
changed what they show:

- remote-add: the connection test reports core 0.48.0, the version the
  app now pins (a 0.47.0 server would be a version mismatch). The alt
  text in both READMEs says 0.48.0.
- traffic: the request in progress shows its status code and token
  count, replayed from /in-flight.
- routing and dry-run: the map marks the upstream with a request in
  flight.
- security: the header counts the entries by outcome.

The other alt texts still describe their images. The website copies in
docs/screenshots/web/ are regenerated with them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fylorn added a commit that referenced this pull request Sep 25, 2026
…hots (#201)

* docs: rewrite the READMEs for the current app and use the new screenshots

The READMEs showed screenshots of the old sidebar, including a Findings
page that no longer exists, and said nothing about connecting to a
remote core, the interface languages or the system tray. Both are
rewritten in the same structure, from what the code does today:

- An opening in the approved register, then the platforms, the
  interface languages and in-app updates.
- One section per page (Overview, Traffic, Clients, Keys, Upstreams,
  Routing, Security, MCP, Settings). Security is written from
  tw-config's guard defaults and built-in rules, MCP from tw-adopt's
  targets and tw-scan's sources, and the list of system notifications
  from src-tauri/src/notices/rules.rs.
- "Connecting to a remote core": Settings > Connection, the pages that
  always act on this machine (Clients, MCP), where the connection key
  is kept, what changes while connected; links to Core's server
  deployment guide.
- Layout: the control channel over a unix socket, a loopback port or a
  remote TCP port, each behind the Noise NNpsk0 handshake, replacing
  the per-launch credential the old text described.

Images now come from the committed pipeline: the zh README uses
docs/screenshots/zh/, the English one docs/screenshots/en/, both with
the light/dark <picture> switch, and the overview sits in the
introduction of both. A fresh `pnpm shots` run on this base produced
identical files, so no image changes. The 28 old root-level images are
deleted; nothing in this repository, the website or the organization
profile links to them (the latter two keep their own copies).

Build from source now fetches twcore first: Tauri checks declared
resources at compile time, so `pnpm tauri dev` fails in a fresh
checkout without it, while CONTRIBUTING said it needed nothing. Also
spell "Apple silicon", and give package.json and Cargo.toml a
description that names the platforms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: name the platforms before the gateway in the English opening

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: say how a new version is announced, and give the mismatch command

The Updates section said a small window appears when there is a new
version. The automatic check sends a system notification instead
(updater.rs: update_loop -> notify_update), and only when notices are
set to system notifications. The update window opens from that
notification, from the Install Version item that replaces Check for
Updates in the menu bar or tray menu, and from Settings > About. The
notifications paragraph now mentions the new-version notification too.

For a Homebrew installation the check reads the tap's cask, so the
sentence that said when the window appears now says when a new version
is reported.

Connecting to a remote core: when the server's core version differs,
the app gives `sudo twcore upgrade --version <version> --restart`, which
installs the expected version whether it is newer or older than the
installed one (#204). Both languages say the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: re-shoot the screenshots on core v0.48.0

`pnpm shots` on dev 2fa65fd changes five scenes, because #202 and #203
changed what they show:

- remote-add: the connection test reports core 0.48.0, the version the
  app now pins (a 0.47.0 server would be a version mismatch). The alt
  text in both READMEs says 0.48.0.
- traffic: the request in progress shows its status code and token
  count, replayed from /in-flight.
- routing and dry-run: the map marks the upstream with a request in
  flight.
- security: the header counts the entries by outcome.

The other alt texts still describe their images. The website copies in
docs/screenshots/web/ are regenerated with them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: re-shoot five scenes after the overview, routing and traffic changes; fetch-core.sh says dev builds need it too

Overview, routing, dry-run, remote-switcher and traffic changed on dev
(#206, #207, #208). The comment at the top of fetch-core.sh still said a
dev build needs neither the network nor resources/twcore; the Tauri build
checks the resource at compile time, so a fresh checkout runs the script
once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@fylorn fylorn mentioned this pull request Sep 25, 2026
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