Skip to content

fix: separate audit checks from schema nullability - #718

Merged
kvlonge merged 1 commit into
mainfrom
fix/separate-not-null-audits
Sep 18, 2026
Merged

kvlonge merged 1 commit into
mainfrom
fix/separate-not-null-audits

Conversation

@kvlonge

@kvlonge kvlonge commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Why

A runtime not_null audit verifies data after execution; it does not declare that a model's output schema is non-nullable. Treating the audit as schema metadata caused false K004 diagnostics whenever static analysis correctly proved that the SQL expression could return null.

Changes

  • Make K004 depend only on explicit nullable false contract metadata.
  • Preserve runtime audit attachment, severity, and execution behavior.
  • Add unit coverage for audit-only and explicit-nullability declarations.
  • Add real CLI integration coverage proving audit-only nullable output compiles while nullable false still fails with K004.

Verification

  • uv run pytest tests/unit/src/sqlbuild/compiler/contracts/test_validate.py tests/integration/src/sqlbuild/cli/commands/main/test_compile.py -n auto --dist loadfile
  • Focused Ruff formatting/lint and Ty checks
  • uv run fensu check
  • uv sync --all-extras
  • make check-ci
  • Independent read-only diff review: no findings

@kvlonge
kvlonge enabled auto-merge (squash) September 18, 2026 02:54
@kvlonge
kvlonge merged commit 5616d37 into main Sep 18, 2026
18 checks passed
@kvlonge
kvlonge deleted the fix/separate-not-null-audits branch September 18, 2026 03:04
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.

1 participant