Skip to content

feat(event-log): Charts view (Phase 14, #846) - #985

Open
adamgell wants to merge 30 commits into
feat/event-logs-phase3-829from
feat/event-logs-charts-846
Open

adamgell wants to merge 30 commits into
feat/event-logs-phase3-829from
feat/event-logs-charts-846

Conversation

@adamgell

@adamgell adamgell commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Closes #846. Part of #823. Stacked on #929 (Phase 3): review the commits after its merge base; this PR retargets to main when #929 merges.

What it adds

The Charts tab of the Event Logs view bar now draws a chart view instead of the Phase 3 placeholder. It loads lazily, so the chart code stays out of the initial bundle.

  • A grid of six tiles: Events (with the loaded window, for example "Events (24 h)"), Errors, Warnings, Critical, Distinct event IDs and Correlation chains.
  • Four figures in a 2 x 2 grid:
    1. Events by channel: one bar per channel, longest first, up to 12 channels.
    2. Top event IDs: the 9 most frequent event ID and provider pairs, with a caption that names the active hide rules ("excluding 7036 / 16384").
    3. Activity by hour and channel: a heat map of 24 hour columns by channel, with a None / Fewer / More legend.
    4. Errors and warnings per hour: 24 stacked columns with errors below warnings, a legend and a "Peak: HH:00 (n)" line.
  • Every figure has an aria-label. The heat map and the hourly figure each carry a visually hidden data table.
  • While a load runs the workspace passes no rows, and the view says "Loading events...". It says "No events to chart. Load events or relax the filters." only when the settled state has no load running: a load that starts while it shows replaces it within 75 ms, and a load that ends with zero rows keeps "Loading events..." for up to 75 ms first. The load state, the window label and the clock named in the heat map and hourly captions settle together with the data they describe (one 75 ms throttle), so a load that ends with rows never shows "No events to chart" first.
  • A chart refreshes at most every 75 ms while events stream in.

Main modules:

  • src/workspaces/event-log/evtx-chart-data.ts: pure derivations (tile values, channel bars, top IDs, hour by channel matrix, hourly counts, peak, unplaced counts). No React, no colors, no stores.
  • src/workspaces/event-log/EvtxChartsView.tsx: the view and its figures, default export for React.lazy.
  • src/workspaces/event-log/evtx-channel-order.ts: channel names in the channel pane's display order, so a channel gets the same color index in the pane and in the figures.
  • src/workspaces/event-log/EventLogWorkspace.tsx: one lazy import, the view-map entry for charts, and the inputs the view needs.
  • e2e/screenshots/event-logs.spec.ts: an "event-logs charts view" capture.

Evidence rules

The claims the view makes, and the rule behind each:

  • No event is ever drawn in hour 0 for lack of a time. A record is placed only when its epoch is non-zero, or when its text, trimmed as Rust's str::trim trims it (U+FEFF is kept, U+0085 is stripped), parses the way the engine parses it (parsed_timestamp_epoch in src-tauri/src/event_log/timeline.rs): RFC 3339 with "T", "t" or a space between date and time and a U+2212 minus sign accepted in the offset only, or a zone-less T ISO form read as UTC. Every field is range-checked before Date.parse sees the text, so no field's range is left to the browser engine: the day must exist in its month, hour is 00 to 23, minute and second are 00 to 59, and an offset is +HH:MM or -HH:MM with HH 00 to 23 and MM 00 to 59; the fraction is cut or padded to three digits. Second 60 stays unplaced on every engine, because JavaScript cannot represent it. Display text is never guessed at. Everything else is counted as unplaced and the figure says so.
  • Figure 3 counts unplaced events only ("n events have no timestamp and are not placed"). Figure 4 counts unplaced errors and warnings of both origins, because those are the rows it would draw.
  • A tile sublabel exists only when it can be derived from the input (D15). No comparative sublabel ("vs prior 24 h") is produced; that needs Phase 17b's comparison.
  • Archived text-log lines are not Windows events. They count in the Events total, the level counts and the hourly figure, which follow the visible rows. They are not counted in anything keyed by event ID or channel: Distinct event IDs, Top event IDs, the Warnings and Critical sublabels, and figures 1 and 3. Figures 1 and 3 say "n text-log lines not shown; text logs have no channel".
  • The Warnings sublabel "Top 2 IDs = p%" divides by every warning on the tile. A text-log warning line counts in the denominator and is never a top ID.
  • The Events tile value is the visible row count. Its sublabel "{c} channels · {l} text logs" is the loaded scope. Live mode counts the channels whose load completed (loadedChannels), not every enumerated channel. Files mode counts the distinct channel names of the loaded event records: an archived text log is not a channel, a channel in several files counts once, and a file with no records adds nothing. Text logs are counted as distinct sources (file paths of attached entries plus source labels of archived text records), not as lines.
  • The window in the Events label comes from the loaded time window: "1 h", "24 h", "7 d", "30 d", or "all loaded" when no window applies.
  • The Correlation chains tile reads "n/a" when no chain model exists. Its value is Exact plus Candidate (D7). Whenever the edge input is a loaded subset, the sublabel reads "{n} exact, loaded edges only", including at zero, so a bounded preview never shows as a definite zero.
  • Figures 1 and 3 draw at most 12 channels. The rest are disclosed as "+N more channels (M events) not shown" in the figures, and the heat map's caption and hidden table say the same. The cap is an addition to spec 8.10, following the cap in spec 8.9.
  • Critical is not drawn in figure 4. It has its own tile. Figure 4 draws Error and Warning only.
  • Heat map cells use six fixed steps (D11), scaled against the largest cell. Any non-empty cell gets at least the faintest step. An empty cell has a transparent fill and a dashed accessible-stroke outline, so it is distinguishable from the faintest step in every theme. The accessible name reads "from fewer to more events", which holds on dark and light surfaces.
  • A channel's color index is its position in the channel pane's display order. A channel outside that order gets an index derived from a hash of its own name, so a filter never changes another channel's bar color. The color palette cycles every six, so an off-order channel can share a color with a pane channel; the label next to each bar identifies it.
  • The top IDs caption lists only hide rules that filter. An empty rule or an invalid Event ID list is not reported as an exclusion.
  • Spike decision (spec 8.10, library choice). Figures 3 and 4 are token-styled markup (HTML and CSS), under spec 8.10's fallback rule that applies when the Fluent charts cannot match the mockup's density without style overrides beyond their public props. Evidence recorded in the header of EvtxChartsView.tsx with @fluentui/react-charts 9.3.27: HeatMapChart interpolates a continuous d3 scale instead of drawing six fixed steps and has no cell gap, radius, cell size or empty-cell props. VerticalStackedBarChart was built and captured through public props and still needed overrides outside them: its height is ignored, its styles class names are not applied to the axes, its Y axis cannot be hidden, and it sorted numeric-looking x values wrongly. Figures 1 and 2 are token-styled rows. Spec 8.10 names "token-styled SVG" as the fallback; the code uses HTML and CSS markup.
  • No correlation edges were added to the Event Logs e2e fixture. The issue asked for them only if the view needed them, and it does not (the decision is recorded on Event Logs UI phase 10: Correlation view #839).
  • evtx-channel-order.ts was added without changing ChannelPicker.tsx. It copies the pane's ordering logic; its test renders the real pane and compares, so a drift in either shows up. Phase 8 (Event Logs UI phase 8: Channel pane restyle #837) adopts it.
  • Refresh timing is a deliberate deviation from spec 11, which words it as a debounce. A restarting debounce never fires while batches arrive faster than the interval, so counts would go stale under a busy stream. The view uses the first value at once, then applies the latest value once 75 ms have passed since the first change not yet applied. The deviation is recorded at CHART_DATA_THROTTLE_MS.

Scope

11 files changed against #929: 9 source files (EventLogWorkspace.tsx, EventLogWorkspace.layout.test.tsx, EvtxChartsView.tsx and its test, evtx-channel-order.ts and its test, evtx-chart-data.ts and its test, e2e/screenshots/event-logs.spec.ts) plus 2 PNGs. That is over the 5-file limit, so the CLAUDE.md issue-lane exception applies. The issue lists 4 files; the added files are the channel order helper (the capture criterion on the issue and the channel color rule in spec 6.3), the workspace wiring, and the e2e capture the issue comments require. No Rust, store, package or token files change.

Known limits

Review findings that are out of this lane's scope, or recorded rather than fixed:

Reviews

Five review rounds on this lane: round 1 at 097e02ab (10 findings), verification 1 at ee610a87 (10), verification 2 at c0a905fb (4), verification 3 at d4ca3df4 (3, all low), and the final verification at ec99786d (4 low, 2 nits). The final verification found verification 3's two classes still open: the first in one place (the load-state copy changed up to 75 ms before its data), the second in two (minute, second and offset ranges reached Date.parse; JavaScript's trim removed U+FEFF, which the engine keeps). They are fixed in 478dce29 (load state, window label and clock settle with the data), d332b466 (every field range-checked) and d1b09f12 (edge whitespace trimmed as the engine trims it), with 7904e5b3 pinning each throttled field, 642b942d (a three-digit fraction), 1df5b46c (the throttle applies the latest value and clears its wait) and 4e5430d1 (comments say throttled). Verification at 4e5430d1 closed all six findings at the class level and found only two body sentences to correct, corrected here.

Verification

At head 4e5430d1ca1857a70df53290f81978195f83598f:

  • npx tsc --noEmit: exit 0.
  • npx vitest run --maxWorkers=3: exit 0, 175 test files, 2960 tests passed, no "Unhandled Errors". Each of the 7 fix commits was also checked out alone: tsc and the event-log tests pass at every one.
  • git diff a0b70cd6 --check: exit 0. No U+2013 or U+2014 in added lines. No real account name or machine identifier in added lines.
  • npx playwright test -c playwright.screenshots.config.ts --list: exit 0, 11 tests in 2 files, including "event-logs charts view". Screenshot and e2e runs were not executed locally (port 1420 is shared across lanes).
  • src-tauri is untouched, so no Rust gates apply.

Screenshots

Two captures are new in this PR: screenshots/event-logs-charts.png (the page at 1440 x 900) and screenshots/event-logs-charts-view.png (the full Charts view element, grown to its content). No existing PNG changes. PNGs are regenerated in Main's capture session before merge.

🤖 Generated with Claude Code

adamgell and others added 23 commits October 10, 2026 19:55
Pure derivations for spec 8.10: KPIs with derivable sublabels only, channel
bars, top event IDs with the hide-rule qualifier, the hour by channel matrix
and hourly errors and warnings with the peak. Events without a timestamp are
counted as unplaced, never placed in hour 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Token-styled KPI grid and 2x2 figures per spec 8.10, taking plain data so
wiring is one line. Heat-map empty cells have a defined outline token, tested
against the faintest heat step in all seven themes. Heat map and hourly
figures carry visually hidden data tables.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and debounce (#846)

Unplaced events follow the engine's parsed_timestamp_epoch rule, text-log
lines stay out of event ID and channel derivations, the loaded channel and
text log counts come from the caller, the chains qualifier shows for any
partial edge set, figure 3 discloses the channel cap, off-order channel colors
no longer depend on visibility, and chart data is debounced at 75 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Errors and warnings per hour is drawn by the Fluent chart through public
props, with a fixed-height host and host CSS for the two things the props do
not cover in 9.3.27. The spike record is rewritten to match what was observed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds the Charts entry to the workspace view map with React.lazy, fed by the
visible records, the chain model built from the first timeline page, the
quick filter as hide rule, the channel list and the analysis log item count.
Adds the Charts view capture to the Event Logs screenshot spec.

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…licate import (#846)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This reverts commit 4275f54. Main's ruling: spec 8.10 falls back to
token-styled markup when the chart needs overrides beyond public props.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oncrete spike record (#846)

Rewrites the library spike record with the 9.3.27 evidence, labels the hourly
axis HH:00 every six hours, names the workspace chain model for Phase 10c, and
updates the rehydration test now that Charts is a real view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd (#846)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…arity (#846)

The Warnings share divides by every warning on the tile, figures 1 and 3
disclose the text-log lines they leave out (and figure 3's unplaced note counts
events only), placement accepts the space separator chrono accepts, and the
spike record drops the hex-only clause. Adds window, text-log source and loaded
channel helpers, and tests that fail under a UTC-only local hour and under the
text-log guards being removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nnels and window (#846)

Adds a pure channel-order helper that matches the channel pane (checked
against the real pane), and feeds the Charts view the distinct text-log
sources, the per-mode loaded channel count and the window label, with
workspace tests for each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…w element capture (#846)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd docs (#846)

Files mode counts distinct event-record channels (an archived text log is not
a channel, shared names count once, empty files add none), figure 4's unplaced
note counts errors and warnings, hour 24 stays unplaced and the U+2212 minus
sign is accepted as chrono does, and the prop docs and spike record are
corrected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…#929 (#846)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…head (#846)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ity, gated counts (#846)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… of restarting (#846)

A restarting debounce never fired under a stream faster than 75 ms, so the
charts showed stale counts during a busy live tail. The wait now starts at the
first change and fires no later than 75 ms after it. The spec 11 deviation is
recorded at the constant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added enhancement New feature or request feature New feature labels Oct 22, 2026
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review: 1
  • main

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@adamgell adamgell mentioned this pull request Oct 22, 2026
4 of 34 tasks
adamgell and others added 3 commits October 22, 2026 11:45
… the data (#846)

The throttled chart data and the live `loading` prop changed in different
renders, so a load that ended with rows said "No events to chart" for up to
75 ms before the figures drew. The same split let the window label ("7 d")
and the clock in the figure qualifiers ("hour of day, UTC") change over
counts and buckets of the previous window and clock.

The throttle now carries one memoized snapshot of the input, `loading` and
`windowLabel`, and the view reads all three from the settled value, so the
copy and the data change in the same render. The cost is accepted: a load
that ends with zero rows says "Loading events..." for up to 75 ms before
"No events to chart".

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…nge (#846)

The first F1 tests rebuilt every prop on each rerender, so a change to the
input memo or the snapshot memo dependencies was masked by the other props
changing too. Flip only `loading`, only `windowLabel` and only
`timeZoneMode` against a shared base so a missing memo dependency fails.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…Date.parse (#846)

Only the hour and the day were range-checked, so an out-of-range minute,
second or offset reached Date.parse and was accepted or rejected by whatever
the engine does. The RFC 3339 and zone-less patterns now allow minute and
second 00 to 59 and an offset of +HH:MM or -HH:MM with HH 00 to 23 and MM
00 to 59, so no field's range is left to Date.parse. Second 60 stays
unplaced on every engine, the declared narrowing.

The negative tests replace Date.parse with a parser that accepts anything
and assert it is never called, so they fail on a lenient engine, not only on
the one the suite runs in. Boundary tests keep minute 59, second 59 and
offsets up to 23:59 placed with the real parser.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
adamgell and others added 4 commits October 22, 2026 11:52
… JavaScript does (#846)

The engine calls Rust's `str::trim` before parsing, which strips the Unicode
White_Space set. String.prototype.trim differs in two code points: it strips
U+FEFF, which Rust keeps, and keeps U+0085, which Rust strips. So a timestamp
with an edge U+FEFF was placed in an hour the engine leaves unplaced, and one
with an edge U+0085 was unplaced where the engine places it.

The text is now trimmed over the Rust set, spelled out as escapes (checked
against rustc's char::is_whitespace over every code point: no mismatch).
Tests cover all 25 Rust code points on both sides, U+FEFF on either edge
(unplaced), and code points neither engine trims.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
chrono accepts any number of fraction digits and truncates to milliseconds.
The ES date-time format has exactly three, so a one-digit or six-digit
fraction was the last field whose handling was left to the engine. The
fraction is now cut or padded to three digits before parsing, which also
truncates instead of rounding, as the engine does.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…its wait (#846)

The stream test only checked when the figures updated, not what they showed.
It now asserts each update shows the count at that moment and the last wait
applies the final count and leaves no timer. A new test covers unmount: the
pending wait is cleared and a remount shows the current value at once.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The chart data throttles from the first change instead of restarting a
debounce. Two comments still called it debounced. The doc comment on
CHART_DATA_THROTTLE_MS keeps the word, because it records the deliberate
deviation from spec 11's debounce wording.

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant