Skip to content

feat(reader): saved queries and named views UI (#1118) - #1152

Merged
Sinity merged 1 commit into
masterfrom
feature/feat/reader-saved-views-ui
May 17, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/feat/reader-saved-views-ui

Conversation

@Sinity

@Sinity Sinity commented May 17, 2026

Copy link
Copy Markdown
Owner

Summary

Wire the existing /api/user/saved-views substrate (shipped via #1050-#1057 under the #867 user-state umbrella) into the web reader so an operator can save the current filter chain under a name, recall it, and delete it without leaving the reader. Adds a toolbar entry-point, a Delete affordance, a naming-conflict guard, and an actionable empty state.

Problem

#1118 calls out the reader UI gap for saved views: the storage table and the HTTP envelope existed, and the Notes inspector tab could already save/open a view, but there was no way to delete an existing view from the UI, no naming-conflict UX (the SQLite UNIQUE(name) constraint would surface as an opaque error), and no toolbar-level entry-point — saved views were reachable only by opening the Notes inspector tab on a selected conversation. The acceptance criteria require list/recall/delete affordances, an empty state distinct from a populated one, and naming-conflict handling.

Solution

  • polylogue/daemon/web_shell_workspace.py: adds a Saved views <select> and a Save view button to the workspace toolbar (mirroring the existing Restore workspace select pattern). Populates the select in renderWorkspaceToolbar with state.savedViews, disables it when empty, and falls back through applySavedView → loadConversations + loadFacets. Moves saveCurrentView and adds deleteSavedView here. saveCurrentView now trims whitespace, rejects empty names, and detects a naming clash against state.savedViews locally — prompting window.confirm to overwrite (DELETE the existing view_id, then POST) or abort. deleteSavedView confirms by name before issuing the DELETE.
  • polylogue/daemon/web_shell.py: the Notes inspector list now renders a per-row Delete button next to Open; the empty state is reworded to name the next action (Click "Save current view" to name the current filter chain.).
  • tests/unit/daemon/test_web_reader.py: adds TestReaderSavedViewsUI with five tests — toolbar entry-point presence, naming-conflict UX strings, delete-button wiring, actionable empty-state copy, and an HTTP roundtrip (save → list → delete) that catches regressions in the new toolbar surface.

The MCP coverage criterion (#1118 AC: "At least one MCP read tool exposes saved views by id") was already satisfied by list_saved_views / save_saved_view / delete_saved_view in polylogue/mcp/server_mutation_tools.py — no change there.

The naming-conflict handling is client-side rather than at the HTTP envelope. The shared user_state_http.py is owned by another lane per the dispatch plan and the existing save_view SQL is an INSERT OR REPLACE BY view_id; the UNIQUE constraint is on name, which means a different view_id for the same name would 500. Detecting the conflict client-side keeps the UX coherent without changing the contract.

polylogue/daemon/web_shell.py net change is −13 LOC (functions moved into the workspace asset module), keeping the file under the 1100-line budget enforced by verify-file-budgets.

Verification

nix develop -c pytest tests/unit/daemon/test_web_reader.py -q
# 62 passed in 14.74s (5 new under TestReaderSavedViewsUI)

nix develop -c pytest tests/unit/daemon -q
# 389 passed in 13.45s

nix develop -c devtools verify --quick
# exit_code: 0  (format + lint + mypy + render-all + manifest/lifecycle/topology lints)

devtools verify (full pytest path) requires devtools verify --seed-testmon on this fresh worktree; the affected unit suite was exercised directly above. render-pages was re-emitted to clear a pre-existing .cache/site drift unrelated to this PR.

Closes #1118

Wire the existing /api/user/saved-views substrate into the web reader
so saved views can be created, recalled, and deleted from the UI
without leaving the workspace.

Adds a "Saved views" select and "Save view" button to the workspace
toolbar (mirroring the existing Restore workspace pattern), a Delete
button per saved view in the Notes inspector list, a naming-conflict
guard that prompts the operator before overwriting an existing view,
and an actionable empty-state message that names the next step.

Tests assert toolbar entry presence, naming-conflict UX, delete
button wiring, empty-state copy, and an end-to-end roundtrip the UI
relies on (save → list → delete).

Ref #1118

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented May 17, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Sinity has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 59 minutes and 30 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 65b5c7ae-ffbf-4344-9d0d-94676e665f02

📥 Commits

Reviewing files that changed from the base of the PR and between c599586 and 8d46fbe.

📒 Files selected for processing (3)
  • polylogue/daemon/web_shell.py
  • polylogue/daemon/web_shell_workspace.py
  • tests/unit/daemon/test_web_reader.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/feat/reader-saved-views-ui

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

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

@Sinity
Sinity merged commit 1fe7487 into master May 17, 2026
3 checks passed
@Sinity
Sinity deleted the feature/feat/reader-saved-views-ui branch May 17, 2026 04:35

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d46fbed57

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread polylogue/daemon/web_shell_workspace.py Resolved
@Sinity

Sinity commented Sep 30, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

Only the rows listed above are dispositioned. Held findings remain open.

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.

feat(reader): saved queries and named views in web UI

1 participant