Skip to content

feat(shipping): officer UX sweep — detach, reassign, role-aware UI, workflow polish (SR-7) - #61

Merged
LongXL6 merged 1 commit into
mainfrom
feat/shipping-sr7-officer-ux
Jul 2, 2026
Merged

feat(shipping): officer UX sweep — detach, reassign, role-aware UI, workflow polish (SR-7)#61
LongXL6 merged 1 commit into
mainfrom
feat/shipping-sr7-officer-ux

Conversation

@LongXL6

@LongXL6 LongXL6 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

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

  • Detach (20260703000005 + POST shipments/[id]/detach): exact inverse of attach — in_transit on this batch → received_cn + unassigned, only while the batch is forming/sealed, same row-lock discipline. Per-parcel 移出 button with confirm. Mis-attach was previously unrecoverable in the UI.
  • Reassign (admin_reassign_parcel_student + POST parcels/[id]/reassign): re-points member_id and re-derives student_id/user_id from students (member_id is UNIQUE there), writes a timeline note, blocked once picked_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

  • Attach panel: search box + "仅显示前 200 个" truncation notice (200 was exactly the peak-season count, truncated silently).
  • lib/shipping/labels.ts: shipment-status Chinese labels now shared (list + pickers rendered raw departed_cn before) + errText() so machine codes (invalid_transition…) map to officer-facing copy everywhere.
  • requests/routes/contacts saves had try/finally with no catch — network failures now toast.
  • zh-CN dates across shipping pages; intake dead-ends now link into the parcels-list search; overview gains pending pack-request/发货 queue cards (amber when non-zero) and a 集运·总览 nav entry (the page was unreachable); roster rejects invalid amounts with a toast instead of silently ignoring them.

Tests

260 passed (new: detach + reassign suites asserting RPC args, audit ids, guard-token mapping); tsc clean; build green.

Prod apply

Migration 20260703000005 idempotent/append-only, not yet applied; the new endpoints are the only callers of the new RPCs.

🤖 Generated with Claude Code

…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>
@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bia-admin-bia-admin Ready Ready Preview, Comment Jul 2, 2026 7:57pm

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@LongXL6, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 17 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2293d094-d7f9-4cc3-ab94-5547fe4009f7

📥 Commits

Reviewing files that changed from the base of the PR and between 639474f and ee592b3.

📒 Files selected for processing (18)
  • bia-admin/app/(admin)/admin/shipping/contacts/page.tsx
  • bia-admin/app/(admin)/admin/shipping/pack-requests/page.tsx
  • bia-admin/app/(admin)/admin/shipping/page.tsx
  • bia-admin/app/(admin)/admin/shipping/parcels/[id]/page.tsx
  • bia-admin/app/(admin)/admin/shipping/parcels/intake/page.tsx
  • bia-admin/app/(admin)/admin/shipping/parcels/page.tsx
  • bia-admin/app/(admin)/admin/shipping/requests/page.tsx
  • bia-admin/app/(admin)/admin/shipping/routes/page.tsx
  • bia-admin/app/(admin)/admin/shipping/shipments/[id]/page.tsx
  • bia-admin/app/(admin)/admin/shipping/shipments/[id]/roster/page.tsx
  • bia-admin/app/(admin)/admin/shipping/shipments/page.tsx
  • bia-admin/app/api/admin/shipping/parcels/[id]/reassign/__tests__/route.test.ts
  • bia-admin/app/api/admin/shipping/parcels/[id]/reassign/route.ts
  • bia-admin/app/api/admin/shipping/shipments/[id]/detach/__tests__/route.test.ts
  • bia-admin/app/api/admin/shipping/shipments/[id]/detach/route.ts
  • bia-admin/lib/admin/sections.ts
  • bia-admin/lib/shipping/labels.ts
  • supabase/migrations/20260703000005_detach_and_reassign_rpcs.sql
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/shipping-sr7-officer-ux

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.

@LongXL6
LongXL6 merged commit c6ebbb8 into main Jul 2, 2026
5 checks passed
@LongXL6
LongXL6 deleted the feat/shipping-sr7-officer-ux branch July 2, 2026 22:02
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.

1 participant