Repository navigation
fix(vscode): keep the saved Hub URL when you disconnect - #3516
Conversation
"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 thanks for the contribution, please sign the CLA, we cannot accept any contributions without it. |
rocketstack-matt
left a comment
There was a problem hiding this comment.
Please add Closes #3494 to the description, so that the merge closes the issue.
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
|
Both points are in at
|
I've reviewed the requested changes and checked with rocketstack-matt that he's ok to dimiss
Description
disconnectFromHub()clearedcalm.hub.urlon every path, so "Disconnect" from the status bar and thecalm.disconnectFromHubcommand 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
autoConnectdoes 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 forclearUrl: true.clearUrl) and passes that flag.hubMenuItems(state), so both branches are covered by tests instead of being built inline.Closes #3494
Type of Change
Affected Components
calm-plugins/vscode/)Commit Message Format
fix(vscode): keep the saved Hub URL when you disconnectTesting
Red first, the new tests against the unpatched
extension.ts:That assertion is the bug: the registered command wrote
undefinedintocalm.hub.url.With the fix:
The tests cover the direct call, the
calm.disconnectFromHubcommand path,clearUrl: true, and both menu states.npx tsc -p tsconfig.extension.json --noEmitreports the same two errors before and after this change (hub-client.ts:108,generic-svg-parser.ts:1— the second is a missing@typespackage in my filtered install), so the diff adds no type errors.tscerrors above are pre-existing)Checklist
eslinton the touched files — see the note below)Notes
npm run lintcannot run in my checkout: the filtered install I used for the extension workspace does not install the rootglobalsdependency thateslint.config.mjsimports.eslinton the two touched files is otherwise clean, but CI's lint job is the authoritative check here.