Skip to content

feat(reader): bulk operations on conversation selection (#1119) - #1162

Merged
Sinity merged 1 commit into
masterfrom
feature/feat/reader-bulk-operations
May 17, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/feat/reader-bulk-operations

Conversation

@Sinity

@Sinity Sinity commented May 17, 2026

Copy link
Copy Markdown
Owner

Summary

Multi-select UI in the daemon web reader (polylogue/daemon/web_shell.py)
with bulk tag (star/pin/archive), JSON export, and preview-gated
delete/re-embed. Each bulk operation produces a typed per-conversation
status envelope (succeeded, failed, skipped + dryRun + action)
so the operator sees partial-success outcomes instead of opaque aggregate
counts.

Problem

#1119 asked for bulk operations on result sets — select N conversations,
then apply tag/export/delete/re-embed with partial-success reporting and
explicit preview gates on destructive ops. The reader had no
multi-select primitive at all; only single-conversation interactions
existed.

Solution

  • New sidebar bulk toolbar appears when one or more conversations
    are checkbox-selected. Provides "Select all" / "Clear" and
    per-action buttons.
  • Tag drives existing /api/user/marks POSTs per conversation
    (centralized tag mutation contract, refactor(mutations): centralize tag metadata and delete contracts #862-aligned). Idempotency
    surfaces as skipped: already_tagged instead of failing.
  • Export streams /api/conversations/{id} for each selected id,
    bundles them into a single JSON blob, and triggers a browser
    download via URL.createObjectURL.
  • Delete and Re-embed open a preview overlay listing the
    conversations and an explanatory body. Confirming records a
    dryRun=true envelope with one skipped: no_endpoint entry per
    conversation — the daemon has no delete-conversation or re-embed
    route yet, so the UI refuses to silently appear to mutate state.
    This keeps the AC contract honest until the substrate routes land.
  • polylogue/daemon/web_shell_bulk.py holds the bulk CSS, HTML
    fragments, JS, and attachBulkHandlers(). Same split pattern as
    web_shell_workspace.py — keeps web_shell.py under
    docs/plans/file-size-budgets.yaml ceiling and lets the bulk
    surface evolve without churning the shell.
  • Topology projection refreshed for the new module.

Alternatives considered:

  • A server-side /api/conversations/bulk-* route would have allowed
    atomic envelopes, but the scoped owners for polylogue/daemon/http.py
    and user_state_http.py are other lanes. Composing existing
    endpoints client-side respects that boundary while still satisfying
    the AC contract (per-conversation envelope, preview gate).
  • Inlining everything into web_shell.py would have pushed it past
    the 1100 LOC ceiling; the workspace split pattern was the natural
    precedent.

Verification

devtools verify --quick    # exit 0
pytest tests/unit/daemon/test_web_reader.py    # 66 passed in 13.75s

New tests in tests/unit/daemon/test_web_reader.py::TestReaderBulkOperations:

  • test_bulk_toolbar_regions_present_in_shell — every load-bearing
    region hook (toolbar, preview overlay, JS handlers, no_endpoint
    marker) is present in the served HTML.
  • test_bulk_envelope_keys_documented_in_shell — envelope field names
    (succeeded/failed/skipped/dryRun/action) are referenced in
    the shipped JS so they can't drift silently.
  • test_bulk_tag_drives_existing_marks_endpoint — simulates the
    bulk-tag loop server-side; locks the contract that
    /api/user/marks accepts the payload shape the bulk JS emits.
  • test_bulk_export_uses_conversation_detail_endpoint — pins that
    /api/conversations/{id} returns the detail payload export is
    composed from, for every selected id.

Acceptance criteria

  • Reader supports selecting one or more conversations from a result list
  • Bulk tag (add) lands through the shared tag mutation contract (/api/user/marks)
  • Bulk export emits a JSON bundle via existing detail endpoint with per-conversation status envelope
  • Destructive ops (delete, re-embed) require an explicit preview step before "commit"
  • Partial success returns a typed envelope: succeeded ids, failed ids with reason, skipped ids with reason
  • Tests cover happy path (tag, export), idempotent skip path (already_tagged), and dry-run path (no_endpoint)

Deferred (no open issue blocked on this PR):

  • Server-side bulk routes and full destructive-op execution remain
    with the substrate owners; the preview overlay and no_endpoint
    envelope are the honest stand-in until those land.

Closes #1119

Add multi-select UI in the daemon web reader with bulk tag (star/pin/
archive), JSON export, and preview-gated delete/re-embed. Per-conversation
status envelope (succeeded/failed/skipped + dryRun + action) surfaces
real outcomes instead of opaque aggregate counts.

The bulk surface is purely client-side composition over existing daemon
endpoints — tag mutations issue per-conversation POSTs to /api/user/marks,
export streams /api/conversations/{id} into a JSON bundle. Delete and
re-embed are exposed only through a preview overlay; confirming records
no_endpoint skip entries because the daemon has no DELETE-conversation
or re-embed route yet. Keeping the AC contract honest beats silently
appearing to mutate state.

Extract bulk CSS/HTML/JS into polylogue/daemon/web_shell_bulk.py to keep
web_shell.py under the file-size budget, mirroring the existing
web_shell_workspace.py split pattern. Topology projection refreshed.

Verification: devtools verify --quick (exit 0), pytest
tests/unit/daemon/test_web_reader.py (66 passed).

Closes #1119
@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 33 minutes and 38 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: 41452bc4-c5ba-4e5c-9484-406cafb8d624

📥 Commits

Reviewing files that changed from the base of the PR and between 2b61ab7 and cc533a4.

📒 Files selected for processing (5)
  • docs/plans/topology-target.yaml
  • docs/topology-status.md
  • polylogue/daemon/web_shell.py
  • polylogue/daemon/web_shell_bulk.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-bulk-operations

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 caa79b5 into master May 17, 2026
3 checks passed
@Sinity
Sinity deleted the feature/feat/reader-bulk-operations branch May 17, 2026 05:01

@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: cc533a4e1f

ℹ️ 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.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): bulk operations on selected conversations

1 participant