Skip to content

Navigation Menu

Sign in
Sign up

SNOW-2912540: mock _connect on v5 so local testing skips UD connection_init - #4326

Open
sfc-gh-fpawlowski wants to merge 10 commits into
SNOW-2912540-log-batch-mock-patch from
SNOW-2912540-mock-ud-connect-hook
Open

SNOW-2912540: mock _connect on v5 so local testing skips UD connection_init #4326
sfc-gh-fpawlowski wants to merge 10 commits into
SNOW-2912540-log-batch-mock-patch from
SNOW-2912540-mock-ud-connect-hook

Conversation

@sfc-gh-fpawlowski

@sfc-gh-fpawlowski sfc-gh-fpawlowski commented Aug 21, 2026
edited
Loading

Copy link
Copy Markdown
Collaborator

Summary

MockedSnowflakeConnection (Local Testing's mock connection class) subclasses the real SnowflakeConnection and overrides connect() to a no-op, avoiding a real network connection attempt during local testing sessions.

On v5 (UD), Connection.__init__ calls the private _connect() internally instead of the public connect() the legacy v4 connector called. Since the mock override was only named connect, UD's real _connect() ran unmocked on IS_V5_DRIVER=True, attempting a genuine connection attempt requiring real account credentials — surfacing as an account/credentials error in local-testing sessions that should never touch the network at all.

Fix: on v5, alias _connect = connect so the existing mock override is actually invoked by UD's __init__ path.

Known gap: no dedicated test exercises this specific IS_V5_DRIVER=True code path (unverifiable without a UD wheel installed, same caveat as the rest of this stack). Flagging for reviewer awareness rather than holding up this draft.

Stacked on #4321.

Test plan

  • flake8/black clean
  • Full tests/unit/+tests/mock/ suite passes for v4 (2916 passed) — this branch doesn't change v4 behavior at all
  • No test coverage for the IS_V5_DRIVER=True path itself

🤖 Generated with Claude Code

sfc-gh-fpawlowski commented Aug 21, 2026
edited
Loading

Copy link
Copy Markdown
Collaborator Author

cursor Bot force-pushed the SNOW-2912540-log-batch-mock-patch branch from 2257b69 to f1ab28e Compare September 2, 2026 06:45
cursor Bot force-pushed the SNOW-2912540-mock-ud-connect-hook branch from e167ad3 to f0eb42e Compare September 2, 2026 06:45

@snowflake-security-bot snowflake-security-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Snowflake Security Review

Security grade: A — Passed

This PR was classified as LOW risk by the automated pre-screen.

@snowflake-security-bot snowflake-security-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Snowflake Security Review

Security grade: A — Passed

This PR was classified as LOW risk by the automated pre-screen.

cursoragent and others added 2 commits September 2, 2026 17:39
...ck-ud-connect-hook
Co-authored-by: Filip Pawłowski <sfc-gh-fpawlowski@users.noreply.github.com>
Class-body if/else method defs were rewritten by black in CI. Define
connect() once and alias _connect on IS_V5_DRIVER so UD __init__ hits
the same no-op as the legacy connect() override.
Co-authored-by: Filip Pawłowski <sfc-gh-fpawlowski@users.noreply.github.com>

@snowflake-security-bot snowflake-security-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Snowflake Security Review

Security grade: A — Passed

This PR was classified as LOW risk by the automated pre-screen.

@snowflake-security-bot snowflake-security-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Snowflake Security Review

Security grade: A — Passed

This PR was classified as LOW risk by the automated pre-screen.

@snowflake-security-bot snowflake-security-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Snowflake Security Review

Security grade: A — Passed

This PR was classified as LOW risk by the automated pre-screen.

...ck-ud-connect-hook
Co-authored-by: Filip Pawłowski <sfc-gh-fpawlowski@users.noreply.github.com>

@snowflake-security-bot snowflake-security-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Snowflake Security Review

Security grade: A — Passed

This PR was classified as LOW risk by the automated pre-screen.

@snowflake-security-bot snowflake-security-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Snowflake Security Review

Security grade: A — Passed

This PR was classified as LOW risk by the automated pre-screen.

...ck-ud-connect-hook
Co-authored-by: Filip Pawłowski <sfc-gh-fpawlowski@users.noreply.github.com>

@snowflake-security-bot snowflake-security-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Snowflake Security Review

Security grade: A — Passed

This PR was classified as LOW risk by the automated pre-screen.

@snowflake-security-bot snowflake-security-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Snowflake Security Review

Security grade: A — Passed

This PR was classified as LOW risk by the automated pre-screen.

...ck-ud-connect-hook
Co-authored-by: Filip Pawłowski <sfc-gh-fpawlowski@users.noreply.github.com>

@snowflake-security-bot snowflake-security-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Snowflake Security Review

Security grade: A — Passed

This PR was classified as LOW risk by the automated pre-screen.

@snowflake-security-bot snowflake-security-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Snowflake Security Review

Security grade: A — Passed

This PR was classified as LOW risk by the automated pre-screen.

...ck-ud-connect-hook
Co-authored-by: Filip Pawłowski <sfc-gh-fpawlowski@users.noreply.github.com>

@snowflake-security-bot snowflake-security-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Snowflake Security Review

Security grade: A — Passed

This PR was classified as LOW risk by the automated pre-screen.

codecov-commenter commented Sep 2, 2026
edited
Loading

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.21%. Comparing base (cc430d8) to head (17b2848).

Additional details and impacted files
@@ Coverage Diff @@
## SNOW-2912540-log-batch-mock-patch #4326 +/- ##
==================================================================
 Coverage 95.21% 95.21% 
==================================================================
 Files 172 172 
 Lines 44811 44811 
 Branches 7692 7692 
==================================================================
 Hits 42668 42668 
 Misses 1351 1351 
 Partials 792 792 

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@snowflake-security-bot snowflake-security-bot[bot] snowflake-security-bot[bot] left review comments
@sfc-gh-yuwang sfc-gh-yuwang sfc-gh-yuwang approved these changes
@sfc-gh-mayliu sfc-gh-mayliu Awaiting requested review from sfc-gh-mayliu sfc-gh-mayliu is a code owner automatically assigned from snowflakedb/snowpark-python-api-reviewers
@sfc-gh-bkogan sfc-gh-bkogan Awaiting requested review from sfc-gh-bkogan sfc-gh-bkogan is a code owner automatically assigned from snowflakedb/snowpark-python-api-reviewers

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /