Skip to content

Add a Snowflake coverage audit and findings checklist - #94

Merged
noel merged 6 commits into
datacoves:mainfrom
GClunies:snowcap-inventory
Nov 24, 2026
Merged

noel merged 6 commits into
datacoves:mainfrom
GClunies:snowcap-inventory

Conversation

@GClunies

@GClunies GClunies commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What and why

snowcap aims to manage every Snowflake object and every property. This PR measures how close it is and lists what is left as one checklist. It does not change snowcap itself.

  • tools/snowflake_coverage/inventory.yaml lists 164 objects and variants from the Snowflake docs (GA and public preview), with every property and its CREATE, ALTER, and SHOW behavior.
  • static_map.py maps each property to a snowcap field (L1). live_audit.py tests each sampled property on a real account in a throwaway database: created (L2), read back (L3), changed (L4), and a clean plan after (L5).
  • report.py generates FINDINGS.md from the inventory. Every box is derived. A box is checked when snowcap supports the object, or when every tested level of the property passes. A fix PR reruns live_audit.py for its object and report.py, and its items become checked.

Current state: 84 of 164 objects are supported. In those objects, 299 properties pass, 260 fail at least one live level, and 601 are not modeled.

I chose one document over filing a large number of issues. The maintainer can decide how to split the work.

Validation

How to review

  • Start with FINDINGS.md, then live_audit.py (test_row holds the level rules).
  • Feedback wanted: is the checklist format useful for tracking fix PRs? Do any level rules give a wrong pass or fail?
  • The review answers are in the PR conversation.
  • inventory.yaml is data (about 77,000 lines). Skim one object, for example TABLE.
  • Out of scope: fixes to snowcap, and tests for the properties that have no live sample (389).

🤖 Generated with Claude Code

https://claude.ai/code/session_011dXsGLBEG2amgh6CdUmCP5

@gitguardian

gitguardian Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@noel

noel commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Great scope and a genuinely useful deliverable. These findings are all in the audit tool itself (tools/snowflake_coverage/), not in snowcap, but since FINDINGS.md is the thing people will act on to prioritize fixes, its own correctness matters. Verified the first three directly against this repo's code; the rest are plausible but unverified.

Confirmed:

  1. Account.clean_up() (live_test.py) — the docstring says "every statement is attempted," but drops is built by a plain list comprehension with no exception handling:

    drops = [
        lifecycle.drop_resource(resource.urn, resource.to_dict(self.edition), if_exists=True)
        for resource in reversed(list(self.account_objects.values()))
    ]

    If to_dict() or drop_resource() raises for even one tracked object, the whole comprehension raises before a single DROP runs, and self.account_objects.clear() (right after) never executes either, since the exception propagates out of clean_up entirely. One bad object can leave every tracked object behind in the account.

  2. l4_candidates() (static_map.py) calls lifecycle.update_resource(before.urn, {field: ...}, cls.props) without the optional after argument. update_user_key_pair needs after and does after.get("public_key"); with after=None that's an AttributeError, which l4_candidates's except Exception catches and reports as a real "L4: the update handler raises" finding, for UserKeyPair.fingerprint, even though the live flow (blueprint.apply) supplies after correctly.

  3. fetched_keys() (static_map.py) returns set(), not None, for a fetch function that delegates to a helper instead of returning a dict literal, e.g. fetch_user_key_pair does return _user_key_pair_to_dict(data). map_object only special-cases None ("no such fetch function"), so top not in keys is true for every field, and every fetchable field of UserKeyPair gets falsely flagged "L3: the fetch function does not return X."

Plausible, not independently verified (worth a look):

  1. Neither test_object()'s per-row loop nor main()'s per-object loop in live_test.py catches exceptions, so an uncaught error anywhere deep inside (a clean_up RuntimeError, or a raw snowflake.connector.errors.Error from Account.truth()/plan_drift(), neither of which is caught there) aborts the entire multi-hour run for every remaining object.
  2. clean_up() clears self.account_objects before confirming the drops it built actually succeeded, so a failed drop's resource loses its only tracking and can't be retried or re-reported.
  3. report.py's build() calls min()/max() on runs with no empty-sequence guard; if zero currently-supported objects have test == "live", this crashes with a bare ValueError instead of a clear message.
  4. Account.sql() flattens compile_plan_to_sql's output with a plain list comprehension that drops the per-change role field, so create_sql/L4_sql evidence in FINDINGS.md can understate what snowcap actually runs for a multi-role plan (e.g. CREATE + GRANT OWNERSHIP). tests/helpers.py's flatten_sql_commands already handles this correctly.
  5. norm()'s BOOLEAN_WORDS is a hardcoded, incomplete set; anything outside it silently falls back to opaque string comparison with no signal the mapping might be wrong.
  6. live_inputs_digest() hashes an object's own inventory entry but never inventory["account"] (edition/cloud/region/test role) — despite Account.__init__ calling these "the facts every live result depends on." Rerunning against a different edition/cloud/region won't invalidate prior results.
  7. object_section()/build() never read unmapped_fields or candidates, the two outputs static_map.py computes specifically to keep the inventory complete and surface static leads — they're printed once if static_map.py happens to be run interactively, but never make it into the generated FINDINGS.md.

Suggestions for verifying this class of thing going forward:

  • For Loosen up snowflake requirements versions #1/Fix tests and improve docs #4/Improve performance #5 (cleanup/run robustness): the pattern already used in clean_up()'s for statement in drops + teardown: try/except is the right one, apply it one step earlier too, wrap each resource.to_dict()/drop_resource() call in its own try/except inside the comprehension (or a plain loop), collect failures the same way, and keep going. Same idea for test_object()/main()'s outer loops: catch per-object, record the object as failed in the inventory, print it, and move to the next one, same philosophy as test_row's own fail() helper, just one level up.
  • For rename from titan to snowcap #2/Revert "rename from titan to snowcap" #3 (static analysis false positives): these are exactly the kind of thing a handful of targeted unit tests on static_map.py's own helpers would catch cheaply, since they don't need a live account. For example: fetched_keys(UserKeyPair) should be asserted against its known expected output (and the "delegates to a helper" case specifically), and l4_candidates should have a test for a resource whose update handler takes after (call it with a real after dict, not a bare update_resource call) to confirm it doesn't misreport. More generally: any AST-walking heuristic like this is worth a short "does it classify a known tricky case correctly" test per code pattern it claims to handle (dict literal, named dict with item assignment, delegated return) — the three bullets in fetched_keys's own docstring are literally the test list.
  • For Tag Based Masking Policies support #6 (empty-sequence crash): a one-line guard (if not runs: ...) plus a test that runs build() against an inventory with zero live-tested objects.
  • For allow sync and exclude in the cli #7 (dropped role field): reuse tests/helpers.py's flatten_sql_commands directly in Account.sql() instead of a hand-rolled flatten, that also removes the duplicated logic.
  • For Add row access policies #9 (digest completeness): a test asserting live_inputs_digest changes when inventory["account"] changes, parallel to the existing (presumed) test that it changes when the object's own fields change.
  • For Fix db role grants #10 (dropped outputs): since this is a "the report doesn't show X" class of bug, the cheapest check is a snapshot-style test: build a small fixture inventory with a known unmapped field, run build(), and assert the string appears in the output. That would have caught this immediately.

None of this blocks snowcap itself since the package is unchanged, but worth fixing before the checklist numbers get used to prioritize real fix PRs.

@GClunies

Copy link
Copy Markdown
Contributor Author

Thanks for the review, @noel. This round also answers GitGuardian and fixes the failing test check. The branch is now one commit, a44022e, on top of main.

GitGuardian: 4 secrets

All 4 values were made up for the live tests (two base64 Azure master keys, one OAuth client id and secret pair). None was ever a real credential, so nothing needs rotation. They still must not be in the repo.

  • inventory.yaml now holds no credential value, real or made up. Every password, key, token, client id, and client secret is a {secret:NAME} placeholder (29 names). common.fill() gives each name a value for the run only. common.save_inventory() turns those values back into their placeholders wherever a result repeats them, for example in rendered SQL or a Snowflake error. test_common.py covers that round trip.
  • Each run value is 16 equal bytes in unpadded base64, so even a fragment in a truncated error has no entropy.
  • I rewrote the branch history into one commit, so the old commits are no longer part of this PR. GitHub can still serve old commit objects by SHA from caches or forks until it garbage-collects them.
  • gitleaks finds nothing in the tree or in the new commit.
  • While checking, I also removed two other kinds of account data from the evidence. Setup SQL no longer holds local file paths: the fixture files are now in tools/snowflake_coverage/files/. Snowflake-generated AWS external ids are redacted, like the account locator.

Failing test check

pytest collected live_test.py because its name matches *_test.py. I renamed it to live_audit.py. uv run pytest --ignore=tests/integration passes, including the new tests in tools/snowflake_coverage/.

Your findings

  1. Fixed. clean_up() now drops each object in its own try. One failed drop no longer stops the rest. test_clean_up_attempts_every_object_and_keeps_the_failed_ones fails without the fix.
  2. Fixed, with one correction. l4_candidates now passes after. Without it, update_resource passes after or {} (snowcap/lifecycle.py, update_resource), so the result was a NotImplementedError, not an AttributeError. No inventory object reaches this path: UserKeyPair is not in the inventory, and its fingerprint cannot take a sample value. So no test.
  3. Fixed. The new returned_keys() follows return helper(...) into helpers in the same module. It also fixed a second false lead: fetch_database returns fetch_shared_database(...) for an imported database, so DATABASE:from_share no longer shows an L3 candidate. test_static_map.py covers the three shapes from the docstring, and both tests fail without the fix.
  4. Fixed. An error in one object now ends only that object. The script clears that object's live results, saves, goes on to the next object, and exits with an error that names every failed object. Leftover account objects from a failed object are listed for manual cleanup. They do not reach the next object's cleanup, so they cannot fail it too. test_main_isolates_a_failed_object fails without the fix.
  5. Fixed with 1. A failed drop stays tracked, so the object's final cleanup retries it and the error names it.
  6. No change. The inventory has 76 live objects, and report.py refuses to run while any of them lacks results ("Rerun live_audit.py first for: ..."). So runs is never empty when min() runs.
  7. No change. Every change runs as one test role, which each object's tested block records. A per-change role adds no information here, and the verdicts come from Snowflake's responses, not from the evidence text.
  8. No change. A word outside BOOLEAN_WORDS does not pass silently. It shows as a fail with both values in the evidence, which is visible in FINDINGS.md.
  9. Fixed another way. Each object's tested block now records the account edition, cloud, region, and test role of its run, next to the snowcap commit and Snowflake version. The top-level account block is gone. A run on another account does not clear older results. Instead, each result names the account it ran on, and the report header lists every distinct account, so mixed runs are visible.
  10. No change, by design. unmapped_fields is empty for every object. Candidates are unconfirmed static leads for the live tests. The checklist lists only live results, so a lead never shows as a finding.

tested.snowcap_commit now names the last commit that changed snowcap/ (git log -1 -- snowcap), so a squash or merge that leaves the package alone keeps the results valid. All results are at 584e44b, whose snowcap/ tree is the same as at the earlier merge commit.

@noel

noel commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Reviewed the new commit (a44022e). Verified in a clean worktree first: report.py regenerates FINDINGS.md byte-identically, static_map.py runs over all 83 supported objects and leaves inventory.yaml byte-identical, pytest tools/snowflake_coverage/ passes 6, all 164 internal anchors in FINDINGS.md resolve, and the summary counts reconcile (279 pass + 268 fail + 600 unmodeled + 381 untested, with the failures-by-kind table summing to exactly 268). The GitGuardian finding and the failing test check are both answered. Tooling is in good shape.

Five findings, severity order. All of them are in tools/snowflake_coverage/, none in snowcap/.

  1. Medium. live_audit.py:386, L2 passes vacuously when the truth query reports nothing. norm(None) returns the string "none", so norm(reported) == norm(expect[0]) is satisfied whenever the truth query returns no value for truth_key and the expected value is None or the literal NONE. The L3 branch guards this explicitly (elif is_plain(path) and reported is not None), L2 doesn't.

    This has already produced a wrong result in the committed data. STORAGE INTEGRATION:s3 / storage_aws_object_acl has sample: [null, 'bucket-owner-full-control'], its recorded create_sql contains no STORAGE_AWS_OBJECT_ACL at all, and its own L3 evidence reads "Snowflake reports no storage_aws_object_acl, so the read-back has no reference". Yet levels.L2 is pass and FINDINGS.md:1716 renders it as a fully passing - [x] storage_aws_object_acl. The same collision would silently mark EXTERNAL VOLUME / storage_locations[].encryption.type (expect[0] = 'NONE') as created if its truth query ever stopped returning a row.

    Fix: mirror L3 and treat reported is None as untested for L2 instead of comparing normalized strings.

  2. Medium. live_audit.py:518 (test_object) and common.py:158, the ACCOUNT object resets account parameters to Snowflake defaults, not their prior values. The ACCOUNT entry maps to AccountParameter and samples five real account-level parameters (statement_timeout_in_seconds, client_timestamp_type_mapping, geography_output_format, json_indent, odbc_treat_decimal_as_int). Account.create registers each as an account object and clean_up drops it with lifecycle.drop_account_parameter, which emits ALTER ACCOUNT UNSET <param> (snowcap/lifecycle.py:686). The harness never reads the pre-test value.

    On any account where one of these was customized, STATEMENT_TIMEOUT_IN_SECONDS especially, a run silently reverts it to the default. The PR body's claim that account parameters are back to their prior values only holds if the account was already at defaults. Either read and restore the prior value in setup/teardown, or document the side effect in the "How to update" section next to the credentials note.

  3. Low. live_audit.py:483 (test_combined), rows sharing a head field are collapsed when applied but still checked individually. before/after are dicts keyed by r["snowcap"]["field"], so when two combinable rows map to the same top-level field only the last row's sample is sent. The missed comprehension at line 499 then iterates rows rather than the deduped dict and checks the shadowed row's expected value against Snowflake, a value that was never applied, producing a spurious fail / missed entry.

    Today only ACCOUNT has duplicates (5 rows all on value) and it escapes through the len(after) < 2 early return, which as a side effect prints the misleading - Combined change: untested (needs two or more fields) in the ACCOUNT section for an object that actually has five testable rows. Any object that later gains one duplicate pair plus a second distinct field will report a false failure.

  4. Low. common.py:193 (testable_rows), TypeError when a row has a sample but field: null. The filter checks sample and n_a but not field, then calls top_field(p["snowcap"]["field"]) and hits re.findall(pattern, None). No row is in that state right now, but the documented fix workflow (rerun live_audit.py for the object) is exactly where a contributor adds a sample to a row that is currently L1 fail (not modeled). A p["snowcap"].get("field") and ... guard makes it safe.

  5. Low. report.py:116 (object_section), any non-live object is labelled "Docs only" and assumed to have test_reason. common.py's module docstring documents three values for snowcap.test: live | docs_only | untested. The else branch unconditionally reads snowcap['test_reason'] and prints "Docs only: ...", and the staleness guard in __main__ only inspects objects with test == "live", so an untested object with a class reaches this line and either KeyErrors or is mislabelled. Latent today since the 7 non-live supported objects are all docs_only with a reason, but the third value is documented as supported.

I also spot-checked two of the "Other code findings" claims against the source and both hold: ResourceType.SESSION_POLICY does AttributeError on import, and external_function.py:64 does have not_null commented out.

Nitpicks, not worth filing:

  • common.py:158, secret() encodes bytes([len(_secrets) + 1]), so it breaks past 61 names (the comment acknowledges this) and raises ValueError past 255. 29 names in use, plenty of headroom.
  • static_map.py:52 (returned_keys), the helper-following recursion has no cycle guard. A self- or mutually-recursive fetch_* would RecursionError. None exist today.
  • static_map.py:164, after.to_dict() with no argument defaults to ENTERPRISE while live_audit uses the real account.edition. Harmless on the current account (only one spec field anywhere declares an edition restriction) but the two paths can diverge.
  • live_audit.py:455, a snowflake.connector.errors.Error raised during blueprint.plan()'s read is attributed to L4 as bad_sql ("snowcap sends change SQL that Snowflake rejects"), which would misclassify a failing SHOW as a change-SQL defect.

Add tools/snowflake_coverage: an inventory of 164 Snowflake objects and
their properties from the docs, a static map to snowcap fields, a live
audit that tests each sampled property on a real account in throwaway
databases, and FINDINGS.md, a checklist that report.py generates from
the inventory.

The inventory holds no credential value, real or made up. Every
credential input is a {secret:NAME} placeholder that the audit fills
for the run and writes back as the placeholder. Evidence redacts the
account locator and Snowflake-generated AWS external ids.

The live audit isolates each object: a failure clears that object's
results and the run continues. Cleanup attempts every drop and keeps
failed objects tracked for the object's final retry. The static map
follows fetch functions that return a helper's result.
@GClunies

Copy link
Copy Markdown
Contributor Author

Follow-up: GitGuardian flagged a placeholder name (password_1) in the new test test_common.py. No credential was involved. The test now uses neutral placeholder names, and I folded the change into the single commit, now def81ac.

@noel

noel commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Reviewed the full branch at def81ac, 15 new files, all under tools/snowflake_coverage/, with snowcap/ untouched. The placeholder rename is clean, no credential was ever involved. I checked the tooling actually reproduces what's committed rather than trusting the artifacts:

  • report.py regenerates FINDINGS.md and static_map.py regenerates inventory.yaml, both byte-for-byte.
  • The 6 new unit tests pass and full collection stays clean at 2275.
  • All 83 heading anchors resolve, and the five code_findings claims check out against the real source.
  • No {secret:NAME} run value survives into either committed artifact.

