fix(er-position): persist the new position, not the old record - #2163
Conversation
|
Updating the stored position on the existing record is the right fix, but this PR is not ready to merge without persistence regression coverage. Please add an automated storage test that saves an ER position, saves a different position for the same logical key, reloads it, and asserts that the new position is returned and no duplicate record was inserted. Rebase onto the latest |
openai0229
left a comment
There was a problem hiding this comment.
The persistence fix still lacks a save-update-reload regression test proving the new position replaces the old record without duplication. The current head does not address the detailed review comment already posted, so this remains blocked pending an updated commit and re-review.
savePosition found the existing record p (with the old position) and called update(p), discarding param's new position. Copy param's position into p before updating. Fixes OtterMind#2160 Co-Authored-By: Claude <noreply@anthropic.com>
7e2f775 to
2504b7a
Compare
|
Rebased onto latest main. Added 4 regression tests in ERPositionStorageTest:
Tests run: 4, Failures: 0. |
openai0229
left a comment
There was a problem hiding this comment.
The storage path now persists the incoming ER position and the regression test verifies the value after a fresh reload from an isolated temporary file. File injection and lazy singleton initialization keep the production path intact while making the behavior testable. Storage and upstream module tests pass. Maintainer review complete; awaiting required checks before merge.
Related issue
Closes #2160
Summary
ERPositionStorage.savePosition found the existing record p (carrying the OLD position) and called update(p), discarding param's new position. The ER diagram layout could never be updated for an existing (dataSourceId, databaseName, schemaName) key. Fixed by copying param's position into p before updating: p.setPosition(param.getPosition()); update(p);.
Verification
Contributor declaration
AI assistance: The fix, verification, and PR description were produced with Claude Code assistance.