feat(tags): improve tag browsing excerpts#998
Merged
Conversation
Contributor
There was a problem hiding this comment.
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/excerptpackage containingFromContent,FromBody,NormalizeMarkdownBody, andPlainTextFromMarkdown;internal/tagsandinternal/searchnow delegate to it. Search also falls back to a generated excerpt when FTS5 returns an empty snippet. TagsPaneladds an accordion of all tags with active/related/muted styling, contextual count fetch viafetchTags('', 200, activeTags), and supporting state/effects.- New CSS for
browse-tags__*styles and a new test fileinternal/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.
4be94cf to
63e3894
Compare
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.
d26a92f to
1462a86
Compare
0a8eeb1 to
e2b3a80
Compare
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.
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.
Add a shared excerpt module for markdown normalization and search text extraction.
Extend the tags panel with browsable tag filters and related tag counts.