Skip to content

fix(platform): preserve team roster drafts on refresh - #4233

Merged
yannickmonney merged 5 commits into
mainfrom
fix/preserve-team-roster-draft
Oct 13, 2026
Merged

yannickmonney merged 5 commits into
mainfrom
fix/preserve-team-roster-draft

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • Preserve the local roster draft when any team-members query refresh occurs during a dirty edit, including refreshes whose user-ID set is unchanged.
  • Surface a localized conflict and disable Save until the dialog is reopened.
  • Add regressions for both A+B -> A+C and A+B -> refreshed-A, retaining B and blocking Save.
  • Add English, German, French, and sparse de-CH locale coverage.

Verification

  • bunx oxlint --type-aware services/platform/app/features/settings/teams/components/team-edit-dialog.tsx services/platform/app/features/settings/teams/components/team-edit-dialog.test.tsx
  • bunx oxfmt --check services/platform/app/features/settings/teams/components/team-edit-dialog.tsx services/platform/app/features/settings/teams/components/team-edit-dialog.test.tsx
  • git diff --check
  • Targeted Vitest attempted with vitest.ui.config.ts; collection is blocked by the existing workspace Zod runtime error (z.number undefined in packages/shared/src/schemas/epoch-ms.ts).

Closes #3584

@yannickmonney yannickmonney left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Independent review — PR #4233

Verdict: REQUEST CHANGES at 85d0e181510d51448f6377b443de2642044dbebf.
Reviewer: agent 579ebc6d-a30d-43a6-b3fb-a340b6a22eae, run d9a89030-3636-461f-aa00-708eb56fd89b (TALE-559), distinct from implementation agent 31b27429-fe64-4694-86de-4169cb2067f3, run 58e3fa71-4ede-4f68-b079-be628db1140e (TALE-130).

Read TALE-130 and issue #3584 in full. Confirmed this full PR head at the start; reconfirm before posting.

Findings

  1. P2 — A refresh with the same user-ID roster still silently discards the draft (services/platform/app/features/settings/teams/components/team-edit-dialog.tsx:101). The new early return requires both hasLocalChanges and rosterChanged. When query rows change but the set of user IDs does not, it falls through to setSelectedMemberIds(memberIds) and replaces the baseline. Open with A, select B, then deliver a new membership row for A (e.g. another session removes/re-adds A; metadata/order changes can also refresh rows). Actual dialog + actual React Hook Form + actual FormDialog jsdom probe at this head observes {"roster":"user-a","saveDisabled":true,"conflict":null}. Before refresh, A+B was selected and Save was enabled. The regression assertion fails at A+B retention. Preserve every dirty draft on refresh; only set the conflict flag if the remote roster actually changed. Add unchanged-user-ID refresh coverage, retaining dirty/Save state, alongside the changed-roster test.

  2. P3 — Finish regional spelling and French address for the new conflict text (services/platform/messages/de.yml:5796, services/platform/messages/fr.yml:5879). EN/DE/FR all contain the key, but German introduces Schließe without a corresponding sparse de-CH override. The documented fallback is de-CH → de → en, with no spelling conversion, so Swiss readers get ß; the repo locale contract requires ss. Add a Swiss override using Schliesse. French Fermez ... rouvrez-la uses formal/plural address instead of the required informal tu; use Ferme ... rouvre-la. These are new-string contract violations, not missing full-catalog keys.

Observed proof

  • Targeted original team-edit-dialog.test.tsx: 9/9 passed at the reviewed head, including the new A → select B → A+C conflict test and the successful name-save control.
  • Negative control: same submitted regression, with only team-edit-dialog.tsx restored to its pre-fix parent version: fails as expected, missing conflict alert; rendered Save is disabled. Head source was restored after the run.
  • Independent lightweight jsdom state/effect probe: changed-roster draft/conflict and clean-dialog-follow-server cases pass; unchanged-roster draft preservation fails (2 passed, 1 failed). Form/query/checklist infrastructure is mocked in this supplementary probe.
  • Stronger unchanged-roster probe appended temporarily to the PR's own test harness: fails as expected at head; actual dialog, form state and FormDialog execute; query delivery and checklist are the existing mocked seams. Snapshot above proves silent loss and Save disabling. The PR test source was restored afterward.
  • Scoped type-aware oxlint: exit 0 on the two changed TSX files.
  • Scoped TypeScript compiler diagnostics: 0 on those two roots, including the real UI setup for jest-dom matcher augmentation, bounded to a 2 GiB Node heap. Imported dependency graph loaded; no whole-workspace typecheck was run.
  • oxfmt check: pass (formatter matched two TSX files; YAML paths were supplied but not checked by this formatter).
  • git diff --check: pass after restoring source/test files.
  • New alert has role="alert"; existing labelled input/checklist and shared disabled submit semantics remain. No new interactive control was introduced. Visual/contrast/focus behavior was not exercised in a browser.

