Skip to content

Conversation

sebjulliand
Copy link
Member

Changes

This PR fixes the Global storage (used to store the last connection and the cached server settings). It used to use the same BaseStorage object reference as the connection storage. That broke the global storage behavior since it had a storage prefix key assigned once connected (because connecting sets a prefix key on the connection storage...but since the global storage used the same BaseStorage as the connection, it lost its purpose).

Fixing the global storage fixes the "connect to last connected IBM i" action and the cached server settings access.

The quickConnect parameter was also not correctly tested, preventing quick connect from happening when connecting.

How to test this PR

  • From a local terminal: Run npm run test to run the test suites
  • From a debug session
    • Connect to a system and reload settings
    • Disconnect
    • Check that the system you just connected to is marked as the last connected system (yellow icon)
    • Re-connect normally: it must connect faster than when reloading the settings

Checklist

  • have tested my change

@sebjulliand sebjulliand requested a review from a team September 7, 2025 21:36
@sebjulliand sebjulliand self-assigned this Sep 7, 2025
@sebjulliand sebjulliand added the bug A confirmed issue when something isn't working as intended label Sep 7, 2025
@sebjulliand sebjulliand temporarily deployed to testing_environment September 7, 2025 21:36 — with GitHub Actions Inactive
Signed-off-by: Seb Julliand <[email protected]>
@sebjulliand sebjulliand temporarily deployed to testing_environment September 7, 2025 21:37 — with GitHub Actions Inactive
Copy link
Contributor

github-actions bot commented Sep 7, 2025

👋 A new build is available for this PR based on efd0a8b.

Copy link
Contributor

github-actions bot commented Sep 7, 2025

👋 A new build is available for this PR based on 7b2d1bc.

Copy link
Contributor

github-actions bot commented Sep 7, 2025

👋 A new build is available for this PR based on f2df2da.

Signed-off-by: Seb Julliand <[email protected]>
@sebjulliand sebjulliand temporarily deployed to testing_environment September 8, 2025 08:05 — with GitHub Actions Inactive
.gitignore Outdated
dist
.DS_Store
.env
.*
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why this change? Now changes to the file .env.sample in src\api won't be committed.
Isn't it better to have a positive list of files to ignore, instead of a global ignore, and let it be up to the committer to ensure that no secrets are included?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like the files .env and .env.sample should not be located in src\api\ and should be moved to the src\api\tests\ subdirectory instead - they are used by the tests framework and nowhere else. Agree?

Copy link
Member Author

Choose a reason for hiding this comment

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

Excluding all dot files is a common practice; I thought it would be good to enforce it here instead of listing all the unwanted dot files or folder.
Since .env.sample has already been synchronized with Git, any change made to it will actually be committed. But I'll add an exception because, as you suggested, it should be moved elsewhere.

Indeed, moving .env/.env.sample elsewhere sounds like a good idea.

@chrjorgensen
Copy link
Collaborator

@sebjulliand Thanks for fixing the storage issue! It's been annoying me for quite a while now, but seemed to complicated for me to try and fix it myself - the TypeScript guru to the rescue! ❤️ 👍

I will give it a spin...

@chrjorgensen chrjorgensen self-requested a review September 8, 2025 11:44
Copy link
Collaborator

@chrjorgensen chrjorgensen left a comment

Choose a reason for hiding this comment

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

@sebjulliand I ran the suggested tests, and npm run test ran without issues, but when I ran the extension in debug, I found that

  • no connection is set as previous after disconnect, i.e. no >< in yellow in the Connection browser
  • the connection does not appear any faster on subsequent connection attempts, so Quick Connect does not seem to work still...

?

@sebjulliand
Copy link
Member Author

Eek, that's weird. If you put a breakpoint in the connection process, anywhere after line 311 in IBMi.ts, what does the quickconnect method returns for you?

@chrjorgensen
Copy link
Collaborator

Sorry for the delay... work, you know... 😉

When I put a breakpoint in line 306 in IBMi.ts, I see reloadServerSettings is undefined:

image

So quickConnect will always return false?

@sebjulliand
Copy link
Member Author

@chrjorgensen it used to always return false because reloadServerSettings was either undefined or true, depending on the action taken to connect.

With my change, quickConnect must return true if reloadServerSettings is false or undefined:

this.config!.quickConnect === true && !options.reloadServerSettings

Try adding a Log point on line 312 with this value:
image
image

And then what goes in the Debug Output tab.

@chrjorgensen chrjorgensen self-requested a review September 10, 2025 08:28
Copy link
Collaborator

@chrjorgensen chrjorgensen left a comment

Choose a reason for hiding this comment

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

@sebjulliand After adding the log point, I see QuickConnect is false on every connection, even after disconnect and immediate reconnect. My connection has Quick Connect enabled...

@sebjulliand sebjulliand temporarily deployed to testing_environment September 10, 2025 14:27 — with GitHub Actions Inactive
@sebjulliand
Copy link
Member Author

I don't get it...if I break after line 312 and run this in the Debug Console:
image

And it does quick connect...on two different computers.
Well, I'll add the Boolean(...) in quickConnect just to be sure.

@sebjulliand sebjulliand temporarily deployed to testing_environment September 10, 2025 14:33 — with GitHub Actions Inactive
Signed-off-by: Seb Julliand <[email protected]>
@sebjulliand sebjulliand temporarily deployed to testing_environment September 10, 2025 14:37 — with GitHub Actions Inactive
@chrjorgensen
Copy link
Collaborator

@sebjulliand I found the issue with your changes not working on my laptop - the GitHub extension had not checked out the current changes completely, and my test was run on an older version of your code! 😡

I deleted the branch and checked it out again - and now it all worked, of course! 🎉

I will approve and merge - thank you! 🫶

@chrjorgensen chrjorgensen self-requested a review September 11, 2025 17:18
@chrjorgensen chrjorgensen merged commit 31c6748 into master Sep 11, 2025
5 checks passed
@sebjulliand sebjulliand deleted the fix/storages branch September 12, 2025 07:57
@sebjulliand
Copy link
Member Author

Great, thank you @chrjorgensen ! I'm relieved that it was just the extension messing around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A confirmed issue when something isn't working as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants