Keep JetBrains connections and settings across an IDE restart (0.4.2) - #17
Merged
Conversation
The Marketplace page was updated by hand; this is the same text, so the next release republishes it rather than reverting to the old copy. Adds what was missing: reusing a DataGrip or IDEA Ultimate data source, charts and CSV export, and what the plugin costs while idle. Corrects the privacy line, which said rows never reach the model without noting the sample-values setting that can send them, and moves the MongoDB and DuckDB caveat into parentheses so the read-only claim reads first.
IntelliJ's xmlb serializer collects only non-final fields. Every field in AskSqlAppState, AskSqlProjectState and ConnectionState was a Kotlin val, so each one was dropped on save with no error: connections, provider, model, base URL, row caps, custom instructions and the glossary were written empty and read back empty on the next start. requireApproval was part of the same state, so switching it on bought an approval step that was gone after the next restart. The round trip is covered three ways: through the state object, through XmlSerializer, and by a reflection guard that fails on any final field in a state class. loadState(getState()) alone proves nothing here, since it hands back the same instance without touching the serializer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
0dc65db(plugin description) was already on develop and rides along.What was wrong
IntelliJ's xmlb serializer collects only non-final fields. Every field in
AskSqlAppState,AskSqlProjectStateandConnectionStatewas declaredval, so each was dropped on save with noerror, no warning and nothing in the log. Connections, provider, model, base URL, row caps, custom
instructions and the glossary were written empty and read back empty on the next start.
requireApprovalwas part of the same state: switching it on bought an approval step that was goneafter the next restart.
The outer
connectionsfield is a finalList, which xmlb does persist (its contents can be filledin place), so the list length survived and only the elements came back blank. That reads as a
serialization quirk rather than total loss, which is part of why it went unnoticed.
Tests
Three levels, because the obvious test proves nothing:
loadState(getState())hands back the samein-memory instance and never touches the serializer, so it passes on a state class that persists
nothing.
ConnectionPersistenceTestcovers the state object round trip.ConnectionXmlPersistenceTestgoes throughXmlSerializer, which is what a restart does.SettingsXmlPersistenceTestcovers every app setting and adds a reflection guard that fails on anyfinal field in a state class, so a new field cannot reintroduce this.
Each was checked by reverting the fix and confirming it goes red.
Verification
JetBrains unit suite green. Integration suite ran separately against live Postgres, MySQL, Oracle
and MongoDB: 111 tests, 0 failures, 0 skipped.