fix(review): report three new PII exposures that v0.12.12 blocked

RA
34m ago
+2118-167

Issue for this PR

No issue is filed for this PR. Its scope is three regressions against v0.12.12 in the personal-data check, so that a release can be cut from main.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Background. v0.12.12 reported every personal-data column in a changed model and blocked on it. Main now reports only the columns a pull request newly exposes. In three cases main decides "not new" wrongly, so a pull request that v0.12.12 blocked is approved or only commented on.

The three fixes.

CaseOn mainAfter
A UNION adds a branch that computes personal data under a column name the first branch already hadApproved, nothing reportedReported, blocks
The model's code changes the schema or source it reads, for example from a masked schema to a raw oneApproved, nothing reportedReported, blocks
The base is not compiled, and the change adds an email, a national id or an IBAN to a martComment onlyBlocks, when the base file's own SQL clearly does not have that column

Three answers. Each decision is "already exposed" (no finding), "new" (blocks), or "cannot tell": a warning of unknown confidence that never blocks and never drops another finding.

How "already exposed" is decided now.

  • A column is compared by what it reads and how it is computed from real source columns. Qualifier spelling, CTE and alias names, a * wrapper and the order of schemas do not count.
  • A different schema is an environment difference only when the model's code names the table the same way on both sides. A replaced relation is a swap. Where the code cannot say, the answer is "cannot tell".
  • Without a compiled base, absence is proven only when the base's final query lists its columns explicitly and the parser reads the whole file.

Not in this PR (documented in the docs and changelog).

  • A later UNION branch at or after a * over a table, a ref() or a CTE that itself selects * may go unreported, raw or computed. Same as main.
  • The per-source comparison of source YAML moved to a follow-up. Today a source YAML edit makes every source() read in the review undecided; a PR that edits only the YAML gets no finding.
  • A schema changed through +schema in the project file, var(), env_var(), a YAML anchor, or outside the PR is not detected.

Now reported that was not before (extra blocks).

  • Without a compiled base, a renamed personal-data output blocks.
  • Qualifying a hard-coded table name without a compile step blocks.
  • Replacing a relation beside an aliased, versioned or ephemeral model blocks across environments.

Changelog. It gains this PR's entry and the entries for #1721 and #1722, which were merged without one.

How did you verify your code works?

  • Review and skill tests: 2,004 pass, 0 fail. Typecheck clean.
  • A no-change test applies edits that expose nothing (rename a CTE, qualify columns, add or remove a join, reformat, * to explicit columns, an identical UNION branch, harmless set-tag and config edits) to models with raw and computed personal-data columns, with base and head in different schemas, in the same schema, and with no compiled base. None may block. Real exposures in the same file must still report.
  • Every case from the reviewer and from two independent reviews was re-run on this branch and on main.
  • DuckDB fuzz, 40,000 models: 0 lost, apart from one known case that is also lost on main.
  • 1,122 stored adversarial cases: every verdict identical to main.
  • The same no-change idea run over 3,735 fuzz and stored models with a reformat or a trailing comment: 466 blocking runs of 22,410, identical on main. They come from models whose reads the parser cannot resolve.

Cost side effects

None.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR
  • I checked for cost side effects (model calls, queries or cloud resources that grow with user data) and described them, or wrote "none"

🤖 Generated with Claude Code