Skip to content

Conversation

@sfc-gh-mraba
Copy link
Contributor

@sfc-gh-mraba sfc-gh-mraba commented Oct 1, 2025

Pre-review checklist

  • I've confirmed that instructions included in README.md are still correct after my changes in the codebase.
  • I've added or updated automated unit tests to verify correctness of my new code.
  • I've added or updated integration tests to verify correctness of my new code.
  • I've confirmed that my changes are working by executing CLI's commands manually on MacOS.
  • I've confirmed that my changes are working by executing CLI's commands manually on Windows.
  • I've confirmed that my changes are up-to-date with the target branch.
  • I've described my changes in the release notes.
  • I've described my changes in the section below.
  • I've described my changes in the documentation.

Changes description

This PR refactors the Snowflake CLI configuration management by removing the module-level CONFIG_MANAGER singleton and replacing it with a factory-based approach managed through the CliGlobalContext. This change improves testability and eliminates test flakiness caused by shared global state.


def __init__(self):
self._cache_file = _VersionCache._version_cache_file
self._cache_file = self._version_cache_file
Copy link
Contributor

Choose a reason for hiding this comment

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

The property _version_cache_file is now a method rather than a class variable, but it's still being evaluated immediately during initialization when assigned to self._cache_file. This defeats the purpose of lazy evaluation.

Consider modifying this approach to truly implement lazy loading:

def __init__(self):
    self._cache_file = None  # Initialize as None

@property
def _cache_file(self):
    if self.__cache_file is None:
        self.__cache_file = self._version_cache_file
    return self.__cache_file

@_cache_file.setter
def _cache_file(self, value):
    self.__cache_file = value

This way, the property is only evaluated when first accessed, not during initialization.

Spotted by Diamond

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@sfc-gh-mraba sfc-gh-mraba force-pushed the SNOW-2306184-ng-config-support-3 branch from 54e7ad4 to 52151dd Compare October 2, 2025 08:37
@sfc-gh-mraba sfc-gh-mraba self-assigned this Oct 2, 2025
@sfc-gh-mraba sfc-gh-mraba force-pushed the SNOW-2306184-ng-config-support-3 branch 2 times, most recently from 99a467d to c32692c Compare October 13, 2025 06:57
@sfc-gh-mraba sfc-gh-mraba force-pushed the SNOW-2306184-ng-config-support-3 branch from 68ccdbc to ee5e0ce Compare October 21, 2025 08:42
@sfc-gh-mraba sfc-gh-mraba marked this pull request as ready for review October 21, 2025 08:43
@sfc-gh-mraba sfc-gh-mraba requested a review from a team as a code owner October 21, 2025 08:43
@sfc-gh-mraba sfc-gh-mraba force-pushed the SNOW-2306184-ng-config-support-3 branch from ee5e0ce to 2484c26 Compare October 21, 2025 12:34
Copy link
Contributor

@sfc-gh-jwilkowski sfc-gh-jwilkowski left a comment

Choose a reason for hiding this comment

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

I left 1 important question about connections_file_override which does not seem to be needed (maybe yet?). Otherwise a general comment would be about recurring issues across this PR:

  • lots of local imports, where I don't think most of them would cause circular deps
  • lots of comments that don't add much value
  • I've seen this pattern repeating several times - maybe path resolver could go into SecurePath so that we can avoid repeating those?
# Resolve Windows short paths to prevent cleanup issues
resolved_tmp_dir = path_resolver(tmp_dir)
config_path = Path(resolved_tmp_dir) / "config.toml"

Otherwise, looks great!

@sfc-gh-mraba sfc-gh-mraba force-pushed the SNOW-2306184-ng-config-support-3 branch from 2484c26 to 66356e5 Compare October 23, 2025 12:57
@sfc-gh-mraba sfc-gh-mraba force-pushed the SNOW-2306184-ng-config-support-3 branch from af729e4 to 304a27a Compare November 3, 2025 08:05
@sfc-gh-mraba sfc-gh-mraba force-pushed the SNOW-2306184-ng-config-support-3 branch from 304a27a to 927bc4f Compare November 17, 2025 09:10
@sfc-gh-mraba sfc-gh-mraba force-pushed the SNOW-2306184-ng-config-support-3 branch from 927bc4f to 0454d1a Compare November 25, 2025 14:09
@sfc-gh-mraba sfc-gh-mraba force-pushed the SNOW-2306184-ng-config-support-3 branch from 0454d1a to c02a716 Compare December 2, 2025 12:33
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.

3 participants