Skip to content

fix(vscode): keep the saved Hub URL when you disconnect - #3516

Merged
markscott-ms merged 3 commits into
finos:mainfrom
tnalbant:fix/hub-url-kept-on-disconnect
Oct 27, 2026
Merged

markscott-ms merged 3 commits into
finos:mainfrom
tnalbant:fix/hub-url-kept-on-disconnect

Conversation

@tnalbant

@tnalbant tnalbant commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Description

disconnectFromHub() cleared calm.hub.url on every path, so "Disconnect" from the status bar and the calm.disconnectFromHub command both forgot the URL. The next click on the status bar opened an empty URL box, while the tooltip still said "Click to reconnect".

Clearing the setting itself is not a bug: #3376 added it for the error menu's "Clear URL", so autoConnect does not retry a Hub that just failed. The bug is that the successful "Disconnect" path shares that function.

  • disconnectFromHub({ clearUrl }) keeps the URL unless the caller asks for clearUrl: true.
  • The error menu's "Clear URL" is now its own action (clearUrl) and passes that flag.
  • The menu items moved into hubMenuItems(state), so both branches are covered by tests instead of being built inline.

Closes #3494

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change
  • 📚 Documentation update
  • 🎨 Code style/formatting changes
  • ♻️ Refactoring (no functional changes)
  • ⚡ Performance improvements
  • ✅ Test additions or updates
  • 🔧 Chore

Affected Components

  • VS Code Extension (calm-plugins/vscode/)
  • everything else

Commit Message Format

fix(vscode): keep the saved Hub URL when you disconnect

Testing

Red first, the new tests against the unpatched extension.ts:

$ npx vitest run src/extension/extension.test.ts
 × keeps the saved URL so the status bar can reconnect
 × keeps the saved URL when the disconnect command runs
AssertionError: expected [ { section: 'calm.hub', …(2) } ] to deeply equal []

That assertion is the bug: the registered command wrote undefined into calm.hub.url.

With the fix:

$ npx vitest run src/extension/extension.test.ts
 Test Files  1 passed (1)
      Tests  5 passed (5)

$ npx vitest run            # whole plugin
 Test Files  54 passed (54)
      Tests  619 passed | 1 todo (620)

The tests cover the direct call, the calm.disconnectFromHub command path, clearUrl: true, and both menu states.

npx tsc -p tsconfig.extension.json --noEmit reports the same two errors before and after this change (hub-client.ts:108, generic-svg-parser.ts:1 — the second is a missing @types package in my filtered install), so the diff adds no type errors.

  • I have tested my changes locally
  • I have added/updated unit tests
  • All existing tests pass (619 passed, 1 todo; the two tsc errors above are pre-existing)

Checklist

  • My commits follow the conventional commit format
  • I have updated documentation if necessary — the behaviour now matches the tooltip that already existed, so no doc change
  • I have added tests for my changes
  • My changes follow the project's coding standards (eslint on the touched files — see the note below)

Notes

npm run lint cannot run in my checkout: the filtered install I used for the extension workspace does not install the root globals dependency that eslint.config.mjs imports. eslint on the two touched files is otherwise clean, but CI's lint job is the authoritative check here.

"Disconnect" and the calm.disconnectFromHub command cleared calm.hub.url,
so the status bar's "Click to reconnect" opened an empty URL box. Clearing
the setting is only meant for the error menu's "Clear URL", which finos#3376
added so autoConnect stops retrying a Hub that failed.

disconnectFromHub now takes { clearUrl } and leaves the URL alone by
default. The menu items move into hubMenuItems() so both states are
covered by tests: connected offers Disconnect, failed offers Clear URL.

Fixes finos#3494
@tnalbant
tnalbant requested a review from a team as a code owner October 26, 2026 22:27
@linux-foundation-easycla

linux-foundation-easycla Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: tnalbant / name: Turgay Nalbant (7c81702)

@rocketstack-matt

Copy link
Copy Markdown
Member

@tnalbant thanks for the contribution, please sign the CLA, we cannot accept any contributions without it.

@rocketstack-matt rocketstack-matt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add Closes #3494 to the description, so that the merge closes the issue.

Comment thread calm-plugins/vscode/src/extension/extension.test.ts Outdated
Comment thread calm-plugins/vscode/src/extension/extension.ts
rocketstack-matt and others added 2 commits October 27, 2026 08:52
Two review points on finos#3516:

- The `getConfiguration` stub returned a URL and left `autoConnect` at its
  default, so `activate()` started a real connection to
  `https://calmhub.example.com` in every test. The stub now reports
  `autoConnect: false`, and a test asserts that activating the extension sends
  no request.
- No test drove the `clearUrl` branch: calling `disconnectFromHub()` without
  the flag kept the suite green. A test now fails the connection (`fetch`
  rejects), reopens the menu through the registered `calm.connectToHub`
  command, picks Clear URL, and asserts the URL update.

Both tests were checked against the mutation the review described: reverting
the stub or the `clearUrl` call turns exactly one of them red.

Refs finos#3494
@tnalbant

Copy link
Copy Markdown
Contributor Author

Both points are in at ff3bd478bd.

extension.test.ts stub: autoConnect now returns false, so activate() no longer starts a connection. The new does not connect while autoConnect is off test installs a fetch stub, calls activate() and asserts nothing is sent; removing the stub line makes it fail with expected "vi.fn()" to not be called at all, but actually been called 1 times — the request you spotted.

clearUrl branch: the new test fails the connection (vi.stubGlobal('fetch', …rejected)), reopens the menu through the registered calm.connectToHub command, asserts the placeholder reads Failed to connect, returns the Clear URL item from showQuickPick, and asserts the single url: undefined config update. Replacing disconnectFromHub({ clearUrl: true }) with a plain disconnectFromHub() turns it red: expected [] to deeply equal [ { section: 'calm.hub', …(2) } ].

npx vitest run                                54 files, 621 passed | 1 todo (622)
npx eslint src/extension/extension.test.ts    clean

npx tsc -p tsconfig.extension.json --noEmit still reports only the two errors that are on main (hub-client.ts:108, the missing @types/svg-parser).

@markscott-ms
markscott-ms dismissed rocketstack-matt’s stale review October 27, 2026 13:01

I've reviewed the requested changes and checked with rocketstack-matt that he's ok to dimiss

@markscott-ms
markscott-ms merged commit 64b3b5d into finos:main Oct 27, 2026
22 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.

VS Code plugin: Disconnect from CALM Hub also forgets the Hub URL

3 participants