You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Disclosure release: area codes that don't match skip the nesting and prior-public checks without an error #625
The release check matches areas by their code strings, and two inputs are never checked against the areas the release holds. A mismatch does not raise: the check simply finds nothing to check.
parent_of values are not validated. For a weight-matrix level, Release._groups (src/policyengine/disclosure/release.py:337-346) checks that every child area has an entry in parent_of, but not that the entry is one of the parent level's area codes. If it isn't, every parent group comes out empty and the nesting check passes with no finding.
Prior publications are not validated._known_cells (release.py:269-277) and _check_prior (release.py:805-819) use PriorPublic.cells as given. A prior cell whose area code matches no area of that level is silently ignored, so a region the release withholds but an earlier publication showed is treated as still hidden, and the "already public" finding never fires.
UK region codes differ by dataset. The adapter keys regions on region_code_oa when present, else region (src/policyengine/outputs/uk_geography_disclosure.py:36-40). On the Microcosm local file that is a GSS code (E12000007); on a national file it is the engine enum (LONDON). The Autumn Budget dashboard's constituencies_2024.csv uses a third spelling (London, Eastern). So regional results published from the national dataset, passed as prior_public to a seat release from the local file, match nothing, and a seat-to-region map built from the dashboard's CSV matches nothing.
Synthetic probe (no survey data): 400 records in two regions, a 4 × 400 seat matrix, one seat withheld because three records carry it.
parent_of with the region level's own codes: the seat is withheld and the check returns three blocking recoverable_remainder findings (the withheld seat is its region minus the other seat).
The same release with parent_of naming the regions differently: the seat is still withheld, and the check returns no findings.
Proposed fix
In _groups, raise DisclosureError when any parent_of value is not in parent.areas.area_codes.
In Release.__init__ or check(), raise (or return a blocking finding) for any prior_public cell whose level is in the release but whose area code is not an area of that level.
In the UK adapter, normalise region codes to one scheme (GSS, as Microcosm writes) whether they come from region_code_oa or region, and document it so publishers use the same codes in prior_public and parent_of.
Add the probe above as a test.
Priority
High. Before any seat-level release that follows a published regional release (about 24 October), and ideally before the regional release on about 20 October, so its codes are the ones later releases will match.
Activity