Skip to content

(Claude) Read the page filter's toggles and counts from the timeline's map - #398

Merged
cboos merged 5 commits into
mainfrom
dev/page-filter-toggle-map
Nov 7, 2026
Merged

cboos merged 5 commits into
mainfrom
dev/page-filter-toggle-map

Conversation

@cboos

@cboos cboos commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

The transcript page and the timeline each kept their own copy of which message types a filter toggle covers. transcript.html spelled out "Tool" → tool_use + tool_result and "User" → user + bash-input + bash-output in three places:

  • applyFilter(), which decides which cards are hidden;
  • updateMessageCounts() and updateVisibleCounts(), which write the counts on the toggles.

The timeline used its TOGGLE_GROUPS map. The copies agreed only because they had been kept in step by hand.

All three now go through the timeline's map, which the page exposes as window.timelineToggleGroups (since #392):

  • applyFilter() expands each active toggle through it.
  • The counts build each toggle's selector through it (toggleCardSelector()), so all eight toggles are counted the same way and the User and Tool special cases are gone.

The map stays in components/timeline.html. Every page that runs the filter includes that component, in both themes, and its script runs before the filter's. If the map is ever missing, the filter fails visibly rather than filtering with a stale copy.

Tests. Two new browser tests, each in both themes. Both open the page with the map rewritten as the page exports it: tool_result moves from the Tool toggle to the Assistant toggle. Then:

  • test_page_filter_expands_toggles_through_the_timelines_map turns Assistant off and checks that every timeline item is shown exactly when its card is. On the previous code the page still showed the tool_result cards that the timeline hid.
  • test_toggle_counts_follow_the_timelines_map checks each toggle's label against the cards the map gives it: "(total)" on load, and "(visible/total)" once Assistant is off. On the previous code Tool still counted the tool_result cards and Assistant did not.

Each test also checks that the rewrite reached the page, and that the fixture and the comparison are not empty, so neither can pass by checking nothing.

Snapshots. 12 transcript blocks, 9 classic and 3 minimal, each change by the same +26/−97 lines, all inside <script>. The 4 index and archive-search blocks have no filter and are unchanged. No message markup changes.

Closes #395

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Transcript filters and timeline visibility now stay synchronized, including for tool results and bash input/output messages.
    • Filter counts now reflect the message types covered by each toggle.

cboos and others added 5 commits November 7, 2026 16:05
The page filter and the timeline each keep a copy of which message types
a filter toggle covers. The new browser test rewrites the map the page
exports (tool_result moves from the Tool toggle to the Assistant
toggle) before either side reads it, turns Assistant off, and checks
that every timeline item is shown exactly when its card is. While the
page filter keeps its own copy it still shows the tool_result cards the
timeline hides, so the test fails, in both themes.

The test also checks that the rewrite reached the page, that the
fixture has top-level tool_result cards, and that the comparison
covered both tool groups, so it cannot pass by comparing nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
applyFilter() spelled out its own copy of which message types the Tool
and User toggles cover, beside the TOGGLE_GROUPS map the timeline
filters its groups by. It now expands each active toggle through that
map, read off the page as window.timelineToggleGroups, so the
transcript and the timeline cannot disagree about a toggle. The
timeline component is included by every page that runs applyFilter(),
in both themes, and its script runs first, so the map stays where it
is.

The embedded script changes on every transcript page, classic and
minimal: in the snapshots, 12 blocks each change by the same +11/-16
lines, all inside <script>; the 4 index and archive-search blocks, which
have no page filter, are unchanged. No message markup changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The counts on the User and Tool toggles still pick their cards with
selectors of their own. The new browser test opens the page with the
same rewritten map as the filter test (tool_result moved from the Tool
toggle to the Assistant toggle) and checks each toggle's label against
the cards the map gives it: "(total)" when the page loads, and
"(visible/total)" once Assistant is turned off. With the selectors of
their own, Tool still counts the tool_result cards and Assistant does
not, so the test fails, in both themes.