Seven findings. The first two are the ones that affect whether the checklist can be trusted, the rest are tooling sharp edges.

  1. live_audit.py:378, plan-time read errors are recorded as L2 create failures. DATABASE ROLE, MATERIALIZED VIEW and VIEW tags all land in FINDINGS.md under "CREATE leaves out the value or fails" with create failed: ... on: SELECT * FROM table(... tag_references ...). That's snowcap's fetch query, so the create may well have worked and the read is what broke. Three rows of the published checklist currently point at the wrong half of the round trip, which sends whoever picks them up into the wrong code.

  2. live_audit.py:118, norm(None) == norm("NONE") is True. A truth key that reports nothing silently matches an expected value of NONE or null. Two inventory rows expect exactly 'NONE', EXTERNAL VOLUME storage_locations[].encryption.type and SECURITY INTEGRATION oauth_use_secondary_roles, so a key typo or a dropped DESCRIBE row there produces a false pass. A pass that means "we found nothing" is worse than a fail in an audit whose whole output is a trust list.

  3. live_audit.py:483, test_combined keys by spec field, which collapses rows that share one. ACCOUNT's five combinable parameters all map to value, so the combined test reports "untested (needs two or more fields)" when there are in fact five. The latent version is worse: with two or more distinct fields plus a duplicate, missed checks the dropped row's value and reports a false fail.

  4. static_map.py:140, l1() raises IndexError on a path ending in [] whose head is a spec field. l1(Table, 'columns[]') reproduces it. That aborts the entire run rather than skipping the one row, so a single new inventory entry of that shape takes out the regeneration.

  5. report.py:97, "snowcap sent" SQL is missing for 65 of 73 L2 create failures. evidence["create_sql"] is only assigned after a successful create, even though the SQL was already compiled before the attempt. The failures are exactly the rows where that SQL is the thing a reader wants, so assign it at compile time.

  6. report.py:40, the published Limits section is wrong about owners. It says owner rows are not sampled, but PROCEDURE:python owner, SCHEMA owner and TABLE ownership are sampled and pass L1 through L5. Someone reading the limits will redo work that's already covered.

  7. common.py:121, an unknown or mistyped object label audits nothing and exits 0. That quietly breaks the "rerun live_audit.py for its object" workflow the doc tells people to follow, since a typo looks identical to a clean run. An unknown label should be an error.

Nothing here blocks the approach, and the deliverable is solid. I'd want 1 and 2 fixed before merge since they're the two that put wrong information into the artifact people will act on. The rest can land as follow-ups if you'd rather get this in.

@noel

noel commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

@GClunies checking in, no movement since my review of def81ac on Oct 22.

To restate where I landed so nothing is ambiguous: the approach and the deliverable are solid, and I only want findings 1 and 2 before merge, the plan-time read errors recorded as L2 create failures, and norm(None) == norm("NONE"). Those two are the ones that put wrong information into an artifact people will act on. Findings 3 through 7 are tooling sharp edges and I'm fine with them landing as follow-ups.

Are you planning to make those updates? If you'd rather get this in and chase the rest later, fixing just 1 and 2 is enough from my side.

GClunies and others added 2 commits November 10, 2026 18:16
Each change answers a finding from noel's reviews of a44022e and def81ac.

- A plan only reads the account, so an error while snowcap plans is now a
  read failure (ReadFailed): L3 fetch_crash for the create, L4 fetch_crash
  for the change. Before, a rejected fetch query (VIEW, MATERIALIZED VIEW,
  DATABASE ROLE tags) or a missing fetch function (HYBRID TABLE, EXTERNAL
  FUNCTION) showed as an L2 create failure, and a read error while planning
  the change showed as L4 bad_sql.
- A truth key that reports no value no longer passes L2 or L4. norm(None)
  was "none", so it matched an expected NONE or null
  (STORAGE INTEGRATION:s3 storage_aws_object_acl passed L2 vacuously).
- create_sql is kept before the apply, so a create that Snowflake rejects
  shows the SQL it rejected.
- The combined test leaves out rows that share a field. It sent only the
  last row's value and then checked the other rows against it.
- The ACCOUNT object puts back each account parameter that had an
  account-level value. Its cleanup UNSETs each one, which reset a
  customized value to the default.
- select_objects exits with an error for a label that names no modeled
  object. A typo audited nothing and exited 0.
- testable_rows skips a sampled row with field: null (TypeError).
- l1 accepts a path that ends in [] (IndexError).
- report.py labels an untested object "Not tested live" (KeyError), and
  derives the owner limit from the inventory (3 owner rows have samples).
- returned_keys stops at a recursive helper, and secret() refuses a name
  past the 61 values it can encode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011dXsGHmirL884VdCkJuMYY
