feat(shipping): officer UX sweep — detach, reassign, role-aware UI, workflow polish (SR-7) - #61
Conversation
…orkflow polish (SR-7) Migration 20260703000005: - admin_detach_parcels_from_shipment: the exact inverse of attach (in_transit on THIS batch -> received_cn + unassigned), only while the batch is forming/sealed, under the same shipment row lock — mis-attach finally has a recovery path - admin_reassign_parcel_student: re-points member_id and re-derives the students link (student_id/user_id), timeline note included — a typo'd member_id is no longer a permanent mis-route of notifications/QR/ visibility. Blocked once picked_up Routes: POST shipments/[id]/detach + POST parcels/[id]/reassign (editor+, audited with ids / from→to). Tests for both. UI sweep: - shipment detail: 移出 button per in_transit parcel (forming/sealed only), attach panel gains search + a "first 200" truncation notice, all write controls hidden for viewers - parcel detail: 重新指派 affordance + 未绑学生档案 badge; unlinked reassigns warn that students won't see the parcel - viewers no longer get write UI on shipments/pack-requests/requests/ routes/contacts (was: fill the form, get a 403 toast) - new lib/shipping/labels.ts: shipment status Chinese labels shared by list/pickers (was trapped in the detail page; lists rendered raw enums) + errText() mapping machine error codes to officer-facing copy — raw codes like invalid_transition no longer surface verbatim - requests/routes/contacts saves: network failures now produce feedback (try/finally had no catch) - zh-CN date formatting across shipping pages (was en-US) - intake: ambiguous/unmatched tracking numbers link into the parcels list search (were text-only dead-ends) - overview: pending pack-request/发货 queues as amber cards + 集运·总览 nav entry (page was unreachable) - roster: invalid amounts now toast + reset instead of being silently swallowed 260 tests green; tsc clean; build green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 17 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (18)
✨ 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 |
Summary
Fifth PR of the 2026-07-03 shipping refinement — the officer-workflow findings (12 confirmed UX findings + 2 critic gaps).
Recovery paths that didn't exist
20260703000005+POST shipments/[id]/detach): exact inverse of attach —in_transiton this batch →received_cn+ unassigned, only while the batch isforming/sealed, same row-lock discipline. Per-parcel 移出 button with confirm. Mis-attach was previously unrecoverable in the UI.admin_reassign_parcel_student+POST parcels/[id]/reassign): re-pointsmember_idand re-derivesstudent_id/user_idfromstudents(member_id is UNIQUE there), writes a timeline note, blocked oncepicked_up. A wrong-student match previously mis-routed notifications/visibility/QR/dunning permanently. Unlinked reassigns warn loudly; parcels without a students link get a 未绑学生档案 badge.Role-aware UI
Viewers no longer see write controls on shipments detail / pack-requests / requests / routes / contacts (previously they discovered read-only via a 403 toast after filling the form).
Workflow polish
lib/shipping/labels.ts: shipment-status Chinese labels now shared (list + pickers rendered rawdeparted_cnbefore) +errText()so machine codes (invalid_transition…) map to officer-facing copy everywhere.try/finallywith no catch — network failures now toast.Tests
260 passed (new: detach + reassign suites asserting RPC args, audit ids, guard-token mapping); tsc clean; build green.
Prod apply
Migration
20260703000005idempotent/append-only, not yet applied; the new endpoints are the only callers of the new RPCs.🤖 Generated with Claude Code