Repository navigation
feat(review): locale packs for national identifier shapes, UK first - #159
Merged
Merged
Conversation
Implements the architecture scoped on #146: a locale pack is pure data (hooks/locales/<locale>.json) holding identifier regexes, optional named checksum validators, and column-name patterns. Projects opt in with phi_environment.locale in config.local.yaml; the default stays the built-in US shapes. New countries need no guard-code changes - the UK pack ships as the template (NHS number mod-11, Scottish CHI mod-11 with DDMMYY plausibility, and the unit postcode as a quasi-identifier). Checksum-valid matches are identifiers; checksum-INVALID matches (synthetic/test fixtures) pass, so the MedSci fixture rule - never commit a value that could name a real person - is enforced by design. A malformed or unknown pack fails closed like a malformed identifier index. Locale columns join the aggregate-table header scan; shared identifier block stays byte-identical across the hook, indexer, and schema-peek copies (contract test unchanged). Closes #146 Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
⛔ Files ignored due to path filters: 2
📒 Files selected for processing: 7
✨ Finishing Touches
Comment |
sajor2000
force-pushed
the
feat/locale-packs-uk
branch
from
October 22, 2026 04:33
e75c079 to
96b85ca
Compare
Merged
This was referenced Oct 22, 2026
sajor2000
added a commit
that referenced
this pull request
Oct 22, 2026
sajor2000
added a commit
that referenced
this pull request
Oct 22, 2026
…166) Closes the follow-up noted in #159. The schema helper now reads phi_environment.locale from the machine-local config (worktree first, then the main checkout), masks headings matching the active locale's column patterns like any other identifier heading, and refuses to print (LocaleError, exit 1) on a malformed or unknown pack. All three copies stay identical; boundary-doc sections updated in step. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Locale packs for the data-boundary guard (#146): national identifier shapes as pure data, UK first as the template pack.
hooks/locales/uk.json— NHS number (mod-11), Scottish CHI (mod-11 + DDMMYY plausibility), UK unit postcode (quasi-identifier), plus column-name patterns (nhs_number,chi,postcode, ...).phi_environment.locale: ukinconfig.local.yaml. Default unchanged (built-in US shapes); locale checks ride on US defaults, never replace them.locale:key is inert.Closes #146
Validation
bun test tests/data-boundary-locale.test.ts— 13 tests: pack shape, validator truth tables, egress denies (valid NHS/CHI/postcode), checksum-invalid controls pass, US defaults still fire, opt-in explicitness, unknown-locale fail-closed, content-scan deny on a UK-column CSV uploadbun test— full suite green (1762 tests), shared-block parity test passingbun run release:validate— in sync