Repository navigation
feat(reader): conversation compare side-by-side (#1124) - #1175
Conversation
|
Warning Rate limit exceeded
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 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 (9)
✨ 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 |
Extend the reader's existing /api/compare endpoint with anchor-based
message alignment, per-pair diff classification, and a metadata diff
panel so two conversations can be inspected side-by-side with explicit
content-drift markers.
Problem
-------
The compare workspace shipped only as a positional pair view: messages
were zipped index-by-index, the UI showed no diff affordance, and no
metadata delta surfaced (provider, model, repo, tags). Operators could
open the layout but could not see what differed between the two sides,
and there was no entry point from a single-conversation view.
Solution
--------
- New polylogue/daemon/compare.py owns alignment + diff semantics. Lifts
the inline pairing logic out of workspace_routes and adds:
* shared-anchor walker (covers fork/branch case where messages retain
identical anchors); falls back to sequential pairing otherwise.
* per-pair diff_status (equal | changed | added | removed) plus a
role_match flag for cross-role drift.
* METADATA_FIELDS sweep producing a metadata_diff envelope keyed by
field with left/right/status; tag membership normalised so order is
irrelevant.
* envelope carries alignment ("anchor" | "sequential"),
degraded_sides, and degraded_count so the UI can render precise
empty/degraded banners.
- workspace_routes.build_compare_payload now delegates to the new
module; the existing dispatcher and align validation are untouched.
- web_shell_workspace renders the metadata diff panel above the pair
list, colours each pair gutter by diff_status, and shows the
alignment strategy as a header chip. Degraded banner names which
side failed to load.
- web_shell adds a "Compare with..." action in the inspector Info tab
that prompts for another conversation id and opens the compare route.
- Tests:
* tests/unit/daemon/test_compare.py — exhaustive unit coverage for
metadata diff, anchor vs sequential alignment, added/removed/
changed/equal classification, and missing-side envelope.
* tests/unit/daemon/test_web_reader.py — HTTP smoke for the new
envelope fields and a two-conversation diff scenario.
- File-size budgets updated: web_shell.py picked up ~21 lines for the
Compare entry point and exceeded the default 1100 ceiling. Recorded
a focused exception with split candidate, matching the existing
daemon/http.py pattern. Topology projection regenerated.
Verification
------------
nix develop -c devtools verify --quick → exit_code 0 (22s).
nix develop -c pytest tests/unit/daemon/test_compare.py tests/unit/daemon/test_web_reader.py
→ 82 passed in 12s.
Closes #1124
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
f939515 to
f3d2e42
Compare
Summary
Extend the reader's existing
/api/compareendpoint with anchor-based message alignment, per-pair diff classification, and a metadata diff panel so two conversations can be inspected side-by-side with explicit content-drift markers. Adds a "Compare with…" entry point in the inspector and pins the new compare module underpolylogue/daemon/compare.py.Closes #1124.
Problem
The compare workspace shipped only as a positional pair view: messages were zipped index-by-index, the UI showed no diff affordance, and no metadata delta surfaced (provider, model, repo, tags). Operators could open
/w/compare?left=…&right=…but could not see what differed between the two sides, and there was no entry point from a single-conversation view. The issue calls for:Solution
polylogue/daemon/compare.py(new) owns alignment + diff semantics. Lifts the inline pairing logic out ofworkspace_routesand adds:alignment: "anchor" | "sequential"so the UI can show it.diff_status(equal | changed | added | removed) plus arole_matchflag for cross-role drift.METADATA_FIELDSsweep producing ametadata_diffenvelope keyed by field withleft/right/status. Tag membership normalised so order is irrelevant.degraded_sides+degraded_countso a one-side-missing or both-sides-missing scenario renders an explicit banner instead of crashing the UI.polylogue/daemon/workspace_routes.py—build_compare_payloadnow delegates to the new module. The dispatcher and align-mode validation are untouched, preserving the existing 400-rejection of unsupportedalign=values.polylogue/daemon/web_shell_workspace.pyrenders the metadata diff panel above the pair list, colours each pair gutter bydiff_status(green/red/yellow for added/removed/changed), and shows the alignment strategy as a header chip. The degraded banner now names which side failed to load.polylogue/daemon/web_shell.pyadds a "Compare with…" action in the inspector Info tab that prompts for another conversation id and opens the compare route. Self-compare is rejected client-side.tests/unit/daemon/test_compare.py— exhaustive unit coverage for metadata diff, anchor vs sequential alignment, added/removed/changed/equal classification, role-match flag, and missing-side envelope. Uses synthetic dict payloads so it does not boot the daemon.tests/unit/daemon/test_web_reader.py— HTTP smoke updated to assert the new envelope fields (alignment,degraded_sides,metadata_diff) and a new two-conversation scenario covering diff_status + metadata changes for the seeded archive.docs/plans/file-size-budgets.yamlrecords a focused exception forpolylogue/daemon/web_shell.py(was already near the default ceiling — picked up ~21 lines for the Compare entry point). Matches the existingdaemon/http.pyexception pattern with a stated split candidate (daemon/web_shell_inspector.py).docs/plans/topology-target.yamlanddocs/topology-status.mdregenerated viadevtools build-topology-projectionto declare the newpolylogue/daemon/compare.pymodule.Verification
Acceptance criteria (#1124)
/w/compare?left=…&right=…&align=promptroute, now also reachable via the inspector "Compare with…" action.messageBlocksHtmlcollapse cap (2000 chars) as single mode.compare.align_messagesreturns("anchor" | "sequential", pairs)and the UI surfaces the strategy as a chip. Lineage substrate (feat(topology): materialize session identity and lineage graph #866) can supply richer anchors without changing the envelope.metadata_diffenvelope +#compare-metadata-panel.degraded_sidespopulated, banner names the failing side.TargetRefPayloadvia the existing_do_get_conversationloader.🤖 Generated with Claude Code