A missing value now stays untested only when the expected value is NONE or
null. The first fix for the review made every missing value untested. The
rerun showed that this hid 5 real CREATE failures: TABLE columns[].tags,
columns[].collation and row_access_policy, MATERIALIZED VIEW columns[].tags,
and ICEBERG TABLE:snowflake columns[].tags. The CREATE SQL leaves out each
value. test_a_value_snowflake_does_not_report_fails_when_a_value_was_expected
fails without the fix.

All 76 live objects ran again on snowcap 584e44b. Compared with def81ac:
- 36 rows move from an L2 create failure to an L3 read failure: the tags of
  DATABASE ROLE, MATERIALIZED VIEW and VIEW, 15 EXTERNAL FUNCTION rows and
  18 HYBRID TABLE rows.
- STORAGE INTEGRATION:s3 storage_aws_object_acl: L2 is untested, not pass.
- 15 L4 crashes in snowcap's fetch code are read failures now.
- 35 of 37 create failures keep the SQL that snowcap sent. The other 2 fail
  before snowcap compiles SQL.

The ACCOUNT run restored a customized STATEMENT_TIMEOUT_IN_SECONDS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011dXsGHmirL884VdCkJuMYY
@GClunies

Copy link
Copy Markdown
Contributor Author

@noel thanks for both reviews. I fixed all of them, not only 1 and 2. 6b2512a has the code fixes. d2ff854 has the live rerun of all 76 objects on snowcap 584e44b, plus one more fix that the rerun found. snowcap/ is still unchanged.

What the rerun changed, against def81ac

Change Rows
L2 create → L3 fetch_crash (finding 1) 36: DATABASE ROLE, MATERIALIZED VIEW and VIEW tags, 15 EXTERNAL FUNCTION, 18 HYBRID TABLE
L2 pass → untested (finding 2) 1: STORAGE INTEGRATION:s3 storage_aws_object_acl
L4 update_crash → fetch_crash (last nitpick) 15: AUTHENTICATION POLICY (8), SECURITY INTEGRATION:snowflake_oauth_partner (6), api_auth_client_credentials (1)
ACCOUNT combined message (finding 3) 1

No other level or failure kind changed. The summary counts stay at 279 pass, 268 fail, 600 not modeled, and 381 without a sample. "CREATE leaves out the value or fails" drops from 73 to 37. "snowcap fails while it reads the object" goes from 30 to 66.

Review of def81ac

  1. Plan-time read errors as L2 failures. Fixed. Account.plan now raises ReadFailed for a Snowflake error during the plan. snowcap_error raises it for any crash that has a snowcap.data_provider frame. test_row records the error as L3 fetch_crash and sets L2 to untested. The VIEW row now reads snowcap's read fails while it plans the create: ProgrammingError: 391806 (0A000): SQL compilation error: Invalid value VIEW for argument OBJECT_TYPE. Tests: test_a_failed_read_while_planning_the_create_fails_l3_not_l2 and test_plan_reports_snowflake_errors_and_fetch_crashes_as_failed_reads. The second test uses the real data_provider.fetch_resource on EXTERNAL FUNCTION.
  2. norm(None) == norm("NONE"). Fixed. norm(None) returns None now, so a missing value never equals NONE. A missing value is untested when the expected value is NONE or null, in L2 and in L4 through landed. When the expected value is a real value, a missing value fails, as before. My first fix made every missing value untested. The rerun showed that it hid 5 real CREATE failures, for example TABLE columns[].tags, whose CREATE SQL leaves out the tag. d2ff854 corrects this. Tests: test_a_value_snowflake_does_not_report_never_passes and test_a_value_snowflake_does_not_report_fails_when_a_value_was_expected.
    • storage_aws_object_acl keeps its checkbox, because L4 and L5 pass on a reported value (bucket-owner-full-control). That is the documented rule: every tested level passes. L2 no longer passes.
  3. Combined test collapses shared fields. Fixed. test_combined leaves out rows that share a field and lists them under shared. The missed check runs only over the rows that it applied. ACCOUNT now reads untested (needs two or more fields, and rows that share value cannot combine). Tests: test_combined_leaves_out_rows_that_share_a_field and test_combined_of_rows_that_all_share_one_field_is_untested.
  4. l1() IndexError on columns[]. Fixed. head and head[] both name the field itself. Test: test_l1_models_a_list_field_path.
  5. No "snowcap sent" SQL for L2 failures. Fixed. Account.create saves create_sql before the apply. Now 35 of 37 create failures show the SQL. The other 2 fail before snowcap compiles SQL: CATALOG INTEGRATION:object_storage table_format (snowcap rejects the declaration) and ICEBERG TABLE:snowflake external_volume (MissingResourceException for SNOWFLAKE_MANAGED). Test: test_a_create_that_snowflake_rejects_keeps_the_sql_it_sent.
  6. Limits wrong about owner. Fixed. The report now takes the limit from the data: "owner has a live sample only for PROCEDURE:python, SCHEMA, TABLE." Test: test_limits_name_the_objects_whose_owner_is_sampled.
  7. Mistyped label exits 0. Fixed. select_objects exits 1 with No modeled object has the label: NOPE. Test: test_select_objects_refuses_a_label_that_names_no_modeled_object.

