Repository navigation
Description
Part of the #241 epic. Registers C-57. Depends on #243.
Problem
Two things decide what the no-copy scan hunts for, and both are currently accidents.
1. The secret table is exempted by an inline literal. tests/test_env_declaration.py:1042:
scanned_sections = tuple(
name for name, role in _TABLE_ROLE.items() if role == "CONSUMED" and name != "secret"
)Two lines above sits a comment claiming the scope comes from the declared partition and not from an inline tuple. No reason for the exemption is recorded anywhere — not in the code, not in an ADR, not in the register.
Measured against views-appwrite origin/main (v1.6.0): [secret] has 7 rows and none carries a value, so the clause removes exactly zero entries today, and the isinstance(body.get("value"), str) filter on the next line already does the work. The day any secret row gains a value — a key id, a header name, a non-secret slot identifier — the one table class whose leak matters most is silently outside a scan running in public CI. assert _CONSUMED_TABLES does not cover it: secret alone keeps _CONSUMED_TABLES truthy while scanned_sections goes empty.
2. Removing the six-character floor admitted this repository's own package names into the ban-set. Measured: the registry's two shortest values are the exact contents of PARTNER_PACKAGES — this package's own directory names — matched by exact string equality against every non-docstring string constant under views_postprocessing/.
The justification given was "measured, removing it keeps the suite green". That measured today's source. The next logging.getLogger(<partner>), if partner == <partner>:, or Literal[<partner>, ...] (still an ast.Constant) fails a security guard with "coordinate value(s) from the registry are copied into this repo" for code that copied nothing. Per this file's own repeatedly-cited doctrine — ADR-014 §3, a guard that cries wolf gets narrowed or deleted — the guard is then weakened, and the real rule goes unguarded. It also hands views-appwrite a way to redden this repository by declaring any short ordinary word as a value, which is C-86's coupling arriving through the guard meant to reduce it.
Work
- Delete the
secretexemption, or replace it with a declared exclusion carrying a stated reason and a test. Deleting is safe today and preferred — theisinstancefilter already handles valueless rows, and the exemption's only effect is a future hole. - Replace the length floor with a declared exclusion. A value that is also one of this package's own directory names cannot be distinguished from ordinary code by exact string equality. Exclude those by name, with the reason written down, rather than by a length threshold that excludes them as a side effect.
- State the hole this leaves: a genuine copy of a value that equals a package name will not be caught by the AST branch. That is accepted; S2: replace the assignment parser with a pair matcher, and give the scan a stopping rule #243's pair-matching still catches it in markdown, where
NAME=<value>disambiguates.
Acceptance criteria
-
scanned_sectionsderives from_TABLE_ROLEwith no inline name literal, or the exclusion is declared with a reason and a test asserting the reason still holds. - A test fails if a
[secret.*]row gains avalueand is not scanned. - The ban-set excludes package-name-colliding values by declaration; a test asserts the exclusion list equals the actual collision set, so it cannot silently grow.
- Mutation-proven: adding
logging.getLogger(<a partner name>)to a package module does not fail the scan; adding a real coordinate value does. - C-57 amended with the measured facts and the accepted residual.
Implementation notes
test_the_role_vocabulary_is_closed currently asserts that _TABLE_ROLE's values drive which sections the no-copy check reads — which line 1042 falsifies. Fix the code, not that assertion.
Testing
pytest -q tests/test_env_declaration.py plus the two mutations above.
Labels
story, implementation, testing
Activity
Polichinel commentedon Aug 12, 2026
Merged into #243.
Splitting "what the scanner hunts" from "how it matches" was an artefact of reviewing them separately — they are one change to one function, and doing them apart means touching the same twenty lines twice.
Both items carried over intact:
secretexemption (an inline literal under a comment claiming there is no inline literal; measured — it removes zero entries today and its only effect is a future hole)PARTNER_PACKAGES)Closing as merged, not as rejected.