Skip to content

fix(storage): publish ER position after persistence - #2840

Merged
openai0229 merged 3 commits into
OtterMind:mainfrom
HandSonic:fix/er-position-atomic
Sep 16, 2026
Merged

openai0229 merged 3 commits into
OtterMind:mainfrom
HandSonic:fix/er-position-atomic

Conversation

@HandSonic

@HandSonic HandSonic commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Related issue

N/A - no matching issue was found.

Summary

ERPositionStorage.savePosition modified the live cached object before the base storage write completed. A write failure therefore left memory showing the new position while disk and a reloaded instance retained the old value. This change builds a detached candidate list, persists it first, and publishes only the successful replacement/generated ID.

Affected surfaces

  • Frontend / Web
  • Backend / API / Storage
  • Database plugin / Driver
  • JCEF / Desktop packaging
  • CI / Build / Release
  • Documentation only

Verification

  • Reproduced on main: 5 ER tests ran, with one failure showing the new in-memory position after a failed write while disk/reload retained the old value.
  • Latest-main integration tests and owning reactor package passed: storage 71, tools 77, domain-api 27; 175 total, zero failures/errors/skips.
  • Command: mvn -B -ntp -f chat2db-community-server/pom.xml -pl :chat2db-community-storage -am -Dmaven.test.skip=false -DskipTests=false '-Dsurefire.includes=**/*Test.java' -Dsurefire.failIfNoSpecifiedTests=false -Dmaven.test.failure.ignore=false package. Test JVM home/temp directories were isolated.
  • Executable backend package and Playwright CLI verification passed using two isolated SQLite datasources: real mouse drags, consecutive layout updates, refresh, backend restart, reset layout and retry after permission recovery. Browser node coordinates were compared with actual save requests and persisted positions.
  • Real storage-directory write denial covered first insertion and replacement: memory and file bytes were unchanged, other datasource layouts were preserved, and refresh restored the persisted layout.
  • Zoom, fit-view and Escape did not write positions. The flow auto-saves and has no save-cancellation dialog.
  • Both PR files are byte-identical to the Web-tested version; newer main changes are outside the ER persistence path. New-head CI is available in PR checks.
  • Existing frontend limitation observed: save failures are not shown to the user, and the optimistic position remains until refresh. The unchanged frontend does not handle the rejected promise; this is recorded separately from the storage fix.

Risk and compatibility

  • Public API or stored data: Existing JSON format and method signatures are unchanged.
  • Database or driver compatibility: N/A.
  • Network, privacy, or security: N/A.
  • Community / Local / Pro boundary: Shared Community ER layout storage.
  • Backward compatibility: Successful inserts/updates preserve existing lookup keys and IDs.

Reviewer map

  • Start here: ERPositionStorage.savePosition and its failure regression test.
  • Failure condition: a failed write changes memory, caller ID, file bytes, or reload state.
  • Rollback or disable path: Revert this PR; no migration is required.

Contributor declaration

  • I linked the Issue that defines this change.
  • I tested the affected behavior and reported the actual results above.
  • I did not include credentials, private data, or generated build output.
  • I disclosed substantial AI assistance below, or this PR contains no substantial AI-generated code.

AI assistance: OpenAI Codex assisted with diagnosis, implementation, deterministic tests, verification, and adversarial review.

@HandSonic
HandSonic requested review from a team and openai0229 as code owners August 31, 2026 03:16
@openai0229 openai0229 moved this to In Review in Chat2DB Community Aug 31, 2026
@HandSonic
HandSonic force-pushed the fix/er-position-atomic branch 2 times, most recently from 8ef64fc to 6715494 Compare September 3, 2026 08:08
@HandSonic
HandSonic force-pushed the fix/er-position-atomic branch from 6715494 to 08d47e8 Compare September 3, 2026 21:08
@openai0229
openai0229 merged commit 02f9ce7 into OtterMind:main Sep 16, 2026
18 of 19 checks passed
@openai0229 openai0229 moved this from In Review to Done in Chat2DB Community Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants