mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5640] [MERGED] fix(client): stop DraftNumberInput dropping an edit made during a commit round trip #6861
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#6861
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5640
Author: @kolacheee
Created: 8/29/2026
Status: ✅ Merged
Merged: 8/29/2026
Merged by: @kolacheee
Base:
staging← Head:fix/5636-run-interval-dropped-commit📝 Commits (3)
283904dfix(client): stop DraftNumberInput dropping an edit made during a commit round trip5491f52fix(client): harden the DraftNumberInput fix per adversarial verificationb6e6f01fix(client): resync an abandoned draft when the input is disabled mid-edit📊 Changes
4 files changed (+106 additions, -5 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
e2e/core-flows.e2e.ts(+46 -2)📝
packages/client/src/components/game/GameCharacterSheet.tsx(+9 -1)📝
packages/client/src/components/ui/DraftNumberInput.tsx(+50 -2)📄 Description
Closes #5636
Why
#5636: the Secret Plot "Run Interval" field silently dropped an edit — CI caught a run where a value typed right after a previous Enter-commit never reached the server (fill
0, blur, server stayed at the previous11for a full 10-second poll, and no third PATCH request appeared in the trace at all). A real user hits the same window by typing a value, pressing Enter, then immediately correcting it and clicking away: the correction vanishes with no error.The defect is not specific to that field — it lives in the shared
DraftNumberInputcomponent, which backs ~35 numeric settings fields across the connection editor, preset editor, settings panel, drawer, wizards, and game sheets.What was wrong
Two independent mechanisms could discard a typed-but-not-yet-blurred draft:
useEffect([value])sync re-seeded the draft unconditionally. The async echo of a previous commit (mutate → invalidate → refetch) landing mid-edit replaced the in-progress draft with the old value, so blur re-committed the old value.The fix (both in
DraftNumberInput)focusedRef). External updates still sync any time the field is not focused, and blur still reconciles throughcommit().Test hardening
The Secret Plot e2e step now forwards the previous commit's PATCH to the server immediately but holds its response until the next edit has begun, and forges the echoed interval to a value the client never displayed (
12) — the metadata version guard accepts it, so the unfixed component resyncs the draft to "12" mid-edit and blur commits 12 instead of the typed 0. (Merely delaying the echo cannot pin the bug: the optimistic cache update means the echo carries the number the input already shows, so the resync is invisible.) A/B verified: red on the pre-fix component (Expected: "0", Received: "12"at the mid-edit assertion) and green 3/3 with the fix.Verification round (second commit): an adversarial review pass over the first commit found and fixed three things — (1) the original held-PATCH test choreography was vacuous and could have flaked against the fixed component, hence the forged-echo redesign above; (2) the unmount flush turned
GameCharacterSheet's torn-down mid-edit case from a silent drop into a latent misdirected write (index-captured commits landing in a reseeded draft), so the Edit button now reseeds the draft from the live card on entry; (3) two robustness gaps in the new component code (commitRefnow assigned in a layout effect; the editing latch drops when the input is disabled mid-edit, since the browser fires no blur for that). The same pass exonerated the drawer-internal tree as a remount source, refuted the whole-drawer-remount theory, and confirmed a real field remount vector in unguarded chat-cache writers — filed separately as #5641 (this PR's unmount flush absorbs its symptom).Validation
pnpm check— passing (full build).desktop-chromium -g "Secret Plot"— deterministic A/B: red pre-fix, green 3/3 post-fix (--retries=0).commitOnValidChangesites, popover/drawer dismiss paths, and slider-pair concerns were checked against consumer code and verified safe (no spurious or double commits).commitOnValidChangefield (Settings → the auto-commit numeric fields) still commits while typing and clamps on blur.Summary by CodeRabbit
Bug Fixes
Tests
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.