fix(review): report three new PII exposures that v0.12.12 blocked
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.
| Case | On main | After |
|---|---|---|
| A UNION adds a branch that computes personal data under a column name the first branch already had | Approved, nothing reported | Reported, blocks |
| The model's code changes the schema or source it reads, for example from a masked schema to a raw one | Approved, nothing reported | Reported, blocks |
| The base is not compiled, and the change adds an email, a national id or an IBAN to a mart | Comment only | Blocks, 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.
- A column is compared by what it reads and how it is computed from source columns. Qualifier spelling, CTE and alias names, a
*wrapper and the order of schemas do not count. Which column sits in which argument does, also between two same-named tables. - The CTEs and subqueries a value passes through count. A read moved to another one, or past one that filters, is new, unless the new one is the old one plus a filter. Editing the CTE that is read is not a change by itself.
- 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 (Jinja that computes the name, an
{% if %}that chooses the relation), the answer is "cannot tell". - Without a compiled base, absence is proven only when the base names neither the output nor a column it reads, its final query lists its columns explicitly, and the parser reads the whole file.
Known limits against main. Found by comparing this branch with main on about 18,500 generated and adversarial cases whose labels were checked by running the SQL in DuckDB. All are in the docs or the changelog.
| Class | Effect | Cases |
|---|---|---|
| A read moved between CTEs where the text cannot show the move is harmless (a no-op filter, a window in the CTE, swapped or reused CTE names) | blocks where main does not | 79 |
| A model compiled under a name its code never writes, with any other relation replaced | blocks where main does not | 32 |
A UNION whose * cannot be placed, and union by name | blocks where main does not | 25 |
| A CTE renamed and edited at once, a filter removed inside the CTE that is read, and a few rarer shapes | missed where main blocks | 28 |
Two same-named sources across environments, and a head in DuckDB from … select form | warns where main blocks | 42 |
Against those: about 2,300 harmless edits that main blocks no longer block, and about 780 real exposures that main misses are reported. About 1,300 harmless edits get a non-blocking warning where main is silent, mostly in models that build table names with Jinja or in pull requests that also edit a source YAML.
Not in this PR. The per-source comparison of source YAML, and a later UNION branch at or after a * over a table, stay as on main.
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,018 pass, 0 fail. Typecheck clean.
- A no-change test applies edits that expose nothing 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 block.
- A comparison harness ran every case on this branch and on main. Five rounds of independent adversarial review wrote the cases; each kind they found is fixed with a test or listed above.
- DuckDB fuzz, 40,000 models: two cases lost, both also lost on main.
- 1,122 stored adversarial cases: every verdict identical to main.
- No-change run over 3,735 fuzz and stored models: 466 blocking runs of 22,410, identical on main.
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