Review of a44022e

Items 1 and 3 are the same as items 2 and 3 above.

  • 2. ACCOUNT resets account parameters. Fixed. Before CREATE DATABASE, test_object reads SHOW PARAMETERS ... IN ACCOUNT for each parameter row. The teardown puts back each value set at level ACCOUNT. The "How to update" section now says this. I tested it on the live account:
    SET STATEMENT_TIMEOUT_IN_SECONDS = 171717  → 171717, level ACCOUNT
    live_audit.py ACCOUNT                      → 5 rows pass L2–L5
    SHOW after the run                         → 171717, level ACCOUNT
    UNSET                                      → 172800, level ''
    
    Test: test_account_parameter_restores_put_back_only_customized_values.
  • 4. testable_rows TypeError on field: null. Fixed with a field guard. Test: test_testable_rows_skips_a_sampled_row_that_snowcap_does_not_model.
  • 5. Non-live object labeled "Docs only". Fixed. docs_only prints "Docs only: ...". Any other value prints "Not tested live", plus the reason if the row has one. Test: test_object_section_names_each_test_value.

Nitpicks

  • secret() past 61 names. Fixed. It raises ValueError past MAX_SECRETS = 61. Test: test_secret_refuses_a_name_past_the_values_it_can_encode.
  • No cycle guard in returned_keys. Fixed. It tracks the functions it has seen. Test: test_returned_keys_stops_at_a_cycle.
  • snowflake.connector.errors.Error in a plan read recorded as L4 bad_sql. Fixed through ReadFailed, as in item 1. The 15 rows in the table above now show as read failures, not change crashes. All 76 bad_sql rows are still ALTER errors.
  • static_map uses ENTERPRISE. No change. static_map.py has no account connection, so it has no real edition to pass. live_audit.py uses the real account.edition for every live level.

Checks on d2ff854

  • uv run pytest --ignore=tests/integration: 2288 passed. make lint and make typecheck pass.
  • I set each changed source file back to its def81ac version, one at a time. Its new tests failed each time. The fix in d2ff854 has the same check.
  • report.py gives the same FINDINGS.md on two runs. static_map.py leaves inventory.yaml byte-identical.
  • After the run, SHOW DATABASES LIKE 'COVERAGE%' returns nothing.

@noel

noel commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

@GClunies thanks for taking all of them, not only 1 and 2. Re-reviewed 6b2512a and d2ff854 against def81ac. Every finding from both rounds and the nitpicks checks out in the code: plan-time read errors land on L3 through ReadFailed, norm(None) stays None, shared fields drop out of the combined test, the ACCOUNT parameters get restored, and a mistyped label exits 1. snowcap/ is untouched.

One thing before merge: the results are stale against main. The branch sits on 584e44b, and 20 commits have changed snowcap/ on main since then, including the quoting and statement-splitting fixes in #93 and #97, plus #86, #88 and #90, which merged today. Some of the failures in FINDINGS.md are probably fixed already, and that file is what people will use to pick the next fix PRs. Could you merge main and rerun live_audit.py, so the checklist reflects current snowcap? Once that's in, I'll merge it.

Two small notes, neither blocking:

  • live_audit.py norm: now that norm(None) is None, an expected null against a reported 'NONE' fails L2 and L4, where it passed before. Nothing in the inventory hits it today. Treating "both sides mean none" as a match would close it.
  • test_combined counts a value Snowflake does not report as missed, while the per-row L4 marks the same case untested. The docstring says so, and it errs toward a false fail rather than a false pass, so I'm fine leaving it.

GClunies and others added 3 commits November 21, 2026 06:41
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011dXsGLBEG2amgh6CdUmCP5
Since norm(None) stays None, a truth key that reports 'NONE' failed L2
and L4 against an expected null, though both mean no value. The new
same() treats that pair as a match in L2, in landed() (L4 and the
combined test), and in the L3 read-back reference. A missing value
still matches nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011dXsGLBEG2amgh6CdUmCP5
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
@GClunies

Copy link
Copy Markdown
Contributor Author

Thanks @noel. I merged main and reran live_audit.py on every object. FINDINGS.md now reflects snowcap 6ce5c12, tested on 2026-11-21.

Your comment Outcome Commit
Merge main and rerun live_audit.py Done. All 76 live objects ran at 6ce5c12. 3e5209c (merge), 9a4381f (rerun)
Note 1: an expected null against a reported 'NONE' fails L2 and L4 Fixed. A reported NONE now matches an expected null. 2d63fb2
Note 2: test_combined counts an unreported value as missed No change, as you suggested. none

Note 1: the fix

live_audit.py has a new helper, same(reported, expected). It returns true when both sides mean no value. L2, the L4 landed() check, and the L3 reference value use it. The L3 compare of fetched to reference is unchanged, so a snowcap fetch of 'NONE' against a declared None is still a real mismatch.

Proof: test_snowflake_reporting_none_matches_an_expected_null and test_snowflake_reporting_none_reads_back_as_the_declared_null fail without the fix and pass with it.

What main changed in the inventory

The rerun on main needed three inventory updates:

  • RESOURCE MONITOR triggers[]: feat(resource_monitor): manage triggers, several notify users, and non-ACCOUNTADMIN owners #86 made it a field. The truth query joins the three SHOW columns notify_at, suspend_at, and suspend_immediately_at. The row passes L2 to L5.
  • SECURITY INTEGRATION:saml2: SAML2SecurityIntegration models it now. 11 rows have samples, and all 11 pass L2 to L5. The combined change passes too. Each row without a sample has a note that gives the reason. For example, Snowflake rejects ALLOWED_USER_DOMAINS without ENABLE_IDENTIFIER_FIRST_LOGIN. The x509 samples are self-signed test certificates, with no private key.
  • EXTERNAL FUNCTION: fix(external-function): manage signatures and grants #90 put the argument signature in fqn, so the truth query's DESCRIBE doubled it and failed with a syntax error. The query now names the function without a signature.

What changed in FINDINGS.md

Before (584e44b) After (6ce5c12)
Supported by snowcap 83 84
Properties that pass 279 299
Properties that fail L2 to L5 268 260
Modeled, without a live sample 381 389

The main row changes:

  • ALERT: action and condition now pass L4 and L5.
  • EXTERNAL FUNCTION: 15 rows no longer crash at L3. Six rows now reach L4 and fail it. snowcap sends ALTER FUNCTION ... SET for returns, url, volatility, null_handling, return_not_null, and argument names, and Snowflake rejects each one.
  • TASK after[]: L4 changed from bad_sql to "snowcap refuses a change that ALTER supports", which follows Split task and alert updates into one ALTER per clause #88.
  • NOTEBOOK: L2 now fails, with Creation of legacy notebooks has been disabled for this account. Snowflake blocks new Legacy Notebooks on accounts that had no Legacy Notebook activity in the 60 days before November 1, 2026 (BCR). snowcap's Notebook renders only the legacy CREATE NOTEBOOK, so I kept this finding.

Checks

  • uv run pytest tools/snowflake_coverage: 23 passed.
  • uv run pytest --ignore=tests/integration: 2404 passed.
  • ruff check and ruff format --check: clean.
  • report.py gives byte-identical output on a second run, and a second static_map.py run leaves inventory.yaml unchanged.
  • After the run, SHOW ... LIKE 'COVERAGE%' returns 0 rows for databases, warehouses, integrations, resource monitors, roles, users, and external volumes.

Could you take another look?

@noel

noel commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

@GClunies thanks, re-reviewed 2d63fb2 and 9a4381f. The NONE fix is right and the two tests cover L2, L4 and the L3 reference. In a clean checkout, 23 tests pass, and report.py and static_map.py regenerate both artifacts byte for byte. Merging.

A few latent issues for a follow-up. None of them affects a row in the current FINDINGS.md. I checked each against the data:

  • live_audit.py:118 snowcap_error treats any bare Exception or snowcap.exceptions class as a refusal, so a privilege or owner error on an alter: none row would pass L4. An allowlist (MarkedForReplacementException, NotImplementedError) closes it.
  • live_audit.py:204 Account.apply turns every non-Snowflake error into Crashed, including the checks blueprint.apply runs before any SQL. A refusal raised there fails L4.
  • live_audit.py:521 an error from the audit's own truth queries inside landed() is recorded as bad_sql, which blames snowcap's change SQL.
  • live_audit.py:620 the finally runs USE ROLE and USE WAREHOUSE before clean_up, so if either fails the test database and the account parameter restores are skipped.
  • live_audit.py:232 parameter_restores doesn't escape backslashes in STRING values.

Small one: same() can fold its early return into the expression.

@noel
noel merged commit 76d44a4 into datacoves:main Nov 24, 2026
6 checks passed
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.

2 participants