Skip to content

feat(tags): improve tag browsing excerpts#998

Merged
perber merged 18 commits into
mainfrom
feat/tags-browse-and-excerpts
May 21, 2026
Merged

feat(tags): improve tag browsing excerpts#998
perber merged 18 commits into
mainfrom
feat/tags-browse-and-excerpts

Conversation

@perber
Copy link
Copy Markdown
Owner

@perber perber commented May 17, 2026

Add a shared excerpt module for markdown normalization and search text extraction.

Extend the tags panel with browsable tag filters and related tag counts.

Copilot AI review requested due to automatic review settings May 17, 2026 22:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Centralizes markdown→plain-text/excerpt logic into a new internal/core/excerpt package shared by tags and search, and expands the Tags panel with a browsable "All Tags" accordion that shows total counts and contextual (related) counts for the active selection.

Changes:

  • New internal/core/excerpt package containing FromContent, FromBody, NormalizeMarkdownBody, and PlainTextFromMarkdown; internal/tags and internal/search now delegate to it. Search also falls back to a generated excerpt when FTS5 returns an empty snippet.
  • TagsPanel adds an accordion of all tags with active/related/muted styling, contextual count fetch via fetchTags('', 200, activeTags), and supporting state/effects.
  • New CSS for browse-tags__* styles and a new test file internal/core/excerpt/excerpt_test.go; removal of the duplicated normalization tests in search.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
internal/core/excerpt/excerpt.go New shared excerpt/normalization module.
internal/core/excerpt/excerpt_test.go Tests for the new module.
internal/tags/excerpt.go Delegates to the shared module.
internal/tags/excerpt_test.go Replaces removed local constant with literal 190.
internal/search/sqlite_index.go Uses shared excerpt module; adds content fallback for empty FTS snippets.
internal/search/sqlite_index_test.go Removes duplicate normalization tests; adds highlight + stripped-markdown assertions.
ui/leafwiki-ui/src/features/tags/TagsPanel.tsx Adds available/contextual tag fetching and accordion UI.
ui/leafwiki-ui/src/index.css Adds browse-tags__* styles for the new UI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/core/excerpt/excerpt.go
Comment thread ui/leafwiki-ui/src/features/tags/TagsPanel.tsx Outdated
Comment thread ui/leafwiki-ui/src/features/tags/TagsPanel.tsx Outdated
Comment thread ui/leafwiki-ui/src/features/tags/TagsPanel.tsx Outdated
Comment thread ui/leafwiki-ui/src/features/tags/TagsPanel.tsx Outdated
Comment thread internal/tags/excerpt_test.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 29 out of 29 changed files in this pull request and generated 6 comments.

Comment thread ui/leafwiki-ui/src/features/search/Search.tsx Outdated
Comment thread ui/leafwiki-ui/src/features/search/Search.tsx Outdated
Comment thread internal/wiki/search/use_cases.go
Comment thread internal/wiki/search/use_cases.go
Comment thread internal/tags/excerpt_test.go Outdated
Comment thread internal/wiki/pagesave/search_effect.go
@perber perber force-pushed the feat/tags-browse-and-excerpts branch from 4be94cf to 63e3894 Compare May 20, 2026 18:55
perber added 12 commits May 21, 2026 17:09
Add a shared excerpt module for markdown normalization and search text extraction.

Extend the tags panel with browsable tag filters and related tag counts.
Preserve stable search tag hooks in the UI and update the tags E2E flow to match the current combined search panel. Also harden the logout interaction used by history E2E teardown to reduce dropdown click flakiness.
Align the remaining page spec with the current combined search panel so tag-based assertions no longer depend on the removed dedicated tags tab.
Make the search tag accordion assertion resilient to both fresh and already-seeded E2E data by accepting the valid no-tags and has-tags states.
Open the search tag accordion before clicking tag filters so the combined query-and-tag search flow stays stable in CI.
Apply the search query before selecting the tag facet so the combined query-and-tag test uses the current result facets instead of depending on the initial global tag list timing.
Add a reusable SearchView helper to open the tag facet accordion and use it in the full-result-set facet test so CI no longer depends on accordion visibility timing.
Keep inactive search panels from rewriting the URL, render tag loading feedback while tags are still loading, and normalize tag-only search pagination bounds before slicing results. Also tie the excerpt truncation test to the shared excerpt rune limit constant.
Retry the search input until the expected query value sticks so panel activation races do not wipe the typed query during E2E runs. Also relax the tag accordion assertion to accept the loading and error states that are now intentionally rendered.
@perber perber force-pushed the feat/tags-browse-and-excerpts branch from d26a92f to 1462a86 Compare May 21, 2026 15:10
@perber perber force-pushed the feat/tags-browse-and-excerpts branch from 0a8eeb1 to e2b3a80 Compare May 21, 2026 17:12
perber and others added 4 commits May 21, 2026 19:22
The sort dropdown item was restricted to sections only, but pages can
also have sub-pages that need sorting. SortPagesDialog already handles
both node kinds — this restores the original behaviour lost during the
dropdown refactor.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The root TreeView sort button is a <button> element; Radix DropdownMenuItem
renders as <div role="menuitem">. Using [role="menuitem"][data-testid="..."]
uniquely identifies the open dropdown item in both the open-check and
the click, avoiding false-positive matches against the always-visible
root sort button.

Same fix applied to the move button for consistency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Stabilize flaky page-related end-to-end tests by using API-backed setup for move and sort flows, hardening tree action menu interactions, and aligning the search query URL test with the real routed page path.

Keep the search input lag fix while restoring URL-to-input synchronization when the search panel becomes active.
Use a stable API-backed path for deleting unrelated pages in E2E, harden tree action menu opening for delete actions, and quarantine the flaky editor-delete guard case with a temporary fixme so it no longer blocks the suite.
@perber perber merged commit 7471ab1 into main May 21, 2026
7 of 8 checks passed
@perber perber deleted the feat/tags-browse-and-excerpts branch May 21, 2026 22:11
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.

2 participants