Skip to content

SNOW-3081273: fix Creating a stored procedure locally results in an unsupported version of cloudpicker#4234

Merged
sfc-gh-yuwang merged 4 commits into
mainfrom
SNOW-3081273
Jun 2, 2026
Merged

SNOW-3081273: fix Creating a stored procedure locally results in an unsupported version of cloudpicker#4234
sfc-gh-yuwang merged 4 commits into
mainfrom
SNOW-3081273

Conversation

@sfc-gh-yuwang

@sfc-gh-yuwang sfc-gh-yuwang commented May 21, 2026

Copy link
Copy Markdown
Collaborator
  1. Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes SNOW-3081273

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
      • If this test skips Local Testing mode, I'm requesting review from @snowflakedb/local-testing
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am adding new credentials
    • I am adding a new dependency
    • If this is a new feature/behavior, I'm adding the Local Testing parity changes.
    • I acknowledge that I have ensured my changes to be thread-safe. Follow the link for more information: Thread-safe Developer Guidelines
    • If adding any arguments to public Snowpark APIs or creating new public Snowpark APIs, I acknowledge that I have ensured my changes include AST support. Follow the link for more information: AST Support Guidelines
  3. Please describe how your code solves the related issue.

    This PR fixes a Python 3.13 local-registration issue for Snowpark UDFs/stored procedures by changing auto-injected cloudpickle dependency specs from strict pins (==) to compatible lower bounds (>=), so server-side resolution can choose a supported version instead of failing on an exact local version match.

This change is safe because cloudpickle is backward compatible, meaning higher version can deserialize encoding create by lower version

…g a Python stored procedure or UDF with `runtime_version='3.13'`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov-commenter

codecov-commenter commented May 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.39%. Comparing base (2ec6d7b) to head (d461e18).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4234   +/-   ##
=======================================
  Coverage   95.39%   95.39%           
=======================================
  Files         171      171           
  Lines       44241    44243    +2     
  Branches     7556     7557    +1     
=======================================
+ Hits        42204    42206    +2     
  Misses       1250     1250           
  Partials      787      787           

☔ View full report in Codecov by Sentry.
📢 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.

@sfc-gh-yuwang

Copy link
Copy Markdown
Collaborator Author

@sfc-gh-yuwang sfc-gh-yuwang marked this pull request as ready for review June 1, 2026 21:01
@sfc-gh-yuwang sfc-gh-yuwang requested review from a team as code owners June 1, 2026 21:01


@pytest.mark.skipif(IS_IN_STORED_PROC, reason="not supported in stored proc")
def test_sproc_runtime_313_cloudpickle_ge_spec_compiles_and_executes(session):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not blocking: since this test specifies python==3.13, wondering whether other test matrices with 3.11, 3.12 etc would execute this? Would this be potentially flaky for other python versions, though the merge gate seems to be passing here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think this should be good even if 3.11/3.12 execute this test.
so this change is only making sure that cloudpickle can be correctly picked in stored proc. Say if 3.12 execute this with cloudpickle 2.2.1, it will try to pick cloudpickle >=2.2.1 for py313, as long as this cloudpickle pkg exist on server, the test would not fail. For the situation the test do fail, I think that is more of a packaging issue instead of flakiness

Comment thread src/snowflake/snowpark/session.py Outdated
res.append(m)
elif isinstance(m, ModuleType) and m.__name__ not in result_dict:
res.append(f"{m.__name__}=={m.__version__}")
res.append(f"{m.__name__}>={m.__version__}")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Seems like cloudpickle is the only ModuleType that goes through this check now, so we're good. but >= applies to any module a future caller might pass. Can we maybe add a one-line comment noting the intent so nobody fixes it back to ==, or limit the >= logic to cloudpickle only?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

great call out! I'll limit this to only cloudpickle

@sfc-gh-yuwang sfc-gh-yuwang merged commit 495acce into main Jun 2, 2026
31 checks passed
@sfc-gh-yuwang sfc-gh-yuwang deleted the SNOW-3081273 branch June 2, 2026 16:42
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants