Follow-up to #107. Verifying the staging sitemap count (25,189) turned up one Welsh school still standing.
Beechwood College, URN 142458, Sully, CF64 5SE. GIAS types it a Special post 16 institution (32) rather than a Welsh establishment (30), so filtering on establishment type alone left it behind. It was also why Vale of Glamorgan was still in the authority list on staging — 154 authorities where #107 predicted 153.
What went wrong in the original verification
#107 claimed the type codes mapped onto the Welsh authorities in both directions. That was checked exhaustively for Cardiff (144 of 144) and by count-matching for Swansea, Powys and Gwynedd. Vale of Glamorgan was never checked — and it was the one that did not hold.
The fix
LA code, not establishment type. GIAS gives the 22 Welsh unitary authorities the contiguous block 660-681, which English authorities never use (they occupy 201-384 and 800-938).
Not postcode. A postcode filter looks tempting and is wrong: Redbrook CofE, Tutshill CofE, Dean Close St John's, Wyedean School and Lift Offa's Mead are Gloucestershire schools carrying NP16/NP25 postcodes, because Royal Mail areas straddle the border. They are English schools with English performance data. A new e2e test pins three of them so this cannot be "simplified" into a postcode filter later.
How this is guarded
The 660-681 range is documented GIAS structure that this project cannot verify from its own data — local_authority_code is not exposed anywhere the app can assert on. So the range filters and the authority name checks: assert_england_only_schools now also fails if any of the 22 Welsh authority names survives in dim_location. If the range is ever wrong or incomplete, the pipeline fails loudly instead of the corpus quietly regrowing a Welsh tail.
The dbt test's authority list and the e2e WELSH_AUTHORITIES list were cross-checked programmatically and agree at 22 names.
Scan evidence
Paged all 25,186 staging schools and checked every postcode against the wholly-Welsh areas (CF, LL, NP, SA, LD). Six hits: five Gloucestershire border schools (correctly kept) and Beechwood College (the leak). No other Welsh school remains.
⚠️ Needs another staging Airflow run
Same as #107 — school_data_daily, then regenerate the sitemap, before the e2e gate.
Follow-up to #107. Verifying the staging sitemap count (25,189) turned up one Welsh school still standing.
**Beechwood College**, URN 142458, Sully, CF64 5SE. GIAS types it a *Special post 16 institution* (32) rather than a *Welsh establishment* (30), so filtering on establishment type alone left it behind. It was also why **Vale of Glamorgan** was still in the authority list on staging — 154 authorities where #107 predicted 153.
## What went wrong in the original verification
#107 claimed the type codes mapped onto the Welsh authorities in both directions. That was checked exhaustively for Cardiff (144 of 144) and by count-matching for Swansea, Powys and Gwynedd. Vale of Glamorgan was never checked — and it was the one that did not hold.
## The fix
LA code, not establishment type. GIAS gives the 22 Welsh unitary authorities the contiguous block **660-681**, which English authorities never use (they occupy 201-384 and 800-938).
**Not postcode.** A postcode filter looks tempting and is wrong: Redbrook CofE, Tutshill CofE, Dean Close St John's, Wyedean School and Lift Offa's Mead are Gloucestershire schools carrying NP16/NP25 postcodes, because Royal Mail areas straddle the border. They are English schools with English performance data. A new e2e test pins three of them so this cannot be "simplified" into a postcode filter later.
## How this is guarded
The 660-681 range is documented GIAS structure that this project cannot verify from its own data — `local_authority_code` is not exposed anywhere the app can assert on. So **the range filters and the authority name checks**: `assert_england_only_schools` now also fails if any of the 22 Welsh authority names survives in `dim_location`. If the range is ever wrong or incomplete, the pipeline fails loudly instead of the corpus quietly regrowing a Welsh tail.
The dbt test's authority list and the e2e `WELSH_AUTHORITIES` list were cross-checked programmatically and agree at 22 names.
## Scan evidence
Paged all 25,186 staging schools and checked every postcode against the wholly-Welsh areas (CF, LL, NP, SA, LD). Six hits: five Gloucestershire border schools (correctly kept) and Beechwood College (the leak). No other Welsh school remains.
## ⚠️ Needs another staging Airflow run
Same as #107 — `school_data_daily`, then regenerate the sitemap, before the e2e gate.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_015mWQnpye9F299NVRCCSRvj
Beechwood College (URN 142458, Sully, CF64 5SE) survived the England-only
filter. GIAS types it a Special post 16 institution (32), not a Welsh
establishment (30), so filtering on establishment type alone left it behind —
the last Welsh school on the site, and the reason Vale of Glamorgan was still
in the authority list.
The earlier verification claimed the type codes mapped onto the Welsh
authorities in both directions. That was checked exhaustively for Cardiff and
by count for three others; Vale of Glamorgan was never checked, and it was the
one that did not hold.
LA code is the reliable discriminator: GIAS gives the 22 Welsh unitary
authorities the contiguous block 660-681, which English authorities never use.
Filtering on postcode would have been wrong — Redbrook, Tutshill, Wyedean and
two other Gloucestershire schools carry NP16/NP25 postcodes because Royal Mail
areas straddle the border, and they are English schools with English data. An
e2e test now pins those five so the fix cannot be simplified into a postcode
filter later.
The 660-681 range is documented GIAS structure this project cannot verify from
its own data, so the range filters and the authority NAME checks: if the range
is ever wrong, a Welsh authority reappears in assert_england_only_schools and
the pipeline fails loudly.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015mWQnpye9F299NVRCCSRvj
This PR extends the England-only corpus filter to also exclude Welsh schools by local authority code (660-681), fixing a gap where Beechwood College (GIAS-typed as 'Special post 16 institution' rather than 'Welsh establishment') slipped through the existing type-code filter. The fix is applied consistently to dim_location.sql and dim_school.sql, backed by a new dbt test asserting no Welsh-named authority reappears in the corpus, and covered by new Playwright e2e tests including a regression guard for English schools with Welsh-looking postcodes. The change is well-scoped, internally consistent (column types, API response shape, and filter logic all verified), and includes thoughtful documentation of why a postcode-based filter was rejected.
✅ No issues found.
## 🤖 AI Code Review (Claude Code)
This PR extends the England-only corpus filter to also exclude Welsh schools by local authority code (660-681), fixing a gap where Beechwood College (GIAS-typed as 'Special post 16 institution' rather than 'Welsh establishment') slipped through the existing type-code filter. The fix is applied consistently to dim_location.sql and dim_school.sql, backed by a new dbt test asserting no Welsh-named authority reappears in the corpus, and covered by new Playwright e2e tests including a regression guard for English schools with Welsh-looking postcodes. The change is well-scoped, internally consistent (column types, API response shape, and filter logic all verified), and includes thoughtful documentation of why a postcode-based filter was rejected.
✅ No issues found.
tudor
merged commit 8ad2070e76 into main2026-08-20 21:59:39 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Follow-up to #107. Verifying the staging sitemap count (25,189) turned up one Welsh school still standing.
Beechwood College, URN 142458, Sully, CF64 5SE. GIAS types it a Special post 16 institution (32) rather than a Welsh establishment (30), so filtering on establishment type alone left it behind. It was also why Vale of Glamorgan was still in the authority list on staging — 154 authorities where #107 predicted 153.
What went wrong in the original verification
#107 claimed the type codes mapped onto the Welsh authorities in both directions. That was checked exhaustively for Cardiff (144 of 144) and by count-matching for Swansea, Powys and Gwynedd. Vale of Glamorgan was never checked — and it was the one that did not hold.
The fix
LA code, not establishment type. GIAS gives the 22 Welsh unitary authorities the contiguous block 660-681, which English authorities never use (they occupy 201-384 and 800-938).
Not postcode. A postcode filter looks tempting and is wrong: Redbrook CofE, Tutshill CofE, Dean Close St John's, Wyedean School and Lift Offa's Mead are Gloucestershire schools carrying NP16/NP25 postcodes, because Royal Mail areas straddle the border. They are English schools with English performance data. A new e2e test pins three of them so this cannot be "simplified" into a postcode filter later.
How this is guarded
The 660-681 range is documented GIAS structure that this project cannot verify from its own data —
local_authority_codeis not exposed anywhere the app can assert on. So the range filters and the authority name checks:assert_england_only_schoolsnow also fails if any of the 22 Welsh authority names survives indim_location. If the range is ever wrong or incomplete, the pipeline fails loudly instead of the corpus quietly regrowing a Welsh tail.The dbt test's authority list and the e2e
WELSH_AUTHORITIESlist were cross-checked programmatically and agree at 22 names.Scan evidence
Paged all 25,186 staging schools and checked every postcode against the wholly-Welsh areas (CF, LL, NP, SA, LD). Six hits: five Gloucestershire border schools (correctly kept) and Beechwood College (the leak). No other Welsh school remains.
⚠️ Needs another staging Airflow run
Same as #107 —
school_data_daily, then regenerate the sitemap, before the e2e gate.🤖 Generated with Claude Code
https://claude.ai/code/session_015mWQnpye9F299NVRCCSRvj
🤖 AI Code Review (Claude Code)
This PR extends the England-only corpus filter to also exclude Welsh schools by local authority code (660-681), fixing a gap where Beechwood College (GIAS-typed as 'Special post 16 institution' rather than 'Welsh establishment') slipped through the existing type-code filter. The fix is applied consistently to dim_location.sql and dim_school.sql, backed by a new dbt test asserting no Welsh-named authority reappears in the corpus, and covered by new Playwright e2e tests including a regression guard for English schools with Welsh-looking postcodes. The change is well-scoped, internally consistent (column types, API response shape, and filter logic all verified), and includes thoughtful documentation of why a postcode-based filter was rejected.
✅ No issues found.