The filter test's setup moves into a helper the two tests share.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
updateMessageCounts() and updateVisibleCounts() counted the User and
Tool toggles with selectors of their own, the same copy of the toggle
map that applyFilter() had. Both now build each toggle's selector
through window.timelineToggleGroups (a toggleCardSelector() helper) and
treat all eight toggles alike, so the User and Tool special cases go,
and so does the last copy of the map in the page.

In the snapshots, the same 12 transcript blocks (9 classic, 3 minimal)
each change by +15/-81 lines, all inside <script>; the 4 index and
archive-search blocks are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With Assistant off, the tool_result cards the rewritten map moves under
Assistant are hidden whichever map the visible count reads, so the
count test could not tell a visible count that bypassed the map. The
test now also turns Assistant back on and Tool off, where those cards
are shown, and checks the counts again: Tool must read "(0/n)" over the
tool_use cards alone, and Assistant its full total.

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

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Explain Change →

Walkthrough

The transcript now uses the timeline’s exported toggle map for filter expansion and message counts. Browser tests modify the map and check filtering and count behavior in both themes.

Changes: Transcript and timeline filter parity

Layer / File(s) Summary
Use the timeline map for filtering and counts
claude_code_log/html/templates/components/timeline.html, claude_code_log/html/templates/transcript.html
The transcript uses window.timelineToggleGroups to expand active filters and select message cards for initial, total, and visible counts.
Verify filtering and counts with a changed map
test/test_timeline_browser.py
Browser tests change the exported map and check card visibility against timeline items and toggle counts in both themes.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Possibly related issues

Possibly related PRs

  • daaain/claude-code-log#392 — PR #392 exports window.timelineToggleGroups, which this PR uses for transcript filtering and counts.

Suggested reviewers: daaain

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive [#395] The transcript filter and counts use the timeline toggle map. The PR reports that both themes include the timeline component before the filter script and that snapshot changes stay inside scrip… Provide results for test/test_minimal_parity_browser.py and the timeline tests at the reviewed head.
Passed Passed checks: 4 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the change to use the timeline map for page filtering and toggle counts.
Out of Scope Changes check Passed [#395] The shared-map changes, timeline comment, browser tests, and reported script-only snapshot updates support filter and timeline parity. No unrelated change is identified.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files. (2 skipped: 2 unsupported.)

Full details: Linked Issues check

Explanation

[#395] The transcript filter and counts use the timeline toggle map. The PR reports that both themes include the timeline component before the filter script and that snapshot changes stay inside script blocks. New browser tests cover map-driven filtering and counts in both themes. The supplied evidence does not establish that the existing parity sweep and timeline tests pass.

Resolution

Provide results for test/test_minimal_parity_browser.py and the timeline tests at the reviewed head.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Review coverage is incomplete: 1 file could not be fully reviewed. Findings from completed review steps are included; see review info for details.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional comments: 1

claude_code_log/html/templates/transcript.html: 1

744-744: Trivial · Maintainability & Code Quality · Low value

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Guideline check: keep the toggle type list in renderer.py parity.

The messageTypes list is duplicated at Lines 744 and 827. Both now include user and tool. Per the path instructions, confirm that the timeline and the filter treat each message type consistently. Consider extracting one shared constant for this list.

Also applies to: 827-827

Source: Coding guidelines

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 071e495f-8d72-408f-93c7-50beeb88b980
Commits

Reviewing files that changed from the base of the PR and between 88426a3 and b4a5622.

Files selected for processing: 4

  • claude_code_log/html/templates/components/timeline.html
  • claude_code_log/html/templates/transcript.html
  • test/__snapshots__/test_snapshot_html.ambr
  • test/test_timeline_browser.py
Files not fully reviewed because their changes were unavailable: 1

  • test/snapshots/test_snapshot_html.ambr

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

@cboos
cboos merged commit 0f136f6 into main Nov 7, 2026
20 checks passed
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.

(Claude) The page filter keeps its own copy of the toggle map the timeline uses

1 participant