From 6da2e79a8a8d5e77bf5d6d1acf12a762e1ae138a Mon Sep 17 00:00:00 2001 From: cesnimda Date: Thu, 19 Nov 2026 14:12:47 +0100 Subject: [PATCH] test(global-jobs): extend offline multi-country contracts --- .../00/GEOGRAPHY_CONTRACT_FIXTURES.json | 609 +++++++++++++++++- docs/global-jobs/00/GEOGRAPHY_CONTRACT_QA.md | 2 + .../00/GEOGRAPHY_MULTI_COUNTRY_QA.md | 42 ++ .../multi-country/SOURCE_RECEIPTS.json | 72 +++ .../00/evidence/multi-country/green.json | 11 + docs/global-jobs/00/validate-contracts.cjs | 49 +- 6 files changed, 771 insertions(+), 14 deletions(-) create mode 100644 docs/global-jobs/00/GEOGRAPHY_MULTI_COUNTRY_QA.md create mode 100644 docs/global-jobs/00/evidence/multi-country/SOURCE_RECEIPTS.json create mode 100644 docs/global-jobs/00/evidence/multi-country/green.json diff --git a/docs/global-jobs/00/GEOGRAPHY_CONTRACT_FIXTURES.json b/docs/global-jobs/00/GEOGRAPHY_CONTRACT_FIXTURES.json index cd0d8452..5c547a6b 100644 --- a/docs/global-jobs/00/GEOGRAPHY_CONTRACT_FIXTURES.json +++ b/docs/global-jobs/00/GEOGRAPHY_CONTRACT_FIXTURES.json @@ -107,6 +107,70 @@ "label": "Île-de-France", "edition": "synthetic-1", "provenance": "synthetic-no-boundary-claim" + }, + { + "id": "s:BE:region:brussels", + "country": "BE", + "type": "region", + "label": "Brussels fixture region", + "edition": "synthetic-1", + "provenance": "synthetic-no-boundary-claim" + }, + { + "id": "s:BE:municipality:brussels", + "country": "BE", + "type": "municipality", + "label": "Bruxelles / Brussel", + "edition": "synthetic-1", + "provenance": "synthetic-no-boundary-claim" + }, + { + "id": "s:FR:town:paris", + "country": "FR", + "type": "town", + "label": "Paris", + "edition": "synthetic-1", + "provenance": "synthetic-no-boundary-claim" + }, + { + "id": "s:DE:town:munich", + "country": "DE", + "type": "town", + "label": "München / Munich", + "edition": "synthetic-1", + "provenance": "synthetic-no-boundary-claim" + }, + { + "id": "s:PL:region:masovia", + "country": "PL", + "type": "region", + "label": "Mazowieckie", + "edition": "synthetic-1", + "provenance": "synthetic-no-boundary-claim" + }, + { + "id": "s:PL:town:warsaw", + "country": "PL", + "type": "town", + "label": "Warszawa / Warsaw", + "edition": "synthetic-1", + "provenance": "synthetic-no-boundary-claim" + }, + { + "id": "s:BE:town:riverside", + "country": "BE", + "type": "town", + "label": "Synthetic Riverside", + "edition": "synthetic-1", + "provenance": "synthetic-no-boundary-claim" + }, + { + "id": "s:FR:town:riverside", + "country": "FR", + "type": "town", + "label": "Synthetic Riverside", + "edition": "synthetic-1", + "provenance": "synthetic-no-boundary-claim" } ], "edges": [ @@ -144,6 +208,36 @@ "child": "s:NO:municipality:oslo", "parent": "s:NO:county:oslo", "type": "same-footprint" + }, + { + "child": "s:BE:municipality:brussels", + "parent": "s:BE:region:brussels", + "type": "administrative-parent" + }, + { + "child": "s:FR:town:paris", + "parent": "s:FR:region:idf", + "type": "administrative-parent" + }, + { + "child": "s:DE:town:munich", + "parent": "s:DE:state:bavaria", + "type": "administrative-parent" + }, + { + "child": "s:PL:town:warsaw", + "parent": "s:PL:region:masovia", + "type": "administrative-parent" + }, + { + "child": "s:BE:town:riverside", + "parent": "s:BE:region:brussels", + "type": "administrative-parent" + }, + { + "child": "s:FR:town:riverside", + "parent": "s:FR:region:idf", + "type": "administrative-parent" } ], "scenarios": [ @@ -449,13 +543,212 @@ ] }, "expanded": [] + }, + { + "name": "BE FR independent city branches", + "countries": [ + "BE", + "FR" + ], + "branches": [ + { + "root": "s:BE:region:brussels", + "refinements": [ + "s:BE:municipality:brussels" + ] + }, + { + "root": "s:FR:region:idf", + "refinements": [ + "s:FR:town:paris" + ] + } + ], + "expected": { + "query": [ + "s:BE:municipality:brussels", + "s:FR:town:paris" + ], + "tree": [ + "s:BE:municipality:brussels", + "s:FR:town:paris" + ], + "map": [ + "s:BE:municipality:brussels", + "s:FR:town:paris" + ] + }, + "expanded": [] + }, + { + "name": "BE FR expanded is selection-neutral", + "countries": [ + "BE", + "FR" + ], + "branches": [ + { + "root": "s:BE:region:brussels", + "refinements": [ + "s:BE:municipality:brussels" + ] + }, + { + "root": "s:FR:region:idf", + "refinements": [ + "s:FR:town:paris" + ] + } + ], + "expected": { + "query": [ + "s:BE:municipality:brussels", + "s:FR:town:paris" + ], + "tree": [ + "s:BE:municipality:brussels", + "s:FR:town:paris" + ], + "map": [ + "s:BE:municipality:brussels", + "s:FR:town:paris" + ] + }, + "expanded": [ + "s:BE:region:brussels", + "s:FR:region:idf" + ], + "equivalentTo": "BE FR independent city branches" + }, + { + "name": "DE PL independent city branches", + "countries": [ + "DE", + "PL" + ], + "branches": [ + { + "root": "s:DE:state:bavaria", + "refinements": [ + "s:DE:town:munich" + ] + }, + { + "root": "s:PL:region:masovia", + "refinements": [ + "s:PL:town:warsaw" + ] + } + ], + "expected": { + "query": [ + "s:DE:town:munich", + "s:PL:town:warsaw" + ], + "tree": [ + "s:DE:town:munich", + "s:PL:town:warsaw" + ], + "map": [ + "s:DE:town:munich", + "s:PL:town:warsaw" + ] + }, + "expanded": [] + }, + { + "name": "equal labels retain cross-border identities", + "countries": [ + "BE", + "FR" + ], + "branches": [ + { + "root": "s:BE:region:brussels", + "refinements": [ + "s:BE:town:riverside" + ] + }, + { + "root": "s:FR:region:idf", + "refinements": [ + "s:FR:town:riverside" + ] + } + ], + "expected": { + "query": [ + "s:BE:town:riverside", + "s:FR:town:riverside" + ], + "tree": [ + "s:BE:town:riverside", + "s:FR:town:riverside" + ], + "map": [ + "s:BE:town:riverside", + "s:FR:town:riverside" + ] + }, + "expanded": [] } ], "journeys": [ - { "residence": "NO", "uiLocale": "en-GB", "countries": ["GB"], "adLanguages": ["en"], "documentLanguages": ["nb"] }, - { "residence": "NO", "uiLocale": "nb-NO", "countries": ["SE"], "adLanguages": ["sv", "en"], "documentLanguages": ["nb"] }, - { "residence": "DE", "uiLocale": "pl-PL", "countries": ["DE"], "adLanguages": ["de", "pl"], "documentLanguages": ["pl"] }, - { "residence": "BE", "uiLocale": "fr-FR", "countries": ["BE", "FR"], "adLanguages": ["fr"], "documentLanguages": ["en"] } + { + "residence": "NO", + "uiLocale": "en-GB", + "countries": [ + "GB" + ], + "adLanguages": [ + "en" + ], + "documentLanguages": [ + "nb" + ] + }, + { + "residence": "NO", + "uiLocale": "nb-NO", + "countries": [ + "SE" + ], + "adLanguages": [ + "sv", + "en" + ], + "documentLanguages": [ + "nb" + ] + }, + { + "residence": "DE", + "uiLocale": "pl-PL", + "countries": [ + "DE" + ], + "adLanguages": [ + "de", + "pl" + ], + "documentLanguages": [ + "pl" + ] + }, + { + "residence": "BE", + "uiLocale": "fr-FR", + "countries": [ + "BE", + "FR" + ], + "adLanguages": [ + "fr" + ], + "documentLanguages": [ + "en" + ] + } ], "countryChange": { "beforeCountries": [ @@ -517,5 +810,313 @@ ], "savedSearch": "unchanged-synthetic-definition" } + }, + "additionalCountryChanges": [ + { + "beforeCountries": [ + "BE", + "FR" + ], + "afterCountries": [ + "BE" + ], + "beforeBranches": [ + { + "root": "s:BE:region:brussels", + "refinements": [ + "s:BE:municipality:brussels" + ] + }, + { + "root": "s:FR:region:idf", + "refinements": [ + "s:FR:town:paris" + ] + } + ], + "afterBranches": [ + { + "root": "s:BE:region:brussels", + "refinements": [ + "s:BE:municipality:brussels" + ] + } + ], + "cleared": [ + "s:FR:region:idf" + ], + "explanation": "Only the FR filter leaves this temporary search.", + "before": { + "residence": "BE", + "uiLocale": "fr-FR", + "adLanguages": [ + "fr", + "nl" + ], + "documentLanguages": [ + "en", + "fr" + ], + "savedSearch": { + "name": "Synthetic BE FR search", + "countries": [ + "BE", + "FR" + ], + "branches": [ + { + "root": "s:BE:region:brussels", + "refinements": [ + "s:BE:municipality:brussels" + ] + }, + { + "root": "s:FR:region:idf", + "refinements": [ + "s:FR:town:paris" + ] + } + ] + } + }, + "after": { + "residence": "BE", + "uiLocale": "fr-FR", + "adLanguages": [ + "fr", + "nl" + ], + "documentLanguages": [ + "en", + "fr" + ], + "savedSearch": { + "name": "Synthetic BE FR search", + "countries": [ + "BE", + "FR" + ], + "branches": [ + { + "root": "s:BE:region:brussels", + "refinements": [ + "s:BE:municipality:brussels" + ] + }, + { + "root": "s:FR:region:idf", + "refinements": [ + "s:FR:town:paris" + ] + } + ] + } + } + }, + { + "beforeCountries": [ + "DE", + "PL" + ], + "afterCountries": [ + "PL" + ], + "beforeBranches": [ + { + "root": "s:DE:state:bavaria", + "refinements": [ + "s:DE:town:munich" + ] + }, + { + "root": "s:PL:region:masovia", + "refinements": [ + "s:PL:town:warsaw" + ] + } + ], + "afterBranches": [ + { + "root": "s:PL:region:masovia", + "refinements": [ + "s:PL:town:warsaw" + ] + } + ], + "cleared": [ + "s:DE:state:bavaria" + ], + "explanation": "Only the DE filter leaves this temporary search.", + "before": { + "residence": "BE", + "uiLocale": "fr-FR", + "adLanguages": [ + "fr", + "nl" + ], + "documentLanguages": [ + "en", + "fr" + ], + "savedSearch": { + "name": "Synthetic BE FR search", + "countries": [ + "BE", + "FR" + ], + "branches": [ + { + "root": "s:BE:region:brussels", + "refinements": [ + "s:BE:municipality:brussels" + ] + }, + { + "root": "s:FR:region:idf", + "refinements": [ + "s:FR:town:paris" + ] + } + ] + } + }, + "after": { + "residence": "BE", + "uiLocale": "fr-FR", + "adLanguages": [ + "fr", + "nl" + ], + "documentLanguages": [ + "en", + "fr" + ], + "savedSearch": { + "name": "Synthetic BE FR search", + "countries": [ + "BE", + "FR" + ], + "branches": [ + { + "root": "s:BE:region:brussels", + "refinements": [ + "s:BE:municipality:brussels" + ] + }, + { + "root": "s:FR:region:idf", + "refinements": [ + "s:FR:town:paris" + ] + } + ] + } + } + } + ], + "localeChange": { + "before": { + "residence": "BE", + "uiLocale": "fr-FR", + "adLanguages": [ + "fr", + "nl" + ], + "documentLanguages": [ + "en", + "fr" + ], + "savedSearch": { + "name": "Synthetic BE FR search", + "countries": [ + "BE", + "FR" + ], + "branches": [ + { + "root": "s:BE:region:brussels", + "refinements": [ + "s:BE:municipality:brussels" + ] + }, + { + "root": "s:FR:region:idf", + "refinements": [ + "s:FR:town:paris" + ] + } + ] + }, + "countries": [ + "BE", + "FR" + ], + "branches": [ + { + "root": "s:BE:region:brussels", + "refinements": [ + "s:BE:municipality:brussels" + ] + }, + { + "root": "s:FR:region:idf", + "refinements": [ + "s:FR:town:paris" + ] + } + ] + }, + "after": { + "residence": "BE", + "uiLocale": "nl-BE", + "adLanguages": [ + "fr", + "nl" + ], + "documentLanguages": [ + "en", + "fr" + ], + "savedSearch": { + "name": "Synthetic BE FR search", + "countries": [ + "BE", + "FR" + ], + "branches": [ + { + "root": "s:BE:region:brussels", + "refinements": [ + "s:BE:municipality:brussels" + ] + }, + { + "root": "s:FR:region:idf", + "refinements": [ + "s:FR:town:paris" + ] + } + ] + }, + "countries": [ + "BE", + "FR" + ], + "branches": [ + { + "root": "s:BE:region:brussels", + "refinements": [ + "s:BE:municipality:brussels" + ] + }, + { + "root": "s:FR:region:idf", + "refinements": [ + "s:FR:town:paris" + ] + } + ] + } } } diff --git a/docs/global-jobs/00/GEOGRAPHY_CONTRACT_QA.md b/docs/global-jobs/00/GEOGRAPHY_CONTRACT_QA.md index 5b674237..17399f24 100644 --- a/docs/global-jobs/00/GEOGRAPHY_CONTRACT_QA.md +++ b/docs/global-jobs/00/GEOGRAPHY_CONTRACT_QA.md @@ -2,6 +2,8 @@ 17 November 2026. Bounded documentation/tooling increment authorised by the current direct roadmap continuation. This is executable specification QA, not GJ-01/GJ-02 implementation or acceptance. No application imports, dependencies, settings, migrations, HTTP requests, provider/model calls or qualification statuses change. +19 November: the [multi-country extension](GEOGRAPHY_MULTI_COUNTRY_QA.md) adds BE/FR and DE/PL fixtures, expansion and locale-change invariants. The outcomes below retain the original `48861bca` checkpoint; use the extension for current validator counts. + ## Inputs and identity Application baseline: `eb2538772e1bfabbeb291e4a5efa177c79074de1` (A3). Isolated branch `codex/global-geo-contracts`; worktree `E:/Storage/Projects/Active/temp docs/jobjakt-local-build/global-geo-contracts`. diff --git a/docs/global-jobs/00/GEOGRAPHY_MULTI_COUNTRY_QA.md b/docs/global-jobs/00/GEOGRAPHY_MULTI_COUNTRY_QA.md new file mode 100644 index 00000000..4660b479 --- /dev/null +++ b/docs/global-jobs/00/GEOGRAPHY_MULTI_COUNTRY_QA.md @@ -0,0 +1,42 @@ +# Multi-country geography specification QA + +19 November 2026. Extends the accepted offline contract checkpoint `48861bca706637fdb217e0e834e67fe052113195` on `codex/global-geo-contracts`. Application baseline remains `eb2538772e1bfabbeb291e4a5efa177c79074de1`; no application source is modified or claimed current by these checks. + +## Eligible gap and gates + +The current central TODO still gates GJ-01 on Phase 10 D02, Product Review and initiative approval. GJ-02 runtime geography, licensed datasets, providers/maps, locale rollout and release approval remain separate. The existing 59-country coverage snapshot retains every status. Current owner scope permits useful offline specification qualification only. + +The earlier corpus had GB/NO cross-border scope but no BE/FR or DE/PL location-selection examples; its DE/FR reference nodes were unused. Its four preference examples checked field shapes, while only one country-change expectation was validated and no locale-change expectation preserved canonical selection. This increment extends that same corpus and small validator; it creates no second country/locale registry or runtime compiler. + +## Added contracts + +- BE/FR independent city branches and DE/PL independent city branches combine as OR using distinct country/type IDs. +- Expanding the BE/FR tree has exactly the same declared countries, branches and query/tree/map scopes as the collapsed counterpart. +- Two intentionally fictional locations called `Synthetic Riverside` in different countries retain distinct identifiers and both effective scopes. Labels cannot merge them. +- Removing FR from a temporary BE/FR query or DE from DE/PL removes only the incompatible branch and explains the change. It preserves residence, UI/ad/document languages and the separate named saved-search definition. +- A declared FR→NL UI-locale change preserves countries, canonical branch IDs, residence, ad/document languages and the literal named saved search. + +All added identities/relations remain under synthetic namespace `s:`, edition `synthetic-1`, provenance `synthetic-no-boundary-claim`. Familiar labels do not establish real administrative containment, legal language status, licensed data/geometry or precise settlement coverage. The equal-name locations are deliberately fictional. The locale example does not activate or qualify French/Dutch UI catalogues. + +## Evidence + +Original validator plus the new negative controls **FAILED**: `Missing expected exception: must reject BE FR retains an incompatible filter`. This proved that the additional country-change declarations were not being checked, rather than merely counting more positive fixtures. + +The final `rtk proxy node docs/global-jobs/00/validate-contracts.cjs --self-test` **PASSED**: + +| Check | Final count | +| --- | ---: | +| Existing candidate rows / frozen status cells | 59 / 1,062 | +| Synthetic nodes / typed edges | 21 / 13 | +| Selection expectation cases | 16 | +| Existing preference examples | 4 | +| Country-change / locale-change expectations | 3 / 1 | +| Rejected negative mutations | 30 | + +The original 22 mutations are included in 30, not additional product tests. Eight new controls reject hidden removed-country filters, compatible-branch loss, absent explanation, rewritten saved definitions, locale-driven country/document changes, expansion broadening and same-label scope merging. These validate specification consistency; no browser, API, persistence, map or query-engine behavior is exercised. + +Node syntax and Git source whitespace checks passed. Native red/green output and source/artifact hashes are under [evidence/multi-country](evidence/multi-country/SOURCE_RECEIPTS.json). The country matrix/CSV/geography decision Git bindings remain exactly those in the [original report](GEOGRAPHY_CONTRACT_QA.md); no refresh of external licensing/provider evidence is implied. + +AST-only `graphify update . --no-cluster` completed exit 0: 19,848 nodes / 49,194 edges. Missing PDF/SQL extractors and 146 inputs yielding no symbols remain graph limitations. Generated graph files stay local/untracked; no semantic/LLM graph pass was run. + +No application tests/build/browser, real geographic datasets, provider/model/translation service or human/native-language/device qualification was run. No central roadmap edit, runtime feature, qualification-status promotion, main merge or production deployment. Only normal development-branch Git publication is authorised. diff --git a/docs/global-jobs/00/evidence/multi-country/SOURCE_RECEIPTS.json b/docs/global-jobs/00/evidence/multi-country/SOURCE_RECEIPTS.json new file mode 100644 index 00000000..63cdc199 --- /dev/null +++ b/docs/global-jobs/00/evidence/multi-country/SOURCE_RECEIPTS.json @@ -0,0 +1,72 @@ +{ + "base": "48861bca706637fdb217e0e834e67fe052113195", + "policy": "LF-normalised UTF8 source, exact raw artifact bytes", + "redSource": { + "sha256Lf": "e9976a642147c1760dde193a973c0b6be9af8344e1cb98760218bafef65a696c", + "derivation": "48861bca validator plus exactly the eight new selfTest cases after invalid journey country; current fixture unchanged" + }, + "sources": [ + { + "file": "docs/global-jobs/00/validate-contracts.cjs", + "sha256Lf": "03963222086071855af9c41c8df77fe9ad9a76952f86f813a42512af9b43e782" + }, + { + "file": "docs/global-jobs/00/GEOGRAPHY_CONTRACT_FIXTURES.json", + "sha256Lf": "c6c9f324369195d05410df57d04e9d9c799bd6f3fda453d156973edee5e5b231" + } + ], + "artifacts": [ + { + "file": "red.log", + "bytes": 1097, + "sha256": "6eaab9962a4f9998d8ae79592529f28f46476e6ea447a46b24439122423d183c" + }, + { + "file": "green.json", + "bytes": 277, + "sha256": "fe313355b73dbfea34d66ed91f57b241ce3e1e976a65f4c3d4a7e1eb9972b643" + }, + { + "file": "green.stderr.log", + "bytes": 0, + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + ], + "node": "v24.19.0", + "results": { + "countries": 59, + "coverageCells": 1062, + "syntheticNodes": 21, + "syntheticScenarios": 16, + "preferenceJourneys": 4, + "countryChangeInvariants": 3, + "localeChangeInvariants": 1, + "qualification": "offline specification consistency only", + "rejectedMutations": 30 + }, + "limits": [ + "Offline specification only", + "No coverage or acceptance promotion", + "External source rights not refreshed" + ], + "checks": { + "syntax": { + "command": "rtk proxy node --check docs/global-jobs/00/validate-contracts.cjs", + "exitCode": 0 + }, + "diff": { + "command": "rtk git diff --check", + "exitCode": 0 + }, + "sourceArtifactBindings": { + "exitCode": 0 + }, + "graph": { + "command": "rtk proxy graphify update . --no-cluster", + "exitCode": 0, + "nodes": 19848, + "edges": 49194, + "scope": "AST only; generated graph untracked" + } + } +} diff --git a/docs/global-jobs/00/evidence/multi-country/green.json b/docs/global-jobs/00/evidence/multi-country/green.json new file mode 100644 index 00000000..a977b089 --- /dev/null +++ b/docs/global-jobs/00/evidence/multi-country/green.json @@ -0,0 +1,11 @@ +{ + "countries": 59, + "coverageCells": 1062, + "syntheticNodes": 21, + "syntheticScenarios": 16, + "preferenceJourneys": 4, + "countryChangeInvariants": 3, + "localeChangeInvariants": 1, + "qualification": "offline specification consistency only", + "rejectedMutations": 30 +} diff --git a/docs/global-jobs/00/validate-contracts.cjs b/docs/global-jobs/00/validate-contracts.cjs index 778070a2..4a9e9b3a 100644 --- a/docs/global-jobs/00/validate-contracts.cjs +++ b/docs/global-jobs/00/validate-contracts.cjs @@ -89,17 +89,34 @@ function validate(fixture, matrix, coverage) { for (const surface of ['query', 'tree', 'map']) { assert.deepEqual(sorted(scenario.expected[surface]), sorted(leaves), `incorrect ${surface} scope: ${scenario.name}`); } + if (scenario.equivalentTo) { + const other = fixture.scenarios.find(item => item.name === scenario.equivalentTo); + assert(other && other !== scenario, 'missing equivalent selection'); + assert.deepEqual(scenario.countries, other.countries, 'expansion changes search countries'); + assert.deepEqual(scenario.branches, other.branches, 'expansion changes selected branches'); + assert.deepEqual(scenario.expected, other.expected, 'expansion changes effective scope'); + } assert.deepEqual(JSON.parse(JSON.stringify(scenario)), scenario, 'fixture roundtrip'); } - const change = fixture.countryChange; - checkBranches(change.beforeBranches, change.beforeCountries); - checkBranches(change.afterBranches, change.afterCountries); - const retained = change.beforeBranches.filter(branch => change.afterCountries.includes(nodes.get(branch.root).country)); - assert.deepEqual(change.afterBranches, retained, 'only incompatible filters may clear'); - assert.deepEqual(change.cleared, change.beforeBranches.filter(branch => !retained.includes(branch)).map(branch => branch.root)); - assert(change.explanation.trim(), 'country change explanation required'); - assert.deepEqual(change.after, change.before, 'unrelated preferences/saved search changed'); - assert.deepEqual(Object.keys(change.before).sort(), ['adLanguages', 'documentLanguages', 'residence', 'savedSearch', 'uiLocale']); + const countryChanges = [fixture.countryChange, ...fixture.additionalCountryChanges]; + for (const change of countryChanges) { + checkBranches(change.beforeBranches, change.beforeCountries); + checkBranches(change.afterBranches, change.afterCountries); + const retained = change.beforeBranches.filter(branch => change.afterCountries.includes(nodes.get(branch.root).country)); + assert.deepEqual(change.afterBranches, retained, 'only incompatible filters may clear'); + assert.deepEqual(change.cleared, change.beforeBranches.filter(branch => !retained.includes(branch)).map(branch => branch.root)); + assert(change.explanation.trim(), 'country change explanation required'); + assert.deepEqual(change.after, change.before, 'unrelated preferences/saved search changed'); + assert.deepEqual(Object.keys(change.before).sort(), ['adLanguages', 'documentLanguages', 'residence', 'savedSearch', 'uiLocale']); + } + const { uiLocale: previousLocale, ...previousSelection } = fixture.localeChange.before; + const { uiLocale: nextLocale, ...nextSelection } = fixture.localeChange.after; + assert(typeof previousLocale === 'string' && previousLocale.trim()); + assert(typeof nextLocale === 'string' && nextLocale.trim()); + assert.notEqual(previousLocale, nextLocale, 'fixture must exercise an actual locale change'); + checkBranches(previousSelection.branches, previousSelection.countries); + checkBranches(nextSelection.branches, nextSelection.countries); + assert.deepEqual(nextSelection, previousSelection, 'locale change rewrites search or document preferences'); assert.equal(fixture.journeys.length, 4); for (const journey of fixture.journeys) { assert(codes.includes(journey.residence)); @@ -111,7 +128,8 @@ function validate(fixture, matrix, coverage) { assert(journey.documentLanguages.every(language => typeof language === 'string')); } return { countries: codes.length, coverageCells: lines.length * (columns.length - 1), syntheticNodes: nodes.size, - syntheticScenarios: fixture.scenarios.length, preferenceJourneys: fixture.journeys.length, countryChangeInvariants: 1, + syntheticScenarios: fixture.scenarios.length, preferenceJourneys: fixture.journeys.length, countryChangeInvariants: countryChanges.length, + localeChangeInvariants: 1, qualification: 'offline specification consistency only' }; } function selfTest(fixture, matrix, coverage) { @@ -140,6 +158,17 @@ function selfTest(fixture, matrix, coverage) { }], ['administrative cycle', f => { f.edges.push({child: f.edges[0].parent, parent: f.edges[0].child, type: 'administrative-parent'}); }], ['invalid journey country', f => { f.journeys[0].countries = ['ZZ']; }], + ['BE FR retains an incompatible filter', f => { f.additionalCountryChanges[0].afterBranches = f.additionalCountryChanges[0].beforeBranches; }], + ['BE FR drops a compatible branch', f => { f.additionalCountryChanges[0].afterBranches = []; }], + ['country change lacks an explanation', f => { f.additionalCountryChanges[1].explanation = ''; }], + ['temporary country change rewrites a saved definition', f => { f.additionalCountryChanges[0].after.savedSearch.countries = ['BE']; }], + ['locale switch changes country scope', f => { f.localeChange.after.countries = ['BE']; }], + ['locale switch changes document language', f => { f.localeChange.after.documentLanguages = ['nl']; }], + ['expansion broadens the selected branch', f => { + f.scenarios[13].branches[0].refinements = []; + for (const surface of ['query', 'tree', 'map']) f.scenarios[13].expected[surface] = ['s:BE:region:brussels', 's:FR:town:paris']; + }], + ['equal labels merge distinct countries', f => { f.scenarios[15].expected.query.pop(); }], ]; for (const [name, mutate] of cases) { const candidate = structuredClone(fixture);