Skip to content

feat(members): open the last member on arrival, mirror it in the URL - #8546

Merged
iamwhatever merged 1 commit into
mainfrom
feat/crew-members-remember-last
Sep 7, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
feat/crew-members-remember-last

Conversation

@CrysisDeu

@CrysisDeu CrysisDeu commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Crew Members page landed on an empty middle column on every visit and forgot which member was open when you navigated away and back. Zezhen's ask: 「crew mode 页面点开要打开一个 crew 的 chat,如果来回 navigate 要回到上一个打开的」.

  • Opens a member on arrival. A visit that names no member opens the remembered one, else the first row in display order — never the empty column.
  • Remembers the last member. The last member opened is stored per browser (mc-members-last-member, via safeStorage), so leaving for Sessions / Settings and coming back, or a reload, lands on the same conversation. A remembered member that was deleted or renamed falls back to the first row without an error.
  • URL mirrors the selection (/members?member=<name>): a reload keeps it, and a link lands on one. Switching members replaces the entry — the page holds one history entry however many members you visit, so Back leaves /members in one press (the Sessions sidebar's rule); only the below-md roster→thread step pushes. The value is the exact crew name, not the slug — the slug is lossy (Oncall / oncall share one), and a slug link would misroute to the other member's thread, the exact failure this page's header comment says it exists to prevent. The URL is the single source of which member is open; clicks write the URL and one sync effect opens the thread, so click / back / link / restore share one path. A link naming a member that is gone (deleted/renamed) falls back to the first row and says so in a warn-toned status above the thread, leading with the swap — "Showing alpha — “ghost” is no longer on the roster." (pages.membersPage.member_gone; 13 catalogs + regenerated en-XA) — the user asked for someone specific, so the swap is neither silent nor muted. The stand-in opened by that fallback is not written to memory: it is the page's choice, not the user's, so one dead link cannot overwrite the member they had chosen. The remembered-member fallback stays silent: there the user named nobody.
  • Below md the page stays a two-level list→detail navigation: no ?member= IS the roster, so no auto-open there (the same rule SidePanelLayout applies to its remembered tab); a stale ?member= returns to the roster with the same notice above the list (member_gone_roster), and the header back button pops the entry the roster pushed (so the browser's own Back does not land on a duplicate roster entry) while a deep link — which has no roster entry behind it — drops the param in place.

Storage scope: one key per origin. The roster is the gateway's global crew list and localStorage is already per-gateway, so there is no frontend workspace dimension to key on.

Two new strings, pages.membersPage.member_gone and member_gone_roster, added to all 13 catalogs with en-XA regenerated; the existing pick_a_member empty state is still what the mobile roster and an empty crew list show.

Screenshots

Captured from the head (6303fd1) by website/scripts/capture-members-remember-last.mjs against website/capture/members-page.html?nav=1, which mounts the REAL MembersPage (gateway-free: API answered by route interception, roster of four fixtures) behind a capture-only caption bar that prints the router's live pathname + search and offers a history pop — the address bar is outside a MemoryRouter. Every frame asserts its state (URL, notice text, tone, which thread is mounted) before it is written; the run printed all frames verified.

Arrival on /members with nothing remembered: radar, the most recently active member, is open; caption reads /members?member=radar 01 — arrival opens the first row, URL says so, no empty column Deep link to ?member=ghost: radar's thread is open and a warn-toned line above it reads "Showing radar — “ghost” is no longer on the roster."; caption reads /members?member=radar 02 — dead link (md+) falls back and says so
390px, the same dead link: the roster with "“ghost” is no longer on the roster." above the list, no thread; caption reads /members 03 — dead link (below md) returns to the roster with the notice Desktop after arriving from another page and switching radar → scout → fixer; caption reads /members?member=fixer 04a — two switches
After one Back press: the other page; caption reads /elsewhere 04b — one Back leaves the page: switches replaced, they did not stack 390px, scout's thread open after a roster tap, header back button visible; caption reads /members?member=scout 05a — mobile tap pushes the thread
390px after the header back: the roster; caption reads /members 05b — mobile header back pops to the roster

The earlier pod recording (GIF on a since-dropped commit) is retired; it predated the history and fallback rules.

Review round (bolichen97, CHANGES_REQUESTED)

  1. Every member click pushes a history entry → switching between members now replaces; only the below-md roster→thread step (and nothing on desktop, where a member is always open) pushes. Pinned by the driven-history test.
  2. A dead link overwrites the remembered member → the fallback's stand-in is opened with remember=false (goneStandInRef carries the intent across the URL replace into the open it triggers); the gone-link test now seeds beta as the memory and asserts it survives.
  3. (low) back/forward claim rests on a spy → the useNavigate mock now performs the navigation against the MemoryRouter as well as recording it; one test walks two members and presses Back.

Note on 2: resolveDefaultMember already prefers the remembered member for the stand-in, so a valid memory was never overwritten by a dead link — the harm was the empty/stale-memory case, where the first row became the memory without the user choosing it. That write is now skipped; the test seeds no memory and asserts it stays empty, and a second test pins that the remembered member is the stand-in.

UX round-5 (head c328fa5) item taken: re-clicking the stand-in row now also retires the swap notice (an explicit choice acknowledges the swap; test pinned). Evidence gaps closed by the screenshot set above.

UX round-4 suggestion also taken: the two en.json strings use the catalog's curly “{{name}}” convention (en-XA regenerated; --check clean).

Tests

website/src/pages/members/MembersPage.test.tsx

  • resolveDefaultMember (pure): default → first row; restore → remembered; stale → first row; empty roster → undefined.
  • Page: fresh visit opens the first row (URL + memory written, no empty state); remembered member restored (one POST); stale memory → first row, no notice, memory rewritten; ?member= beats memory; ?member= naming a gone member → first row + URL rewritten + member-gone-notice (role=status, warn tone, leads with the swap) that retires when another member opens, memory left untouched (a later explicit click on the stand-in does write it); click writes URL + memory and aria-current; driven history (Routes + real MemoryRouter entries): enter /members from another page, walk two members, one Back lands on the other page.
  • Below md: no auto-open (memberThread not called, URL untouched); stale ?member= → URL cleared, roster shown with member-gone-roster-notice, no POST, notice retires on tap; tap → thread + URL; header back → pops the roster-pushed entry (navigate(-1), performed against the router, not only spied), memory kept; from a deep link → param dropped in place, roster shown.
  • Rebase adaptations for tests main added after this branch (feat(members): show each member's auto-patrol (monitor loop) status #8936 patrol status, feat(members): star crews and filter the roster by star or origin #8839 star/origin filters, feat(crew): make the avatar editor entry discoverable #9116 avatar entry): name lookups scoped to the roster column, the thread endpoint answered from the first render, and memberThread asserted per member (not.toHaveBeenCalledWith('pkg-a')) rather than never-called — the page now opens the first row on arrival, which those files were written before.
  • The file's useNavigate mock now records every call AND performs it against the MemoryRouter, so the history cases drive real push/replace/pop rather than asserting on a spy alone.
  • Existing cases adjusted for the page now opening a member on its own: name lookups scoped to the roster column (the name also renders in the header/drawer), thread-endpoint overrides installed before mount, and the unread-dot cases land on a different member so the flagged thread is genuinely closed.

Local: tsc -b and eslint on both files clean. Vitest left to CI per the work item's rule.

Feature map

docs/feature-map/README.md Crew Members row: the reach column now names the ?member=<name> URL contract (bare /members opens the remembered member else the first row; below md it stays the roster). Per the maintenance contract this is a new user-facing contract on an existing page, so the row is updated in-PR (GPT round on 68c65fec3, feature-map-correctness).

Not changed

No refactor of the page beyond splitting the sort into unfiltered/filtered (so "first member" ignores the search box) and moving the thread-open body into activate so the URL effect and the same-member re-click share it.

@CrysisDeu
CrysisDeu requested review from a team and pepmach September 4, 2026 19:52
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 6303fd12d2d67c69652eaa971a1ba892252f13af and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 6303fd1

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 6303fd12d2d67c69652eaa971a1ba892252f13af: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — ✅ PASS

UX-level review of 6303fd12d2d67c69652eaa971a1ba892252f13af — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Both notices render cleanly in the pixels, and the blind reader parsed every element this PR adds. Reconciliation: the arrival auto-open (shot-01) read as "the one currently open — sure"; the dead-link notice (shot-02) was read exactly as built — "I asked for a member called 'ghost', it's gone, so the app showed me radar instead"; the roster variant (shot-03) was correctly linked to the same event; the reader confirmed shot-03/shot-07 as one screen in two states; the mobile back arrow and URL caption were read correctly. No new control was misread or feared, every state the diff introduces is screenshotted, and nothing in the diff hard-swaps a persistent element (the notices are new transient lines; the auto-open is first render), so no recording is required. The reader's remaining confusions (ghost-avatar row, "auto", "Normal" pill, identical fixture replies, "56y ago" fixture timestamp) all belong to pre-existing UI or capture fixtures, not this PR's surface.

UX-Verdict: PASS

The change is behavioral and self-announcing: the blind reader read both "no longer on the roster" notices exactly as built, and every state is screenshotted.

[UX-REVIEWED] 6303fd1

@github-actions

github-actions Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of 6303fd12d2d67c69652eaa971a1ba892252f13af — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

URL-as-single-source with a per-browser memory and a spoken fallback is the right shape, follows the page's existing navigation conventions, and every description claim has backing code.

[DESIGN-REVIEWED] 6303fd1

@github-actions

github-actions Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 6303fd12d2d67c69652eaa971a1ba892252f13af — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Both data files are read, the contract's mechanical checks are done: temp-screenshots/ holds ~300 sibling feature directories and capture-*.mjs scripts are an established convention; no shared "remember selection + URL mirror" helper exists to duplicate (the closest is an inline pattern in MdNotebookPage.tsx:904, an app page, not a reusable mechanism); the export-for-tests pattern has explicit precedent (FoldableDiffBlock.tsx:39). Every inventory item traces to the quoted ask, a documented invariant, a recorded human-review round, or a repo convention.

First-Principles-Verdict: PASS

The quoted ask (auto-open, remember on return) is delivered, and every rider — URL, notices, history rules — traces to a recorded review round or a documented invariant.

What this change ships

Intent: land on a member's chat on arrival and return to the last one opened when navigating back — an ADDITION.

  1. Arrival opens the remembered member, else the first row — never the empty column — justified (quoted ask)
  2. Last member opened is remembered per browser (mc-members-last-member) — justified (quoted ask)
  3. Open member rides ?member=<name>; switching replaces, so one Back leaves the page — declared; history semantics demanded in the CHANGES_REQUESTED round
  4. A dead link falls back and says so (warn notice; 2 strings × 13 catalogs) — justified by the page's own slug-misroute invariant
  5. The dead-link stand-in is not written to memory — justified (review-round item 2, recorded)
  6. Below md: no auto-open, stale link returns to the roster with the notice, header back pops or drops the param — justified (list→detail rule the page already followed)
  7. A stale remembered member silently falls back to the first row — declared
  8. Capture script, capture-page ?route/?nav params, 7 screenshots — repo convention (~300 sibling dirs in temp-screenshots/)
  9. Feature-map row updated — mandated same-commit doc rule
  10. resolveDefaultMember exported for direct tests — repo convention (FoldableDiffBlock.tsx:39 precedent)

[FIRST-PRINCIPLES-REVIEWED] 6303fd1

@github-actions

github-actions Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed 6303fd12d2d67c69652eaa971a1ba892252f13af — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 6303fd1

Verdict parsed from the review's SHA-scoped output markers for commit 6303fd12d2d67c69652eaa971a1ba892252f13af.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 6303fd12d2d67c69652eaa971a1ba892252f13af: <one-sentence reason>

@CrysisDeu
CrysisDeu force-pushed the feat/crew-members-remember-last branch from cdffffd to 4777a72 Compare September 4, 2026 21:00
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 4, 2026
@CrysisDeu
CrysisDeu force-pushed the feat/crew-members-remember-last branch from 4777a72 to e891871 Compare September 4, 2026 21:39
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

UX Review disposition — fixed in 4777a7207 (carried in e891871ce)

  • Same stale link on mobile skips the roster. Below md, a ?member= naming a member that is gone is now rewritten to /members (the roster) with no thread opened, instead of falling to the first row. Test: a stale ?member= returns to the roster instead of opening a different member.

With urlMember set but unmatched, the effect falls past the else if (isMobile) branch … bouncing a phone user straight into a different member's thread.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

UX Review disposition — fixed in e891871ce

  • Stale deep link bounces desktop users into another member's thread with no notice. The URL-named gone-member fallback now renders a one-line status above the mounted thread — 'ghost' is no longer on the roster — showing alpha. (pages.membersPage.member_gone, 13 catalogs + en-XA) — and retires it once a different member opens. The remembered-member fallback stays silent, as the review asked: there the user named nobody. Test: a URL naming a member that is gone falls back to the first row and SAYS so.

falling back silently should stay reserved for the remembered member, where the user named nothing.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 4, 2026
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

UX Review disposition — accepted-and-deferred → #8570

render the notice at default text weight (or text-warning), keeping role="status".

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

UX Review disposition — accepted-and-deferred → #8570

show the same member_gone-style status line above the roster on that branch.

@CrysisDeu
CrysisDeu force-pushed the feat/crew-members-remember-last branch from e891871 to 0d139ea Compare September 4, 2026 22:21
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 4, 2026
@CrysisDeu
CrysisDeu force-pushed the feat/crew-members-remember-last branch from 0d139ea to d11cc70 Compare September 4, 2026 23:41
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 4, 2026
@CrysisDeu
CrysisDeu force-pushed the feat/crew-members-remember-last branch from d11cc70 to ab6615e Compare September 5, 2026 00:14
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

UX Review disposition — fixed in ab6615e47 (supersedes the earlier deferral to #8570)

  • Swap notice is decision-critical but visually muted. The thread-side notice now renders text-[13px] text-warn (body size, warn tone) instead of text-xs text-muted, keeps role="status", and leads with the swap: "Showing alpha — 'ghost' is no longer on the roster." Test pins the tone and the leading clause.

render the notice at default text weight (or text-warning), keeping role="status".

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

UX Review disposition — fixed in ab6615e47 (supersedes the earlier deferral to #8570)

  • Below md the same stale link is answered with silence. The below-md branch now records the gone member and the roster shows "'ghost' is no longer on the roster." above the list (member_gone_roster, 13 catalogs + en-XA, role="status", same warn tone), retired when the user taps a member. Test: a stale ?member= returns to the roster and says where the member went.

show the same member_gone-style status line above the roster on that branch.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

UX Review disposition — fixed in ab6615e47 (the round-2 suggestion)

  • member-back uses replace, so after the UI back the browser's own Back lands on an identical roster entry. Roster taps now push with state.fromRoster; the header back pops that entry (navigate(-1)) so history keeps one roster entry, and falls back to the in-place param drop only for a deep link, which has no roster entry behind it. Two tests pin both paths.

popping instead of replacing would keep one roster entry in history.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 6, 2026
@CrysisDeu
CrysisDeu force-pushed the feat/crew-members-remember-last branch from 2c9f6ad to 7b96261 Compare September 6, 2026 07:37
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 6, 2026
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

First Principles disposition — rejected (kept as designed)

  • Defer the ?member= mirroring and its dependents. Not taken. The URL is the page's single selection source — clicks write it and one sync effect opens the thread — which is what makes the below-md list→detail step a real history entry (the phone's back gesture returns to the roster instead of leaving the page) and what lets a reload land on the displayed member rather than the remembered one when they differ (a link, a second tab). The reviewer of record (bolichen97) read this shape and called the direction right, asking only for the replace-on-switch and fallback-memory rules that now ship; Design and UX pass on it. The dependents are small and each is pinned by a test; retiring a shipped URL param later would be the costly move, not carrying it. Zero in-tree producers of ?member= is expected for an entry point whose producers are the user (address bar, share) and the browser (history), not code.

Defer the ?member= mirroring and its dependents: drop MEMBER_PARAM, the gone state, goneStandInRef, the fromRoster history state, and member_gone/member_gone_roster from all 13 catalogs

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Sep 6, 2026
@CrysisDeu
CrysisDeu force-pushed the feat/crew-members-remember-last branch from 7b96261 to 7d15dc2 Compare September 6, 2026 15:43
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Sep 6, 2026
@CrysisDeu
CrysisDeu force-pushed the feat/crew-members-remember-last branch from 7d15dc2 to 49cbd39 Compare September 6, 2026 16:10
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 6, 2026
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

First Principles disposition — rejected (kept as designed)

  • Item 3's provenance is symmetry, not the ask (defer the ?member= mirroring and its dependents). Not taken; same disposition as on 7b96261eb. The URL is the page's single selection source — clicks write it and one sync effect opens the thread — which is what makes the below-md list→detail step a real history entry (the phone's back gesture returns to the roster instead of leaving the page) and what lets a reload land on the displayed member rather than the remembered one when they differ (a link, a second tab). The reviewer of record read this shape and called the direction right, asking only for the replace-on-switch and fallback-memory rules that now ship; Design and UX pass on it. Zero in-tree producers of ?member= is expected for an entry point whose producers are the user (address bar, share) and the browser (history), not code; retiring a shipped URL param later would be the costly move, not carrying it.

Item 3's provenance is symmetry, not the ask: the description's own reasons are "a reload keeps it, and a link lands on one" — reload is already covered by item 2, and grep for members\?member outside this page and its tests finds 0 in-app link producers.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author

First Principles disposition — rejected (kept, test-only surface accepted)

  • Drop the export on resolveDefaultMember and its 4-case pure describe block. Not taken. The export exists so the three-way resolution (remembered-and-present → remembered; remembered-and-gone → first row; nothing → first row; empty → undefined) is pinned as a pure table, independent of the router, the roster fetch and the auto-open effect the page-level cases must drive to reach the same branches. Those page cases prove the wiring; the pure block is what localises a regression to the resolver in one assertion. It is test-only surface — one same-file caller — and adds no runtime path; dropping it now would spend a full CI round on removing four assertions.

Drop the export on resolveDefaultMember (MembersPage.tsx:87) and its 4-case pure describe block — only its own test file imports it

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Sep 6, 2026
@CrysisDeu
CrysisDeu force-pushed the feat/crew-members-remember-last branch from 49cbd39 to 7555c0b Compare September 6, 2026 20:31
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 6, 2026
The Crew Members page landed on an empty column every visit and forgot
which member was open when the user navigated away and back. Now:

- A visit that names no member opens the remembered one, else the first
  row in display order — never the empty column.
- The last member opened is remembered per browser (mc-members-last-member,
  via safeStorage), so leaving for Sessions/Settings and returning, or a
  reload, lands on the same conversation. A remembered member that was
  deleted or renamed falls back to the first row without an error.
- The open member rides the URL (?member=<name>): a reload keeps it and a
  link lands on one. Switching members REPLACES the entry — the page holds
  one history entry however many members are visited, so Back leaves it in
  one press, the Sessions sidebar's rule; only the below-md roster->thread
  step pushes. The value is the exact crew name, not the slug — the slug
  is lossy and would misroute Oncall to oncall. A link naming a member
  that is gone takes the same fallback and says so in a warn-toned status
  above the thread, leading with the swap ("Showing X — “Y” is no longer
  on the roster."; 13 catalogs + en-XA): the user asked for someone
  specific, and a silently mounted other thread is the misroute this page
  exists to prevent. The stand-in opened by that fallback is the page's
  choice, not the user's, so it does NOT become the memory — one dead
  link cannot overwrite the member the user had chosen.
- Below md the page stays a two-level list->detail navigation: no
  ?member= IS the roster, so no auto-open there (same rule as
  SidePanelLayout's remembered tab). A stale ?member= returns to the
  roster with the same notice above the list. The header back pops the
  entry the roster pushed (no duplicate roster entry in history) and
  drops the param in place for a deep link, which has no roster behind it.

Tests cover default, restore, stale fallback (memory: silent; URL: with
notice on both sides of md, retired on the next open, memory preserved),
URL-over-memory, click writes URL+memory, a driven-history walk over two
members that leaves the page in one Back, and the below-md back semantics
(the useNavigate mock records AND performs against the MemoryRouter).
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.

4 participants