fix(web): /agent-rank H2H 1:1 — comparison logs, shared row mapper, re-rank companion carry - #75
Conversation
…e-rank companion carry Three remaining deltas between the /agent-rank in-iMessage ceremony and the main webapp movie flow, closed so the card's H2H replicates the webapp 1:1: 1. Comparison logs: the webapp persists one comparison_logs row per H2H choice (RankingAppPage.handleCompareLog); the agent ceremony dropped them. AgentRankPage now passes onCompare to RankingFlowModal and writes the exact same column set through the tokened client (RLS: insert-own, auth.uid() = user_id — the fragment JWT is a real user token). 2. Row mapper fork: the page kept a local copy of rowToRankedItem that dropped watched_with_user_ids. Because placement upserts watched_with_user_ids = placed.watchedWithUserIds or [], every re-rank through the card silently WIPED the user's companions. The mapper now lives in services/agentRankRows (exact webapp mirror, unit-tested) and the page consumes it. 3. Re-rank seed: the ceremony seed for an already-ranked film now carries existing.watchedWithUserIds so the modal restores and re-persists them. Parity suite extended: per-scenario comparison-LOG parity (same choices lead to identical persisted rows on both surfaces), structural checks that the page wires onCompare with the webapp's column set and that the re-rank seed carries companions, plus mapper field-parity tests (wipe regression locked). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthrough
ChangesAgent rank parity
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant RankingFlowModal
participant AgentRankPage
participant comparison_logs
RankingFlowModal->>AgentRankPage: onCompare(log)
AgentRankPage->>comparison_logs: insert comparison choice
comparison_logs-->>AgentRankPage: success or error
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Why
Owner: "for journal intake, I still feel like the H2H comparison is still incomplete and stay true to the H2H comparison flow from the webapp, should be replicate 1:1."
PR #70 unified the placement engine (both surfaces run one
createCeremonyDriver/RankingSession), so the comparison sequence was already identical. This PR closes the three remaining measurable deltas between the/agent-rankin-iMessage ceremony and the main webapp movie flow.What
Comparison logs — the webapp persists one
comparison_logsrow per H2H choice (RankingAppPage.handleCompareLog); the agent ceremony dropped them.AgentRankPagenow passesonComparetoRankingFlowModaland writes the exact same column set through the tokened client (RLS verified: insert-own policy,auth.uid() = user_id— the fragment JWT is a real user token).Row mapper fork — the page kept a local copy of
rowToRankedItemthat droppedwatched_with_user_ids. Because placement upsertswatched_with_user_ids: placed.watchedWithUserIds ?? [], every re-rank through the card silently wiped the user's companions. The mapper now lives inservices/agentRankRows.ts(exact webapp mirror, unit-tested) and the page consumes it.Re-rank seed — the ceremony seed for an already-ranked film now carries
existing.watchedWithUserIdsso the modal restores and re-persists them.Known intentional differences (not bugs)
FriendTagInput's search rides the module client. Companions are preserved (per feat: remove theater features, add comparison ranking UI, scaffold Da… #2), just not editable in-card.Tests
agentRankCeremonyParity.test.tsextended: per-scenario comparison-log parity (same choices → identical persisted rows on both surfaces, column-for-column), structural checks that the page wiresonComparewith the webapp's column set and the re-rank seed carries companions.agentRankRows.test.ts: mapper field parity incl. thewatched_with_user_idswipe regression, empty-array normalization, bracket fallback, and a no-forked-mapper structural check.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Tests