Skip to content

fix(profile): TASK-25239 residence reorder keeps the verified country when /users/me omits declared - #4196

Merged
Hugo0 merged 1 commit into
feat/state-machine-hardeningfrom
fix/residence-reorder-swap
Nov 21, 2026
Merged

Hugo0 merged 1 commit into
feat/state-machine-hardeningfrom
fix/residence-reorder-swap

Conversation

@Hugo0

@Hugo0 Hugo0 commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Summary

The Profile residence drawer swaps the pair when a user picks their own second country. It decided "reorder" from declared, but the compact /users/me omits declared when it equals the verified country (api residence-profile.ts:114-115). So a verified user with a second country sent only residenceCountry, and the API wrote the second country into both slots on GREEN. The outgoing primary is now declared ?? verified.

TLC trace: _Buggy in mono engineering/api/state-machines/ResidenceChange.tla (6 steps, SecondaryDistinct).

The API owns the fix: peanut-api-ts#2202 makes /update-user keep the outgoing country, which also covers installed clients. This PR makes the drawer send the swap itself and makes its tests honest: they rendered declared: 'ES', verified: 'ES', a shape the API never sends.

Task

TASK-25239

Risks / contract

No API contract change; the request already carries secondResidenceCountry. Ships independently of api#2202 in either order. Result with either side alone: the pair is swapped.

Tests

  • ResidenceChangeDrawer.test.tsx: the 5 reorder cases now render the compact shape (declared: null, verified: 'ES'). On the old drawer 3 of them fail; with the fix all 24 pass.
  • Suites run locally (agent-nice --heavy, one worker): src/components/Profile (15 suites, 299 tests). Typecheck and the full suite run in CI. This base (feat/state-machine-hardening) does not trigger tests.yml on pull_request, so CI ran by workflow_dispatch.

Screenshots

N/A (no visible change: the request body changes, the screen does not).

…omits declared, so the drawer sends the swap itself; tests now use the shape the compact API sends
@notion-workspace

Copy link
Copy Markdown

@vercel

vercel Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
peanut-wallet Ready Ready Preview Nov 21, 2026 11:29am UTC

Request Review

@Hugo0

Hugo0 commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

/chip review

@chip-peanut-bot chip-peanut-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chip review — INCOMPLETE · no blocking findings — this is not an approval

⚠️ This review is incomplete. The third opinion (product truth, tests, contract) did not run — claude-api_error (after a retry; first: claude-api_error). The copy check did not run — claude-api_error (after a retry; first: claude-api_error). Its questions are unanswered, not answered clean. Comment /chip review to run it again.

No findings.

Checked clean

  • Exact head and merge base verified; changed reorder request and compact-profile cases reviewed.
  • API projection omits declared when it matches verified; residence update carries the requested second country into the pending change.
  • Drawer caller, server-first second residence fallback, and design-system impact checked; no visible UI change.
  • Exact-head CI checks, including unit, typecheck, lint, and design lint, succeeded.

Security review by moonshotai/kimi-k3: 0 finding(s), marked with the model name. It reads the diff only and answers only security, privacy and money, so treat its findings as advice.

Third opinion: did not run — claude-api_error (after a retry; first: claude-api_error). This review is one reviewer short.

Copy check: did not run — claude-api_error (after a retry; first: claude-api_error). This review is one reviewer short.

Exact head: 021933b4dab9 · Context: repo, design, sibling-api · Took 1m

@Hugo0
Hugo0 marked this pull request as ready for review November 21, 2026 12:15
@Hugo0
Hugo0 merged commit 1a1b342 into feat/state-machine-hardening Nov 21, 2026
26 of 27 checks passed

This branch was successfully deployed

1 active deployment
Preview — 021933b4 Deployed Nov 21, 2026 by vercel[bot]
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