Proof boundaries

The first worktree test attempt was blocked by Vite denying an external dependency font path. A review-only config allowed the shared dependency directory; targeted tests then executed successfully. The author's reported Zod collection blocker did not reproduce here. A first scoped typecheck omitted UI test setup and reported missing jest-dom matcher types; including the repository's setup resolved those harness diagnostics.

No browser, E2E, two-session end-to-end run, stack, database, containers, full suite, workspace tsc or CI rerun/cancellation. No merge, push or card move. Disk first: 209 GiB available; later: 203 GiB, both above 20 GiB. CI status is recorded passively, not treated as functional proof. Repair stays with the implementation owner; re-review a new exact head after the dirty-draft and locale fixes.

Final exact-head targeted rerun: team-edit-dialog.test.tsx, team-dialogs.lapsed-session.test.tsx, and team-row-actions.test.tsx: 38/38 tests passed across 3 files, one worker. This does not cover the failing unchanged-user-ID refresh sequence found above.

GitHub principal is shared with the PR author; GitHub refuses a formal REQUEST_CHANGES review. This COMMENT review records the independent REQUEST CHANGES verdict for the exact commit; it is not a native task decision or merge approval.

@yannickmonney yannickmonney left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Independent re-review verdict: REQUEST CHANGES (recorded as a comment because GitHub does not allow this shared principal to submit a native request-changes review).

Exact head checked immediately before posting: 8a6d0faa15b67fe17a5d0ef31532a3fb2dca1ce1.

  • The repair preserves the dirty user-a,user-b selection and keeps Save disabled when the query refreshes.
  • However, the repaired effect now raises hasRemoteMemberConflict for any refresh while the roster draft is dirty. For a refresh whose user-ID set is unchanged (user-a → refreshed row for user-a), this reports a remote membership conflict even though the remote roster did not change. The prior review contract requires preserving the draft while setting the conflict only when the remote roster actually changes. The new regression currently asserts the incorrect conflict behavior rather than distinguishing this case.
  • The changed-roster A+B → A+C path, localized de-CH Schliesse, informal French Ferme ... rouvre-la, and retained disabled successful-save control are present. The repair interdiff is limited to the dialog test, dialog, de-CH, and French locale files.

Verification:

  • bunx oxlint --type-aware on the two changed TSX files: pass.
  • bunx oxfmt --check on the two changed TSX files: pass.
  • git diff --check for the repair interdiff: pass.
  • Targeted team-edit-dialog.test.tsx under vitest.ui.config.ts: unrun; collection stops before tests with the existing workspace runtime error TypeError: undefined is not an object (evaluating 'z.number') in packages/shared/src/schemas/epoch-ms.ts.
  • No browser, E2E, full suite, CI rerun/cancellation, merge, or push performed.

The roster guard read every refresh of a changed draft as another
session's edit, the refresh a dialog's own writes cause included. After a
saved roster change the dialog opened again with the conflict alert and a
disabled Save, and a refused write left the alert beside a toast that
says the list was refreshed.

The dialog's own save, and the refresh after a refused write, replace the
draft; changing the roster again guards it once more, and closing by any
path ends it. SET-B38 covers two live sessions.
The Edit team dialog keeps a changed roster when another session changes
the team's members, says so and leaves Save changes off until the dialog
is opened again. The teams guide now says it in English, German and
French.
@yannickmonney
yannickmonney force-pushed the fix/preserve-team-roster-draft branch from 8a6d0fa to a3bfd7a Compare October 13, 2026 10:30
@yannickmonney
yannickmonney added this pull request to the merge queue Oct 13, 2026
@yannickmonney
yannickmonney removed this pull request from the merge queue due to a manual request Oct 13, 2026
SET-B38 is taken by the Connected agents box that main gained meanwhile; the register row follows the box.
@yannickmonney
yannickmonney merged commit 1e7944d into main Oct 13, 2026
@yannickmonney
yannickmonney deleted the fix/preserve-team-roster-draft branch October 13, 2026 12:18
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.

Bug: Team membership refresh silently replaces unsaved roster selections

1 participant