Skip to content

Keep JetBrains connections and settings across an IDE restart (0.4.2) - #17

Merged
rahulmahadik merged 2 commits into
mainfrom
develop
Aug 8, 2026
Merged

Keep JetBrains connections and settings across an IDE restart (0.4.2)#17
rahulmahadik merged 2 commits into
mainfrom
develop

Conversation

@rahulmahadik

Copy link
Copy Markdown
Owner

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,
AskSqlProjectState and ConnectionState was declared val, so each was dropped on save with no
error, 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.

requireApproval was part of the same state: switching it on bought an approval step that was gone
after the next restart.

The outer connections field is a final List, which xmlb does persist (its contents can be filled
in 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 same
in-memory instance and never touches the serializer, so it passes on a state class that persists
nothing.

  • ConnectionPersistenceTest covers the state object round trip.
  • ConnectionXmlPersistenceTest goes through XmlSerializer, which is what a restart does.
  • SettingsXmlPersistenceTest covers every app setting and adds a reflection guard that fails on any
    final 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.

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.
@rahulmahadik
rahulmahadik merged commit 7da452a into main Aug 8, 2026
13 checks passed
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.

1 participant