Repository navigation
feat(cli): add bulk-export verb for filter-driven JSONL dumps - #483
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 24 minutes and 42 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (13)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 23a600ceb6
ℹ️ 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".
Closes #408. Single-conversation `polylogue export <id>` requires one process per conversation; piping `list --format json | jq | xargs export` adds ~1.5s of interpreter/DB-startup overhead per conversation (50s for 35 sessions). `bulk-export` consumes the parent filter chain (`--provider`, `--since`, `--path`, `--message-role`, etc.), loads every match in one process via `ArchiveOperations.query_conversations`, and streams them to stdout — defaulting to JSONL (one conversation per line) so the output drops straight into `jq`/Python pipelines. `polylogue/cli/bulk_export.py` carries the per-format streaming logic; `query_verbs.py` registers the verb and wires it into the parent `RootModeRequest`. `--message-role` and `--dialogue-only` from the root group are honored via the existing `project_query_results()` projection. Other formats (markdown, json-array, yaml, html, etc.) concatenate with the appropriate separator. Verification: - pytest tests/unit/cli/ -q (851 passed) - devtools verify --quick (all checks passed) - live: polylogue --plain --provider claude-code --since 2026-04-25 --limit 2 bulk-export --format jsonl emits two single-line conversation JSONs in ~3s. Co-Authored-By: Claude <[email protected]>
The new ``bulk-export`` verb introduced in this PR exposes a new ``help-bulk-export`` showcase exercise via the auto-discovered help-N catalog. Commit the captured baseline and refresh ``help-main`` to include the verb in the top-level command listing. Co-Authored-By: Claude <[email protected]>
0a31116 to
17c4936
Compare
Three baselines drifted after the show/export/bulk-export fixes landed: - help-show: show verb body rewritten (#482) - help-export: gained provider:id-prefix note (#483) - help-main: show description text adjusted (#482) Master CI (showcase-verify) has been red since 6b5c392. Refreshing the baselines unblocks PRs that depend on a green master. Verification: `devtools lab-scenario verify-baselines` exits 0. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
## Summary - New query verb `polylogue bulk-export` consumes the parent filter chain (`--provider`, `--since`, `--path`, `--message-role`, etc.) and emits every matched conversation in one process. - Default `--format jsonl` writes one single-line conversation JSON per line — drops straight into `jq`/Python pipelines. - Other formats (json array, markdown, yaml, html, plaintext, obsidian, org) concatenate with appropriate separators. Closes #408. ## Problem Single-conversation `polylogue export <id>` requires one process per conversation. The user's existing pattern (`list --format json | jq -r '.[].id' | xargs polylogue export`) pays ~1.5s of Python interpreter + DB connection startup overhead per call — about 50s of pure overhead for 35 conversations. There is no way to dump every conversation matching a filter set into one analyzable corpus in a single process. ## Solution `polylogue/cli/bulk_export.py` (new): `run_bulk_export(env, request, *, output_format, fields)` builds a `ConversationQuerySpec` and a full `QueryExecutionPlan` from the parent `RootModeRequest`, calls `ArchiveOperations.query_conversations(spec)` to load every match in one go, then projects through `project_query_results()` so root-level `--message-role` / `--dialogue-only` / transform settings flow through. Output is streamed format-by-format: - `jsonl` (default): each conversation rendered as JSON, collapsed to one line. - `json`: emits a JSON array (`[`, comma-delimited entries, `]`). - `markdown`/`obsidian`/`org`/`plaintext`/`html`/`yaml`: concatenated with `\n---\n` separators between conversations (no separator before the first). `polylogue/cli/query_verbs.py`: register `bulk_export_verb` (Click command name `bulk-export`) and add `"bulk-export"` to `VERB_NAMES` so `_split_query_mode_args` recognizes it after positional filters. Tests: - `tests/unit/cli/test_bulk_export.py` (new): 6 focused tests covering the JSONL stream, zero-result behavior, markdown separator placement, the verb's CLI dispatch path, `VERB_NAMES` membership, and field-pass-through. - `tests/unit/cli/test_query_verbs_runtime.py`: extend the verb-runtime suite with a parent-request capture test for `bulk-export`. - `tests/unit/cli/test_click_app.py`: extend the registered-commands assertion. - Snapshots refreshed via `--snapshot-update`; `docs/plans/topology-target.yaml` and the cli/quality/verification reference docs regenerated by `devtools render-all`. Out of scope (deferred): a tar-of-markdown-files mode, streaming results from disk (current path materializes the full match set in memory; sufficient for the issue's ~35-session use case, room to revisit if memory becomes a constraint on larger corpora). ## Verification ``` nix develop -c pytest tests/unit/cli/ -q # 851 passed nix develop -c devtools verify --quick # all checks passed ``` End-to-end: ``` $ time polylogue --plain --provider claude-code --since 2026-04-25 --limit 2 bulk-export --format jsonl | head -1 | cut -c1-160 {"id":"claude-code:8d821a23-...","provider":"claude-code","title":"investigate open issues and propose a set you'd tackle next, ... real 0m3.10s ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <[email protected]>
|
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. |
|
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. |
Summary
polylogue bulk-exportconsumes the parent filter chain (--provider,--since,--path,--message-role, etc.) and emits every matched conversation in one process.--format jsonlwrites one single-line conversation JSON per line — drops straight intojq/Python pipelines.Closes #408.
Problem
Single-conversation
polylogue export <id>requires one process per conversation. The user's existing pattern (list --format json | jq -r '.[].id' | xargs polylogue export) pays ~1.5s of Python interpreter + DB connection startup overhead per call — about 50s of pure overhead for 35 conversations. There is no way to dump every conversation matching a filter set into one analyzable corpus in a single process.Solution
polylogue/cli/bulk_export.py(new):run_bulk_export(env, request, *, output_format, fields)builds aConversationQuerySpecand a fullQueryExecutionPlanfrom the parentRootModeRequest, callsArchiveOperations.query_conversations(spec)to load every match in one go, then projects throughproject_query_results()so root-level--message-role/--dialogue-only/ transform settings flow through. Output is streamed format-by-format:jsonl(default): each conversation rendered as JSON, collapsed to one line.json: emits a JSON array ([, comma-delimited entries,]).markdown/obsidian/org/plaintext/html/yaml: concatenated with\n---\nseparators between conversations (no separator before the first).polylogue/cli/query_verbs.py: registerbulk_export_verb(Click command namebulk-export) and add"bulk-export"toVERB_NAMESso_split_query_mode_argsrecognizes it after positional filters.Tests:
tests/unit/cli/test_bulk_export.py(new): 6 focused tests covering the JSONL stream, zero-result behavior, markdown separator placement, the verb's CLI dispatch path,VERB_NAMESmembership, and field-pass-through.tests/unit/cli/test_query_verbs_runtime.py: extend the verb-runtime suite with a parent-request capture test forbulk-export.tests/unit/cli/test_click_app.py: extend the registered-commands assertion.--snapshot-update;docs/plans/topology-target.yamland the cli/quality/verification reference docs regenerated bydevtools render-all.Out of scope (deferred): a tar-of-markdown-files mode, streaming results from disk (current path materializes the full match set in memory; sufficient for the issue's ~35-session use case, room to revisit if memory becomes a constraint on larger corpora).
Verification
End-to-end:
🤖 Generated with Claude Code