Repository navigation
fix(external-function): manage signatures and grants - #90
Conversation
|
Reviewed this PR (full external-function signature/grant handling). Found three real issues via code-review, verified each by running the actual code in a worktree:
Minor: Ponytail/complexity pass: lean, nothing to cut, this diff even removes speculative code (the Separate heads-up, not a code issue: this PR and #84 both independently add |
|
@GClunies checking in on this one, it's been quiet since my review on Oct 13 and it's the oldest branch open. Two things in your favour, both verified just now rather than assumed:
So the only thing standing between this and merge is finding 1, the Are you planning to pick this back up? If you'd rather not, I'm happy to push the fix to your branch or take it over, just say which. |
…nto lineup/adhoc-36-get-https-github-com-datacoves-snowcap-p
…ttps-github-com-datacoves-snowcap-p
- ResourcePointer parses argument types only for functions, procedures, and external functions. A quoted name of another type can hold a `(`. - fetch_external_function returns None when no INFORMATION_SCHEMA row matches the signature that DESC FUNCTION resolved. - fetch_external_function returns an empty owner when FUNCTION_OWNER is NULL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011dXsGKk6RCfX9bMFY9NLNG
|
@noel thanks for the review. Commit bee8d0d fixes all three findings, and the branch now includes current
The minor double parse stays. It now runs only for function, procedure, and external function pointers. To remove it, Checks: A separate bug exists on |
- parse_identifier starts a signature at the first ( outside quotes. A quoted name such as "T(X)" keeps its parenthesis. The SHOW GRANTS form "FN(X VARCHAR):OBJECT" still parses as a signature. - ResourcePointer reads argument types from the parse that NamedResource already does. A function pointer whose name holds a var no longer raises ParseException. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011dXsGKk6RCfX9bMFY9NLNG
|
@noel commit ed5ab7a also fixes the optional double parse and a related bug that is already on
The unit tests give |
Rerun live_audit.py on every object at snowcap 6ce5c12, so FINDINGS.md reflects current main, as the review asked. main changed three things that the inventory had to follow: - RESOURCE MONITOR: triggers is a field now (datacoves#86). The truth query joins SHOW's notify_at, suspend_at, and suspend_immediately_at columns, and the row has samples. It passes L2 to L5. - SECURITY INTEGRATION:saml2: SAML2SecurityIntegration models it now. The object has create_args, truth queries, and samples for 11 rows. The rows without a sample say why. The x509 samples are self-signed test certificates with no private key. - EXTERNAL FUNCTION: fqn now carries the argument signature (datacoves#90), so the DESCRIBE in the truth query doubled it and failed. The query names the function without a signature now. NOTEBOOK now fails L2, because Snowflake disabled new Legacy Notebooks on the test account (BCR: no Legacy Notebook activity in the 60 days before November 1, 2026). snowcap's Notebook renders only the legacy CREATE NOTEBOOK, so the finding is correct for current snowcap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011dXsGLBEG2amgh6CdUmCP5
Closes #85.
Summary
Snowcap now manages an external function by its full signature,
name(arg types). Snowflake acceptsEXTERNAL FUNCTIONonly inCREATE. Every other statement names the objectFUNCTION.Other behavior:
().exclude_resources: [external_function]excludes grants on external functions. The check readsGrant.target_type, the declared type, not the SQL type.ResourcePointerto a function, procedure, or external function includes its argument types in its FQN, equality, and hash.Review fixes (commit bee8d0d)
Name parsing fixes (commit ed5ab7a)
Evidence
Before: the 3 new tests fail on the PR head before the fix.
After: all pass.
The name parsing tests fail before commit ed5ab7a and pass after it:
The CI checks pass locally on the branch merged with current
main:make lint: black, codespell, and ruff pass.make typecheck:Success: no issues found in 35 source files.uv run pytest --ignore=tests/integration:2345 passed, 1 skipped, 1 xfailed.The function and grant integration tests pass against the test account.
test_blueprint_external_function_lifecyclereads a function grant back from SHOW GRANTS and plans no changes.Two integration tests fail on this branch and fail the same way on
main:test_fetch[PythonStoredProcedure]:Python runtime version 3.9 is decommissioned.test_show_future_grants_skipped_when_no_future_grants_in_manifest:assert 8 == 0.Merge Danger
Door: two-way
The change adds no migration and no destructive statement. A revert restores the old behavior.
Blast Radius: grants
Grants on external functions now render
ON FUNCTION <name>(<arg types>). Before this PR, Snowflake rejected those statements. A quoted name that holds(now keeps its full name. Before, Snowcap cut the name at the(.🤖 Generated with Claude Code
https://claude.ai/code/session_011dXsGKk6RCfX9bMFY9NLNG