@mailwoman/resolver 8.6.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +8 -0
- package/out/index.d.ts +2 -0
- package/out/index.d.ts.map +1 -1
- package/out/index.js +1 -0
- package/out/index.js.map +1 -1
- package/out/postcode-country-coherence.d.ts +155 -0
- package/out/postcode-country-coherence.d.ts.map +1 -0
- package/out/postcode-country-coherence.js +213 -0
- package/out/postcode-country-coherence.js.map +1 -0
- package/out/resolve.d.ts.map +1 -1
- package/out/resolve.js +31 -2
- package/out/resolve.js.map +1 -1
- package/package.json +12 -4
- package/postcode-country-coherence.ts +296 -0
- package/resolve.ts +39 -2
package/index.ts
CHANGED
|
@@ -40,6 +40,14 @@ export type {
|
|
|
40
40
|
StreetLocalityEvidence,
|
|
41
41
|
} from "./street-evidence.ts"
|
|
42
42
|
|
|
43
|
+
export {
|
|
44
|
+
findPostcodeCountryScope,
|
|
45
|
+
firstLocalityValue,
|
|
46
|
+
POSTCODE_COUNTRY_COHERENCE_GATE_KM,
|
|
47
|
+
stampPostcodeCountryScope,
|
|
48
|
+
} from "./postcode-country-coherence.ts"
|
|
49
|
+
|
|
50
|
+
export type { PostcodeCountryScope, PostcodeCountryScopeOpts } from "./postcode-country-coherence.ts"
|
|
43
51
|
export { findRescoreCandidate, hasResolvedPlace } from "./span-rescore.ts"
|
|
44
52
|
export type { RescoreCandidate, SpanRescoreOptions } from "./span-rescore.ts"
|
|
45
53
|
|
package/out/index.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export { COUNTRY_BBOX, finestResolvedCoordinate, isImplausibleResolution, outsid
|
|
|
17
17
|
export type { PlausibilityOpts, PlausibilityVerdict, ResolvedCoordinate } from "./plausibility.ts";
|
|
18
18
|
export { foldStreetSurface, isPureTypeVocabulary, pickByStreetEvidence } from "./street-evidence.ts";
|
|
19
19
|
export type { PickByStreetEvidenceOpts, StreetCandidate, StreetEvidencePick, StreetEvidenceScope, StreetLocalityEvidence, } from "./street-evidence.ts";
|
|
20
|
+
export { findPostcodeCountryScope, firstLocalityValue, POSTCODE_COUNTRY_COHERENCE_GATE_KM, stampPostcodeCountryScope, } from "./postcode-country-coherence.ts";
|
|
21
|
+
export type { PostcodeCountryScope, PostcodeCountryScopeOpts } from "./postcode-country-coherence.ts";
|
|
20
22
|
export { findRescoreCandidate, hasResolvedPlace } from "./span-rescore.ts";
|
|
21
23
|
export type { RescoreCandidate, SpanRescoreOptions } from "./span-rescore.ts";
|
|
22
24
|
export * from "@mailwoman/core/resolver";
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAE9E,YAAY,EACX,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,GACvB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAEhD,OAAO,EACN,YAAY,EACZ,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,GACtB,MAAM,mBAAmB,CAAA;AAE1B,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAClG,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAEpG,YAAY,EACX,wBAAwB,EACxB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,GACtB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAC1E,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAI7E,cAAc,0BAA0B,CAAA;AAExC,cAAc,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAE9E,YAAY,EACX,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,GACvB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAEhD,OAAO,EACN,YAAY,EACZ,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,GACtB,MAAM,mBAAmB,CAAA;AAE1B,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAClG,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAEpG,YAAY,EACX,wBAAwB,EACxB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,GACtB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACN,wBAAwB,EACxB,kBAAkB,EAClB,kCAAkC,EAClC,yBAAyB,GACzB,MAAM,iCAAiC,CAAA;AAExC,YAAY,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAA;AACrG,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAC1E,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAI7E,cAAc,0BAA0B,CAAA;AAExC,cAAc,aAAa,CAAA"}
|
package/out/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export { RemoteResolver, serializableResolveOpts } from "./remote-resolver.js";
|
|
|
14
14
|
export { createWOFResolver } from "./resolve.js";
|
|
15
15
|
export { COUNTRY_BBOX, finestResolvedCoordinate, isImplausibleResolution, outsideExpectedCountry, } from "./plausibility.js";
|
|
16
16
|
export { foldStreetSurface, isPureTypeVocabulary, pickByStreetEvidence } from "./street-evidence.js";
|
|
17
|
+
export { findPostcodeCountryScope, firstLocalityValue, POSTCODE_COUNTRY_COHERENCE_GATE_KM, stampPostcodeCountryScope, } from "./postcode-country-coherence.js";
|
|
17
18
|
export { findRescoreCandidate, hasResolvedPlace } from "./span-rescore.js";
|
|
18
19
|
// The type contract + placetype helpers live in core (pure types, keep core a leaf). Re-export so
|
|
19
20
|
// consumers get the whole surface from `@mailwoman/resolver`.
|
package/out/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAS9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAEhD,OAAO,EACN,YAAY,EACZ,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,GACtB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAUpG,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAG1E,kGAAkG;AAClG,8DAA8D;AAC9D,cAAc,0BAA0B,CAAA;AAExC,cAAc,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAS9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAEhD,OAAO,EACN,YAAY,EACZ,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,GACtB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAUpG,OAAO,EACN,wBAAwB,EACxB,kBAAkB,EAClB,kCAAkC,EAClC,yBAAyB,GACzB,MAAM,iCAAiC,CAAA;AAGxC,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAG1E,kGAAkG;AAClG,8DAA8D;AAC9D,cAAc,0BAA0B,CAAA;AAExC,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Postcode-country coherence (#42) — the joint-consistency resolve keyed on the (postcode, locality)
|
|
7
|
+
* PAIR, and the first mechanism in the tree allowed to override `defaultCountry`.
|
|
8
|
+
*
|
|
9
|
+
* The failing case: `12 Rue de Rivoli, 75001 Paris` under the en-US locale. `--locale` defaults to
|
|
10
|
+
* `en-US`, `localeToCountry` turns that into `ResolveOpts.defaultCountry = "US"`, and the backend
|
|
11
|
+
* turns THAT into a hard `spr.country = 'US'` WHERE clause. The candidate pool is all-US before
|
|
12
|
+
* ranking begins, so a coarse placer that already called this address FR at confidence
|
|
13
|
+
* 0.9999908844 has nothing to promote — a soft re-rank downstream of a hard filter is inert by
|
|
14
|
+
* construction. Population then picks Paris, Texas (pop 24,969). With the postal shards attached
|
|
15
|
+
* the answer gets WORSE, not merely wrong: the postcode resolves to the US row (ZIP 75001,
|
|
16
|
+
* Addison TX), `applyPostcodeConsistency` finds no Paris within its 50 km gate (the nearest is
|
|
17
|
+
* 143.8 km), and falls the locality coordinate back to the ZIP point. See
|
|
18
|
+
* `docs/records/evals/2026-08-03-postcode-locality-scoping.md` for the instrumented diagnosis.
|
|
19
|
+
*
|
|
20
|
+
* No pattern-only lever can fix this. `75001` is NOT unambiguously French:
|
|
21
|
+
* `candidateSystemsForPostcode("75001")` returns `["us", "de", "fr"]`, and the 2026-08-04
|
|
22
|
+
* candidate gazetteer holds the literal string in FOUR countries — FR 48.863,2.336 (Paris 1er),
|
|
23
|
+
* US 32.960,-96.838 (Addison TX), DE 48.844,9.367, PL 54.190,16.188 (×2 rows). The SHAPE is
|
|
24
|
+
* ambiguous four ways. The GEOMETRY is not: Addison and Paris are ~8,000 km apart, and only one
|
|
25
|
+
* of the four has a same-named locality next to its 75001.
|
|
26
|
+
*
|
|
27
|
+
* So this pass asks the question the shape cannot answer — _in which country are this postcode and
|
|
28
|
+
* this locality geographically consistent?_ — over exactly the primitive the resolver already uses
|
|
29
|
+
* three times (`applyAdminCoherence` #263, `applyExplicitCountryCoherence` #822,
|
|
30
|
+
* `applyRegionCountryCoherence`), just keyed on the postcode instead of a region or country token.
|
|
31
|
+
*
|
|
32
|
+
* ## Why it runs BEFORE the walk, not after
|
|
33
|
+
*
|
|
34
|
+
* Its three siblings are post-walk re-picks: the walk resolves greedily, they swap the wrong node
|
|
35
|
+
* pair for the right one. That shape cannot work here, because the thing to correct is the walk's
|
|
36
|
+
* COUNTRY SCOPE, and the scope poisons three separate things a post-walk pass cannot reach — the
|
|
37
|
+
* postcode node's own resolution (Addison, not Paris 1er), the `applyPostcodeConsistency` fallback
|
|
38
|
+
* that then drags the locality onto it, and the `country` filter on every other admin lookup. So
|
|
39
|
+
* this pass is a pre-walk SCOPE decision: it runs once, before the first lookup, and replaces
|
|
40
|
+
* `state.defaultCountry` for the whole walk. Everything downstream — including the three post-walk
|
|
41
|
+
* coherence passes and the street/rooftop tiers — then sees the corrected country.
|
|
42
|
+
*
|
|
43
|
+
* ## Why it is not a hard veto (the doctrine gate)
|
|
44
|
+
*
|
|
45
|
+
* Registries are SOFT priors here, positive evidence only. Two properties keep this one honest:
|
|
46
|
+
*
|
|
47
|
+
* 1. **The default country is tested FIRST, and a coherent default always wins.** If (postcode,
|
|
48
|
+
* locality) is consistent under `defaultCountry`, the pass returns `null` immediately, having
|
|
49
|
+
* spent at most two lookups, and the walk is byte-identical. Every correctly-scoped domestic
|
|
50
|
+
* parse exits here. It is not "US loses to FR"; it is "US had no answer".
|
|
51
|
+
* 2. **Abstention is the default outcome.** Zero coherent countries (a wrong-for-the-city
|
|
52
|
+
* postcode, or a recall gap in the gazetteer) and MORE than one coherent country (a genuine
|
|
53
|
+
* geographic tie) both return `null`. The mechanism only ever speaks when exactly one country
|
|
54
|
+
* makes the pair consistent, and only ever when the default country could not.
|
|
55
|
+
*
|
|
56
|
+
* ## Evidence
|
|
57
|
+
*
|
|
58
|
+
* Prototyped out-of-tree against the live gazetteer over the public `findPlace` surface (2026-08-03):
|
|
59
|
+
* 400 real US (ZIP, city) pairs from `postalcode-us.db` + 400 real FR (CP, commune) pairs from
|
|
60
|
+
* `postcode-locality-fr.db` — 800 pairs, **zero** border crossings, at both the 15 km and 25 km
|
|
61
|
+
* gates. The 22 US abstentions were pairs whose ZIP parent name is not an exact-matching locality
|
|
62
|
+
* in the admin gazetteer (a recall gap; abstention is the safe outcome). The confound board's
|
|
63
|
+
* verdicts were identical at 15, 25 AND 50 km, so the mechanism is not gate-tuned; the default
|
|
64
|
+
* below is the 25 km the scale run measured.
|
|
65
|
+
*
|
|
66
|
+
* Cost: 2 lookups on the byte-stable path (postcode + locality under the default country), and at
|
|
67
|
+
* most `2 × |candidateSystems|` — bounded at 8, since a numeric shape matches at most `us`/`de`/`fr`
|
|
68
|
+
* — when the default is incoherent. Nothing runs at all unless a `defaultCountry` is in force AND
|
|
69
|
+
* the tree carries both a postcode and a locality.
|
|
70
|
+
*
|
|
71
|
+
* **Default-ON** since the operator promotion of 2026-08-05 (#1477) — the resolver gauntlet, pinned
|
|
72
|
+
* both ways, returned zero newly-failing gated cases, and 56,000 pair evaluations across both
|
|
73
|
+
* backends returned zero false positives. `ResolveOpts.postcodeCountryCoherence: false` opts out,
|
|
74
|
+
* and the walk is byte-stable then. Receipts:
|
|
75
|
+
* `docs/records/evals/2026-08-05-postcode-coherence-default-on-evidence.md`.
|
|
76
|
+
*/
|
|
77
|
+
import type { AddressNode } from "@mailwoman/core/decoder";
|
|
78
|
+
import type { ResolvedPlace, ResolverBackend } from "@mailwoman/core/resolver";
|
|
79
|
+
/**
|
|
80
|
+
* Default gate radius (km) for the postcode↔locality consistency test. 25 km is what the 800-pair scale run measured;
|
|
81
|
+
* the confound board returned identical verdicts at 15, 25 and 50, so this is a floor choice, not a tuned one.
|
|
82
|
+
*/
|
|
83
|
+
export declare const POSTCODE_COUNTRY_COHERENCE_GATE_KM = 25;
|
|
84
|
+
/**
|
|
85
|
+
* A country in which the address's (postcode, locality) pair is geographically consistent.
|
|
86
|
+
*/
|
|
87
|
+
export interface PostcodeCountryScope {
|
|
88
|
+
/**
|
|
89
|
+
* ISO-3166 alpha-2, upper-case.
|
|
90
|
+
*/
|
|
91
|
+
country: string;
|
|
92
|
+
/**
|
|
93
|
+
* The postcode string the verdict was reached on (as it appears in the tree).
|
|
94
|
+
*/
|
|
95
|
+
postcode: string;
|
|
96
|
+
/**
|
|
97
|
+
* The locality string the verdict was reached on.
|
|
98
|
+
*/
|
|
99
|
+
locality: string;
|
|
100
|
+
/**
|
|
101
|
+
* Distance between the resolved postcode point and the nearest same-named locality, in km. Always `<= gateKm`.
|
|
102
|
+
*/
|
|
103
|
+
distanceKm: number;
|
|
104
|
+
/**
|
|
105
|
+
* The postcode place that anchored the verdict.
|
|
106
|
+
*/
|
|
107
|
+
postcodePlace: ResolvedPlace;
|
|
108
|
+
/**
|
|
109
|
+
* The locality place that anchored the verdict.
|
|
110
|
+
*/
|
|
111
|
+
localityPlace: ResolvedPlace;
|
|
112
|
+
}
|
|
113
|
+
export interface PostcodeCountryScopeOpts {
|
|
114
|
+
/**
|
|
115
|
+
* The postcode string from the tree (the resolver already pre-scans for it — pass `state.postcode` so this pass and
|
|
116
|
+
* the walk can never disagree about WHICH postcode is the address's).
|
|
117
|
+
*/
|
|
118
|
+
postcode: string;
|
|
119
|
+
/**
|
|
120
|
+
* The country the caller's `defaultCountry` would hard-filter to. Required: this pass exists to correct a wrong one,
|
|
121
|
+
* so with no default there is nothing to correct and the caller should not be calling.
|
|
122
|
+
*/
|
|
123
|
+
defaultCountry: string;
|
|
124
|
+
/**
|
|
125
|
+
* Consistency gate radius in km. Defaults to {@link POSTCODE_COUNTRY_COHERENCE_GATE_KM}.
|
|
126
|
+
*/
|
|
127
|
+
gateKm?: number;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The address's locality string: the first `locality` node anywhere in the tree, else the first `dependent_locality`.
|
|
131
|
+
* Two passes so a real locality always beats a dependent one regardless of tree order.
|
|
132
|
+
*/
|
|
133
|
+
export declare function firstLocalityValue(roots: readonly AddressNode[]): string | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* The country in which this address's postcode and locality are geographically consistent — or `null` to abstain.
|
|
136
|
+
*
|
|
137
|
+
* Order matters and is the whole safety argument. The caller's `defaultCountry` is tested FIRST; a coherent default
|
|
138
|
+
* short-circuits with `null` (nothing to correct, ≤2 lookups spent, the walk unchanged). Only when the default cannot
|
|
139
|
+
* make the pair consistent are the codex shape's other candidate systems tried, and only a UNIQUE coherent alternative
|
|
140
|
+
* produces a verdict — zero (no evidence) and two-or-more (a genuine tie) both abstain.
|
|
141
|
+
*
|
|
142
|
+
* The candidate set is `candidateSystemsForPostcode` — a model-free SHAPE test over each codex slice's own postcode
|
|
143
|
+
* pattern, no safelist and no prior. Its `SystemCode` values are ISO-3166 alpha-2 in lower case, so the upper-casing
|
|
144
|
+
* below is the whole conversion. Note the corollary: a country with no codex slice can never be proposed (the gazetteer
|
|
145
|
+
* holds `75001` in PL, and this pass will never return PL), which bounds the mechanism to the systems whose postcode
|
|
146
|
+
* shapes are actually specified.
|
|
147
|
+
*/
|
|
148
|
+
export declare function findPostcodeCountryScope(roots: readonly AddressNode[], backend: ResolverBackend, opts: PostcodeCountryScopeOpts): Promise<PostcodeCountryScope | null>;
|
|
149
|
+
/**
|
|
150
|
+
* Stamp the adopted scope onto the tree's postcode and locality nodes, so a consumer can see that the walk's country
|
|
151
|
+
* was not the one the caller asked for — and which evidence bought the change. Additive: identity and coordinates are
|
|
152
|
+
* untouched, this only writes `metadata`.
|
|
153
|
+
*/
|
|
154
|
+
export declare function stampPostcodeCountryScope(roots: readonly AddressNode[], scope: PostcodeCountryScope): void;
|
|
155
|
+
//# sourceMappingURL=postcode-country-coherence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postcode-country-coherence.d.ts","sourceRoot":"","sources":["../postcode-country-coherence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAG9E;;;GAGG;AACH,eAAO,MAAM,kCAAkC,KAAK,CAAA;AAEpD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,aAAa,EAAE,aAAa,CAAA;IAC5B;;OAEG;IACH,aAAa,EAAE,aAAa,CAAA;CAC5B;AAED,MAAM,WAAW,wBAAwB;IACxC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CACf;AASD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,MAAM,GAAG,SAAS,CAcpF;AAqDD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,wBAAwB,CAC7C,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,wBAAwB,GAC5B,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAuCtC;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,EAAE,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAgB1G"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Postcode-country coherence (#42) — the joint-consistency resolve keyed on the (postcode, locality)
|
|
7
|
+
* PAIR, and the first mechanism in the tree allowed to override `defaultCountry`.
|
|
8
|
+
*
|
|
9
|
+
* The failing case: `12 Rue de Rivoli, 75001 Paris` under the en-US locale. `--locale` defaults to
|
|
10
|
+
* `en-US`, `localeToCountry` turns that into `ResolveOpts.defaultCountry = "US"`, and the backend
|
|
11
|
+
* turns THAT into a hard `spr.country = 'US'` WHERE clause. The candidate pool is all-US before
|
|
12
|
+
* ranking begins, so a coarse placer that already called this address FR at confidence
|
|
13
|
+
* 0.9999908844 has nothing to promote — a soft re-rank downstream of a hard filter is inert by
|
|
14
|
+
* construction. Population then picks Paris, Texas (pop 24,969). With the postal shards attached
|
|
15
|
+
* the answer gets WORSE, not merely wrong: the postcode resolves to the US row (ZIP 75001,
|
|
16
|
+
* Addison TX), `applyPostcodeConsistency` finds no Paris within its 50 km gate (the nearest is
|
|
17
|
+
* 143.8 km), and falls the locality coordinate back to the ZIP point. See
|
|
18
|
+
* `docs/records/evals/2026-08-03-postcode-locality-scoping.md` for the instrumented diagnosis.
|
|
19
|
+
*
|
|
20
|
+
* No pattern-only lever can fix this. `75001` is NOT unambiguously French:
|
|
21
|
+
* `candidateSystemsForPostcode("75001")` returns `["us", "de", "fr"]`, and the 2026-08-04
|
|
22
|
+
* candidate gazetteer holds the literal string in FOUR countries — FR 48.863,2.336 (Paris 1er),
|
|
23
|
+
* US 32.960,-96.838 (Addison TX), DE 48.844,9.367, PL 54.190,16.188 (×2 rows). The SHAPE is
|
|
24
|
+
* ambiguous four ways. The GEOMETRY is not: Addison and Paris are ~8,000 km apart, and only one
|
|
25
|
+
* of the four has a same-named locality next to its 75001.
|
|
26
|
+
*
|
|
27
|
+
* So this pass asks the question the shape cannot answer — _in which country are this postcode and
|
|
28
|
+
* this locality geographically consistent?_ — over exactly the primitive the resolver already uses
|
|
29
|
+
* three times (`applyAdminCoherence` #263, `applyExplicitCountryCoherence` #822,
|
|
30
|
+
* `applyRegionCountryCoherence`), just keyed on the postcode instead of a region or country token.
|
|
31
|
+
*
|
|
32
|
+
* ## Why it runs BEFORE the walk, not after
|
|
33
|
+
*
|
|
34
|
+
* Its three siblings are post-walk re-picks: the walk resolves greedily, they swap the wrong node
|
|
35
|
+
* pair for the right one. That shape cannot work here, because the thing to correct is the walk's
|
|
36
|
+
* COUNTRY SCOPE, and the scope poisons three separate things a post-walk pass cannot reach — the
|
|
37
|
+
* postcode node's own resolution (Addison, not Paris 1er), the `applyPostcodeConsistency` fallback
|
|
38
|
+
* that then drags the locality onto it, and the `country` filter on every other admin lookup. So
|
|
39
|
+
* this pass is a pre-walk SCOPE decision: it runs once, before the first lookup, and replaces
|
|
40
|
+
* `state.defaultCountry` for the whole walk. Everything downstream — including the three post-walk
|
|
41
|
+
* coherence passes and the street/rooftop tiers — then sees the corrected country.
|
|
42
|
+
*
|
|
43
|
+
* ## Why it is not a hard veto (the doctrine gate)
|
|
44
|
+
*
|
|
45
|
+
* Registries are SOFT priors here, positive evidence only. Two properties keep this one honest:
|
|
46
|
+
*
|
|
47
|
+
* 1. **The default country is tested FIRST, and a coherent default always wins.** If (postcode,
|
|
48
|
+
* locality) is consistent under `defaultCountry`, the pass returns `null` immediately, having
|
|
49
|
+
* spent at most two lookups, and the walk is byte-identical. Every correctly-scoped domestic
|
|
50
|
+
* parse exits here. It is not "US loses to FR"; it is "US had no answer".
|
|
51
|
+
* 2. **Abstention is the default outcome.** Zero coherent countries (a wrong-for-the-city
|
|
52
|
+
* postcode, or a recall gap in the gazetteer) and MORE than one coherent country (a genuine
|
|
53
|
+
* geographic tie) both return `null`. The mechanism only ever speaks when exactly one country
|
|
54
|
+
* makes the pair consistent, and only ever when the default country could not.
|
|
55
|
+
*
|
|
56
|
+
* ## Evidence
|
|
57
|
+
*
|
|
58
|
+
* Prototyped out-of-tree against the live gazetteer over the public `findPlace` surface (2026-08-03):
|
|
59
|
+
* 400 real US (ZIP, city) pairs from `postalcode-us.db` + 400 real FR (CP, commune) pairs from
|
|
60
|
+
* `postcode-locality-fr.db` — 800 pairs, **zero** border crossings, at both the 15 km and 25 km
|
|
61
|
+
* gates. The 22 US abstentions were pairs whose ZIP parent name is not an exact-matching locality
|
|
62
|
+
* in the admin gazetteer (a recall gap; abstention is the safe outcome). The confound board's
|
|
63
|
+
* verdicts were identical at 15, 25 AND 50 km, so the mechanism is not gate-tuned; the default
|
|
64
|
+
* below is the 25 km the scale run measured.
|
|
65
|
+
*
|
|
66
|
+
* Cost: 2 lookups on the byte-stable path (postcode + locality under the default country), and at
|
|
67
|
+
* most `2 × |candidateSystems|` — bounded at 8, since a numeric shape matches at most `us`/`de`/`fr`
|
|
68
|
+
* — when the default is incoherent. Nothing runs at all unless a `defaultCountry` is in force AND
|
|
69
|
+
* the tree carries both a postcode and a locality.
|
|
70
|
+
*
|
|
71
|
+
* **Default-ON** since the operator promotion of 2026-08-05 (#1477) — the resolver gauntlet, pinned
|
|
72
|
+
* both ways, returned zero newly-failing gated cases, and 56,000 pair evaluations across both
|
|
73
|
+
* backends returned zero false positives. `ResolveOpts.postcodeCountryCoherence: false` opts out,
|
|
74
|
+
* and the walk is byte-stable then. Receipts:
|
|
75
|
+
* `docs/records/evals/2026-08-05-postcode-coherence-default-on-evidence.md`.
|
|
76
|
+
*/
|
|
77
|
+
// `postcode-systems` has no dedicated export subpath; the barrel is where every other consumer
|
|
78
|
+
// (`neural/postcode-anchor.ts`) reaches it from.
|
|
79
|
+
import { candidateSystemsForPostcode } from "@mailwoman/codex";
|
|
80
|
+
import { haversineKm } from "@mailwoman/spatial";
|
|
81
|
+
/**
|
|
82
|
+
* Default gate radius (km) for the postcode↔locality consistency test. 25 km is what the 800-pair scale run measured;
|
|
83
|
+
* the confound board returned identical verdicts at 15, 25 and 50, so this is a floor choice, not a tuned one.
|
|
84
|
+
*/
|
|
85
|
+
export const POSTCODE_COUNTRY_COHERENCE_GATE_KM = 25;
|
|
86
|
+
/**
|
|
87
|
+
* A usable coordinate — the gazetteer stores an unlocated row as 0,0, which haversine would happily measure against.
|
|
88
|
+
*/
|
|
89
|
+
function hasCoord(p) {
|
|
90
|
+
return p.lat !== 0 || p.lon !== 0;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The address's locality string: the first `locality` node anywhere in the tree, else the first `dependent_locality`.
|
|
94
|
+
* Two passes so a real locality always beats a dependent one regardless of tree order.
|
|
95
|
+
*/
|
|
96
|
+
export function firstLocalityValue(roots) {
|
|
97
|
+
for (const tag of ["locality", "dependent_locality"]) {
|
|
98
|
+
const stack = [...roots];
|
|
99
|
+
while (stack.length) {
|
|
100
|
+
const n = stack.pop();
|
|
101
|
+
if (n.tag === tag && n.value.trim().length)
|
|
102
|
+
return n.value.trim();
|
|
103
|
+
stack.push(...n.children);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Is the (postcode, locality) pair geographically consistent in `country`? Returns the winning pair and its distance,
|
|
110
|
+
* or `null` when the postcode does not resolve there, no same-named locality exists there, or the nearest one is
|
|
111
|
+
* outside the gate. Costs one postcode lookup plus (only if that hit) one locality lookup.
|
|
112
|
+
*/
|
|
113
|
+
async function coherenceIn(country, postcode, locality, backend, gateKm) {
|
|
114
|
+
let postcodeHits;
|
|
115
|
+
try {
|
|
116
|
+
postcodeHits = await backend.findPlace({ text: postcode, placetype: "postalcode", country, limit: 3 });
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
return null; // a backend hiccup degrades to "no evidence here", never to a crashed resolve
|
|
120
|
+
}
|
|
121
|
+
const postcodePlace = postcodeHits.find(hasCoord);
|
|
122
|
+
if (!postcodePlace)
|
|
123
|
+
return null;
|
|
124
|
+
let localityHits;
|
|
125
|
+
try {
|
|
126
|
+
localityHits = await backend.findPlace({ text: locality, placetype: "locality", country, limit: 5 });
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
// EXACT matches only. A fuzzy same-country hit ("Paris" → "Parish") is not evidence that the postcode
|
|
132
|
+
// belongs to this country; it is evidence that the FTS index is generous. Backends that do not stamp
|
|
133
|
+
// `exactMatch` therefore contribute nothing here rather than contributing noise.
|
|
134
|
+
let best = null;
|
|
135
|
+
for (const candidate of localityHits) {
|
|
136
|
+
if (!candidate.exactMatch || !hasCoord(candidate))
|
|
137
|
+
continue;
|
|
138
|
+
const distanceKm = haversineKm(postcodePlace.lat, postcodePlace.lon, candidate.lat, candidate.lon);
|
|
139
|
+
if (distanceKm > gateKm)
|
|
140
|
+
continue;
|
|
141
|
+
if (!best || distanceKm < best.distanceKm) {
|
|
142
|
+
best = { localityPlace: candidate, distanceKm };
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return best ? { postcodePlace, ...best } : null;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The country in which this address's postcode and locality are geographically consistent — or `null` to abstain.
|
|
149
|
+
*
|
|
150
|
+
* Order matters and is the whole safety argument. The caller's `defaultCountry` is tested FIRST; a coherent default
|
|
151
|
+
* short-circuits with `null` (nothing to correct, ≤2 lookups spent, the walk unchanged). Only when the default cannot
|
|
152
|
+
* make the pair consistent are the codex shape's other candidate systems tried, and only a UNIQUE coherent alternative
|
|
153
|
+
* produces a verdict — zero (no evidence) and two-or-more (a genuine tie) both abstain.
|
|
154
|
+
*
|
|
155
|
+
* The candidate set is `candidateSystemsForPostcode` — a model-free SHAPE test over each codex slice's own postcode
|
|
156
|
+
* pattern, no safelist and no prior. Its `SystemCode` values are ISO-3166 alpha-2 in lower case, so the upper-casing
|
|
157
|
+
* below is the whole conversion. Note the corollary: a country with no codex slice can never be proposed (the gazetteer
|
|
158
|
+
* holds `75001` in PL, and this pass will never return PL), which bounds the mechanism to the systems whose postcode
|
|
159
|
+
* shapes are actually specified.
|
|
160
|
+
*/
|
|
161
|
+
export async function findPostcodeCountryScope(roots, backend, opts) {
|
|
162
|
+
const postcode = opts.postcode.trim();
|
|
163
|
+
const defaultCountry = opts.defaultCountry.trim().toUpperCase();
|
|
164
|
+
if (!postcode || !defaultCountry)
|
|
165
|
+
return null;
|
|
166
|
+
const locality = firstLocalityValue(roots);
|
|
167
|
+
// Both halves of the pair are required. A postcode with no locality has nothing to be coherent WITH, which is what
|
|
168
|
+
// keeps this pass inert on "Springfield, IL 62701" (the parser tags Springfield as a `street` — a separate defect)
|
|
169
|
+
// and on every bare-postcode query.
|
|
170
|
+
if (!locality)
|
|
171
|
+
return null;
|
|
172
|
+
const gateKm = opts.gateKm ?? POSTCODE_COUNTRY_COHERENCE_GATE_KM;
|
|
173
|
+
// 1. Is the caller's own default country coherent? If so we are done — positive evidence for the default,
|
|
174
|
+
// no override, and the common domestic path costs two lookups and changes nothing.
|
|
175
|
+
if (await coherenceIn(defaultCountry, postcode, locality, backend, gateKm))
|
|
176
|
+
return null;
|
|
177
|
+
// 2. The default could not place this pair. Which other country the SHAPE allows can?
|
|
178
|
+
const candidates = candidateSystemsForPostcode(postcode)
|
|
179
|
+
.map((system) => system.toUpperCase())
|
|
180
|
+
.filter((country) => country !== defaultCountry);
|
|
181
|
+
if (!candidates.length)
|
|
182
|
+
return null;
|
|
183
|
+
const coherent = [];
|
|
184
|
+
for (const country of candidates) {
|
|
185
|
+
const hit = await coherenceIn(country, postcode, locality, backend, gateKm);
|
|
186
|
+
if (hit) {
|
|
187
|
+
coherent.push({ country, postcode, locality, ...hit });
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
// 3. Exactly one country makes the pair consistent, or we abstain. Two coherent countries would mean the geometry
|
|
191
|
+
// genuinely does not decide, and guessing between them is precisely what this mechanism exists not to do.
|
|
192
|
+
return coherent.length === 1 ? coherent[0] : null;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Stamp the adopted scope onto the tree's postcode and locality nodes, so a consumer can see that the walk's country
|
|
196
|
+
* was not the one the caller asked for — and which evidence bought the change. Additive: identity and coordinates are
|
|
197
|
+
* untouched, this only writes `metadata`.
|
|
198
|
+
*/
|
|
199
|
+
export function stampPostcodeCountryScope(roots, scope) {
|
|
200
|
+
const stack = [...roots];
|
|
201
|
+
while (stack.length) {
|
|
202
|
+
const n = stack.pop();
|
|
203
|
+
stack.push(...n.children);
|
|
204
|
+
if (n.tag !== "postcode" && n.tag !== "locality" && n.tag !== "dependent_locality")
|
|
205
|
+
continue;
|
|
206
|
+
n.metadata = {
|
|
207
|
+
...n.metadata,
|
|
208
|
+
postcode_country_scope: scope.country,
|
|
209
|
+
postcode_country_scope_km: scope.distanceKm,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=postcode-country-coherence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postcode-country-coherence.js","sourceRoot":"","sources":["../postcode-country-coherence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EG;AAEH,+FAA+F;AAC/F,iDAAiD;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,kB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AC,CAAC,CAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AACnD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAA6B,EAAE,KAA2B;IACnG,MAAM,KAAK,GAAkB,CAAC,GAAG,KAAK,CAAC,CAAA;IAEvC,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;QACrB,MAAM,CAAC,GAAG,KAAK,CAAC,GAAG,EAAG,CAAA;QAEtB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAA;QAEzB,IAAI,CAAC,CAAC,GAAG,KAAK,UAAU,IAAI,CAAC,CAAC,GAAG,KAAK,UAAU,IAAI,CAAC,CAAC,GAAG,KAAK,oBAAoB;YAAE,SAAQ;QAE5F,CAAC,CAAC,QAAQ,GAAG;YACZ,GAAG,CAAC,CAAC,QAAQ;YACb,sBAAsB,EAAE,KAAK,CAAC,OAAO;YACrC,yBAAyB,EAAE,KAAK,CAAC,UAAU;SAC3C,CAAA;IACF,CAAC;AACF,CAAC"}
|
package/out/resolve.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../resolve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,EASN,KAAK,QAAQ,EACb,KAAK,eAAe,EAEpB,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../resolve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,EASN,KAAK,QAAQ,EACb,KAAK,eAAe,EAEpB,MAAM,0BAA0B,CAAA;AAYjC;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,eAAe,GAAG,QAAQ,CAEpE"}
|
package/out/resolve.js
CHANGED
|
@@ -16,6 +16,7 @@ import { isStreetDirectionalToken } from "@mailwoman/codex/us";
|
|
|
16
16
|
import { DEFAULT_PLACETYPE_MAP, isPlacetypeFallback, } from "@mailwoman/core/resolver";
|
|
17
17
|
import { haversineKm } from "@mailwoman/spatial";
|
|
18
18
|
import { foldName } from "./fold-name.js";
|
|
19
|
+
import { findPostcodeCountryScope, stampPostcodeCountryScope, } from "./postcode-country-coherence.js";
|
|
19
20
|
import { findRescoreCandidate, hasResolvedPlace, postcodeCodeSubset } from "./span-rescore.js";
|
|
20
21
|
import { applyAddressPoint, applyInterpolation, applyStreetCentroid } from "./street-tier.js";
|
|
21
22
|
/**
|
|
@@ -164,8 +165,9 @@ function isResolvedWithCoord(n) {
|
|
|
164
165
|
* (right area, the safe answer) and flag `postcode_city_mismatch`.
|
|
165
166
|
*
|
|
166
167
|
* Only fires where the postcode resolved to a point, so it composes with postcode coverage (#193) — add a country's
|
|
167
|
-
* postcodes and this immediately disambiguates its same-named towns. Default-
|
|
168
|
-
* byte-stable
|
|
168
|
+
* postcodes and this immediately disambiguates its same-named towns. **Default-ON** since the #370 operator promotion
|
|
169
|
+
* (2026-07-04, commit `0010bb8c`) — `opts.postcodeConsistency: false` opts out, and the pass is byte-stable on every
|
|
170
|
+
* tree with no resolved postcode point (the `!anchor` early return below).
|
|
169
171
|
*/
|
|
170
172
|
function applyPostcodeConsistency(roots, gateKm) {
|
|
171
173
|
// The resolved postcode anchor (first one with a real coordinate).
|
|
@@ -565,10 +567,37 @@ class WOFResolver {
|
|
|
565
567
|
resolvedRegion: null,
|
|
566
568
|
resolvedRegionNode: null,
|
|
567
569
|
};
|
|
570
|
+
// Postcode-country coherence (#42): the ONE pre-walk pass, and the only mechanism allowed to override
|
|
571
|
+
// `defaultCountry`. Its three sibling coherence passes re-pick nodes AFTER the walk; that shape cannot
|
|
572
|
+
// work here, because what needs correcting is the walk's country SCOPE — which poisons the postcode
|
|
573
|
+
// node's own resolution, the postcode-consistency fallback that then drags the locality onto it, and
|
|
574
|
+
// the hard `country` filter on every admin lookup. So the verdict is taken once, up front, and the
|
|
575
|
+
// walk runs under the corrected country. Default-ON (operator-promoted 2026-08-05; `false` opts out) —
|
|
576
|
+
// needs a default country to correct and both a postcode and a locality to be coherent about; abstains
|
|
577
|
+
// unless EXACTLY one country (never the already-coherent default) makes the pair consistent. See
|
|
578
|
+
// postcode-country-coherence.ts.
|
|
579
|
+
let postcodeScope = null;
|
|
580
|
+
if (opts.postcodeCountryCoherence !== false && state.defaultCountry && state.postcode) {
|
|
581
|
+
postcodeScope = await findPostcodeCountryScope(tree.roots, this.#backend, {
|
|
582
|
+
postcode: state.postcode,
|
|
583
|
+
defaultCountry: state.defaultCountry,
|
|
584
|
+
...(opts.postcodeCountryCoherenceGateKm !== undefined ? { gateKm: opts.postcodeCountryCoherenceGateKm } : {}),
|
|
585
|
+
});
|
|
586
|
+
if (postcodeScope) {
|
|
587
|
+
// The override. `hardCountry` is not cleared because it is never consulted while a
|
|
588
|
+
// `defaultCountry` is set (`#lookupAndPick`'s precedence chain reaches it only as the last
|
|
589
|
+
// fallback), so replacing the default is sufficient to re-scope the entire walk.
|
|
590
|
+
state.defaultCountry = postcodeScope.country;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
568
593
|
const newRoots = [];
|
|
569
594
|
for (const root of tree.roots) {
|
|
570
595
|
newRoots.push(await this.#walk(root, /* parentResolved */ null, state));
|
|
571
596
|
}
|
|
597
|
+
// Attribution for the override, stamped on the two nodes that bought it. Additive metadata only.
|
|
598
|
+
if (postcodeScope) {
|
|
599
|
+
stampPostcodeCountryScope(newRoots, postcodeScope);
|
|
600
|
+
}
|
|
572
601
|
// Dual-role hierarchy completion (#405/#415). Only when enabled, a region resolved, and the parser
|
|
573
602
|
// emitted NO locality — record the dropped locality as a SECONDARY ROLE (an interpretation) on the
|
|
574
603
|
// resolved region node, from the backend's precomputed coincident-roles relation (#403). One node,
|
package/out/resolve.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../resolve.ts"],"names":[],"mappings":"AAAA;;;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AC;IAED,IAAI,YAAY,CAAC,MAAM,EAAE,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IACjC,CAAC;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/resolver",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"description": "The address resolver: walk an AddressTree, decorate nodes with gazetteer-supplied coordinates + attribution. Backend-agnostic (any ResolverBackend), with the span-rescore + postcode-consistency levers. Lifted out of @mailwoman/core so it can depend on @mailwoman/spatial (haversine) + @mailwoman/codex (USPS directionals) instead of reinventing them; the type contract stays in core so the pipeline composes it without a cycle.",
|
|
5
5
|
"license": "AGPL-3.0-only OR LicenseRef-Commercial",
|
|
6
6
|
"repository": {
|
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
"types": "./out/resolve.d.ts",
|
|
34
34
|
"default": "./out/resolve.js"
|
|
35
35
|
},
|
|
36
|
+
"./postcode-country-coherence": {
|
|
37
|
+
"types": "./out/postcode-country-coherence.d.ts",
|
|
38
|
+
"default": "./out/postcode-country-coherence.js"
|
|
39
|
+
},
|
|
36
40
|
"./span-rescore": {
|
|
37
41
|
"types": "./out/span-rescore.d.ts",
|
|
38
42
|
"default": "./out/span-rescore.js"
|
|
@@ -50,6 +54,10 @@
|
|
|
50
54
|
"types": "./out/resolve.d.ts",
|
|
51
55
|
"default": "./out/resolve.js"
|
|
52
56
|
},
|
|
57
|
+
"./postcode-country-coherence": {
|
|
58
|
+
"types": "./out/postcode-country-coherence.d.ts",
|
|
59
|
+
"default": "./out/postcode-country-coherence.js"
|
|
60
|
+
},
|
|
53
61
|
"./span-rescore": {
|
|
54
62
|
"types": "./out/span-rescore.d.ts",
|
|
55
63
|
"default": "./out/span-rescore.js"
|
|
@@ -57,8 +65,8 @@
|
|
|
57
65
|
}
|
|
58
66
|
},
|
|
59
67
|
"dependencies": {
|
|
60
|
-
"@mailwoman/codex": "
|
|
61
|
-
"@mailwoman/core": "
|
|
62
|
-
"@mailwoman/spatial": "
|
|
68
|
+
"@mailwoman/codex": "9.0.0",
|
|
69
|
+
"@mailwoman/core": "9.0.0",
|
|
70
|
+
"@mailwoman/spatial": "9.0.0"
|
|
63
71
|
}
|
|
64
72
|
}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Postcode-country coherence (#42) — the joint-consistency resolve keyed on the (postcode, locality)
|
|
7
|
+
* PAIR, and the first mechanism in the tree allowed to override `defaultCountry`.
|
|
8
|
+
*
|
|
9
|
+
* The failing case: `12 Rue de Rivoli, 75001 Paris` under the en-US locale. `--locale` defaults to
|
|
10
|
+
* `en-US`, `localeToCountry` turns that into `ResolveOpts.defaultCountry = "US"`, and the backend
|
|
11
|
+
* turns THAT into a hard `spr.country = 'US'` WHERE clause. The candidate pool is all-US before
|
|
12
|
+
* ranking begins, so a coarse placer that already called this address FR at confidence
|
|
13
|
+
* 0.9999908844 has nothing to promote — a soft re-rank downstream of a hard filter is inert by
|
|
14
|
+
* construction. Population then picks Paris, Texas (pop 24,969). With the postal shards attached
|
|
15
|
+
* the answer gets WORSE, not merely wrong: the postcode resolves to the US row (ZIP 75001,
|
|
16
|
+
* Addison TX), `applyPostcodeConsistency` finds no Paris within its 50 km gate (the nearest is
|
|
17
|
+
* 143.8 km), and falls the locality coordinate back to the ZIP point. See
|
|
18
|
+
* `docs/records/evals/2026-08-03-postcode-locality-scoping.md` for the instrumented diagnosis.
|
|
19
|
+
*
|
|
20
|
+
* No pattern-only lever can fix this. `75001` is NOT unambiguously French:
|
|
21
|
+
* `candidateSystemsForPostcode("75001")` returns `["us", "de", "fr"]`, and the 2026-08-04
|
|
22
|
+
* candidate gazetteer holds the literal string in FOUR countries — FR 48.863,2.336 (Paris 1er),
|
|
23
|
+
* US 32.960,-96.838 (Addison TX), DE 48.844,9.367, PL 54.190,16.188 (×2 rows). The SHAPE is
|
|
24
|
+
* ambiguous four ways. The GEOMETRY is not: Addison and Paris are ~8,000 km apart, and only one
|
|
25
|
+
* of the four has a same-named locality next to its 75001.
|
|
26
|
+
*
|
|
27
|
+
* So this pass asks the question the shape cannot answer — _in which country are this postcode and
|
|
28
|
+
* this locality geographically consistent?_ — over exactly the primitive the resolver already uses
|
|
29
|
+
* three times (`applyAdminCoherence` #263, `applyExplicitCountryCoherence` #822,
|
|
30
|
+
* `applyRegionCountryCoherence`), just keyed on the postcode instead of a region or country token.
|
|
31
|
+
*
|
|
32
|
+
* ## Why it runs BEFORE the walk, not after
|
|
33
|
+
*
|
|
34
|
+
* Its three siblings are post-walk re-picks: the walk resolves greedily, they swap the wrong node
|
|
35
|
+
* pair for the right one. That shape cannot work here, because the thing to correct is the walk's
|
|
36
|
+
* COUNTRY SCOPE, and the scope poisons three separate things a post-walk pass cannot reach — the
|
|
37
|
+
* postcode node's own resolution (Addison, not Paris 1er), the `applyPostcodeConsistency` fallback
|
|
38
|
+
* that then drags the locality onto it, and the `country` filter on every other admin lookup. So
|
|
39
|
+
* this pass is a pre-walk SCOPE decision: it runs once, before the first lookup, and replaces
|
|
40
|
+
* `state.defaultCountry` for the whole walk. Everything downstream — including the three post-walk
|
|
41
|
+
* coherence passes and the street/rooftop tiers — then sees the corrected country.
|
|
42
|
+
*
|
|
43
|
+
* ## Why it is not a hard veto (the doctrine gate)
|
|
44
|
+
*
|
|
45
|
+
* Registries are SOFT priors here, positive evidence only. Two properties keep this one honest:
|
|
46
|
+
*
|
|
47
|
+
* 1. **The default country is tested FIRST, and a coherent default always wins.** If (postcode,
|
|
48
|
+
* locality) is consistent under `defaultCountry`, the pass returns `null` immediately, having
|
|
49
|
+
* spent at most two lookups, and the walk is byte-identical. Every correctly-scoped domestic
|
|
50
|
+
* parse exits here. It is not "US loses to FR"; it is "US had no answer".
|
|
51
|
+
* 2. **Abstention is the default outcome.** Zero coherent countries (a wrong-for-the-city
|
|
52
|
+
* postcode, or a recall gap in the gazetteer) and MORE than one coherent country (a genuine
|
|
53
|
+
* geographic tie) both return `null`. The mechanism only ever speaks when exactly one country
|
|
54
|
+
* makes the pair consistent, and only ever when the default country could not.
|
|
55
|
+
*
|
|
56
|
+
* ## Evidence
|
|
57
|
+
*
|
|
58
|
+
* Prototyped out-of-tree against the live gazetteer over the public `findPlace` surface (2026-08-03):
|
|
59
|
+
* 400 real US (ZIP, city) pairs from `postalcode-us.db` + 400 real FR (CP, commune) pairs from
|
|
60
|
+
* `postcode-locality-fr.db` — 800 pairs, **zero** border crossings, at both the 15 km and 25 km
|
|
61
|
+
* gates. The 22 US abstentions were pairs whose ZIP parent name is not an exact-matching locality
|
|
62
|
+
* in the admin gazetteer (a recall gap; abstention is the safe outcome). The confound board's
|
|
63
|
+
* verdicts were identical at 15, 25 AND 50 km, so the mechanism is not gate-tuned; the default
|
|
64
|
+
* below is the 25 km the scale run measured.
|
|
65
|
+
*
|
|
66
|
+
* Cost: 2 lookups on the byte-stable path (postcode + locality under the default country), and at
|
|
67
|
+
* most `2 × |candidateSystems|` — bounded at 8, since a numeric shape matches at most `us`/`de`/`fr`
|
|
68
|
+
* — when the default is incoherent. Nothing runs at all unless a `defaultCountry` is in force AND
|
|
69
|
+
* the tree carries both a postcode and a locality.
|
|
70
|
+
*
|
|
71
|
+
* **Default-ON** since the operator promotion of 2026-08-05 (#1477) — the resolver gauntlet, pinned
|
|
72
|
+
* both ways, returned zero newly-failing gated cases, and 56,000 pair evaluations across both
|
|
73
|
+
* backends returned zero false positives. `ResolveOpts.postcodeCountryCoherence: false` opts out,
|
|
74
|
+
* and the walk is byte-stable then. Receipts:
|
|
75
|
+
* `docs/records/evals/2026-08-05-postcode-coherence-default-on-evidence.md`.
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
// `postcode-systems` has no dedicated export subpath; the barrel is where every other consumer
|
|
79
|
+
// (`neural/postcode-anchor.ts`) reaches it from.
|
|
80
|
+
import { candidateSystemsForPostcode } from "@mailwoman/codex"
|
|
81
|
+
import type { AddressNode } from "@mailwoman/core/decoder"
|
|
82
|
+
import type { ResolvedPlace, ResolverBackend } from "@mailwoman/core/resolver"
|
|
83
|
+
import { haversineKm } from "@mailwoman/spatial"
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Default gate radius (km) for the postcode↔locality consistency test. 25 km is what the 800-pair scale run measured;
|
|
87
|
+
* the confound board returned identical verdicts at 15, 25 and 50, so this is a floor choice, not a tuned one.
|
|
88
|
+
*/
|
|
89
|
+
export const POSTCODE_COUNTRY_COHERENCE_GATE_KM = 25
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* A country in which the address's (postcode, locality) pair is geographically consistent.
|
|
93
|
+
*/
|
|
94
|
+
export interface PostcodeCountryScope {
|
|
95
|
+
/**
|
|
96
|
+
* ISO-3166 alpha-2, upper-case.
|
|
97
|
+
*/
|
|
98
|
+
country: string
|
|
99
|
+
/**
|
|
100
|
+
* The postcode string the verdict was reached on (as it appears in the tree).
|
|
101
|
+
*/
|
|
102
|
+
postcode: string
|
|
103
|
+
/**
|
|
104
|
+
* The locality string the verdict was reached on.
|
|
105
|
+
*/
|
|
106
|
+
locality: string
|
|
107
|
+
/**
|
|
108
|
+
* Distance between the resolved postcode point and the nearest same-named locality, in km. Always `<= gateKm`.
|
|
109
|
+
*/
|
|
110
|
+
distanceKm: number
|
|
111
|
+
/**
|
|
112
|
+
* The postcode place that anchored the verdict.
|
|
113
|
+
*/
|
|
114
|
+
postcodePlace: ResolvedPlace
|
|
115
|
+
/**
|
|
116
|
+
* The locality place that anchored the verdict.
|
|
117
|
+
*/
|
|
118
|
+
localityPlace: ResolvedPlace
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface PostcodeCountryScopeOpts {
|
|
122
|
+
/**
|
|
123
|
+
* The postcode string from the tree (the resolver already pre-scans for it — pass `state.postcode` so this pass and
|
|
124
|
+
* the walk can never disagree about WHICH postcode is the address's).
|
|
125
|
+
*/
|
|
126
|
+
postcode: string
|
|
127
|
+
/**
|
|
128
|
+
* The country the caller's `defaultCountry` would hard-filter to. Required: this pass exists to correct a wrong one,
|
|
129
|
+
* so with no default there is nothing to correct and the caller should not be calling.
|
|
130
|
+
*/
|
|
131
|
+
defaultCountry: string
|
|
132
|
+
/**
|
|
133
|
+
* Consistency gate radius in km. Defaults to {@link POSTCODE_COUNTRY_COHERENCE_GATE_KM}.
|
|
134
|
+
*/
|
|
135
|
+
gateKm?: number
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* A usable coordinate — the gazetteer stores an unlocated row as 0,0, which haversine would happily measure against.
|
|
140
|
+
*/
|
|
141
|
+
function hasCoord(p: ResolvedPlace): boolean {
|
|
142
|
+
return p.lat !== 0 || p.lon !== 0
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* The address's locality string: the first `locality` node anywhere in the tree, else the first `dependent_locality`.
|
|
147
|
+
* Two passes so a real locality always beats a dependent one regardless of tree order.
|
|
148
|
+
*/
|
|
149
|
+
export function firstLocalityValue(roots: readonly AddressNode[]): string | undefined {
|
|
150
|
+
for (const tag of ["locality", "dependent_locality"] as const) {
|
|
151
|
+
const stack = [...roots]
|
|
152
|
+
|
|
153
|
+
while (stack.length) {
|
|
154
|
+
const n = stack.pop()!
|
|
155
|
+
|
|
156
|
+
if (n.tag === tag && n.value.trim().length) return n.value.trim()
|
|
157
|
+
|
|
158
|
+
stack.push(...n.children)
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return undefined
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Is the (postcode, locality) pair geographically consistent in `country`? Returns the winning pair and its distance,
|
|
167
|
+
* or `null` when the postcode does not resolve there, no same-named locality exists there, or the nearest one is
|
|
168
|
+
* outside the gate. Costs one postcode lookup plus (only if that hit) one locality lookup.
|
|
169
|
+
*/
|
|
170
|
+
async function coherenceIn(
|
|
171
|
+
country: string,
|
|
172
|
+
postcode: string,
|
|
173
|
+
locality: string,
|
|
174
|
+
backend: ResolverBackend,
|
|
175
|
+
gateKm: number
|
|
176
|
+
): Promise<{ postcodePlace: ResolvedPlace; localityPlace: ResolvedPlace; distanceKm: number } | null> {
|
|
177
|
+
let postcodeHits: ResolvedPlace[]
|
|
178
|
+
|
|
179
|
+
try {
|
|
180
|
+
postcodeHits = await backend.findPlace({ text: postcode, placetype: "postalcode", country, limit: 3 })
|
|
181
|
+
} catch {
|
|
182
|
+
return null // a backend hiccup degrades to "no evidence here", never to a crashed resolve
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const postcodePlace = postcodeHits.find(hasCoord)
|
|
186
|
+
|
|
187
|
+
if (!postcodePlace) return null
|
|
188
|
+
|
|
189
|
+
let localityHits: ResolvedPlace[]
|
|
190
|
+
|
|
191
|
+
try {
|
|
192
|
+
localityHits = await backend.findPlace({ text: locality, placetype: "locality", country, limit: 5 })
|
|
193
|
+
} catch {
|
|
194
|
+
return null
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// EXACT matches only. A fuzzy same-country hit ("Paris" → "Parish") is not evidence that the postcode
|
|
198
|
+
// belongs to this country; it is evidence that the FTS index is generous. Backends that do not stamp
|
|
199
|
+
// `exactMatch` therefore contribute nothing here rather than contributing noise.
|
|
200
|
+
let best: { localityPlace: ResolvedPlace; distanceKm: number } | null = null
|
|
201
|
+
|
|
202
|
+
for (const candidate of localityHits) {
|
|
203
|
+
if (!candidate.exactMatch || !hasCoord(candidate)) continue
|
|
204
|
+
const distanceKm = haversineKm(postcodePlace.lat, postcodePlace.lon, candidate.lat, candidate.lon)
|
|
205
|
+
|
|
206
|
+
if (distanceKm > gateKm) continue
|
|
207
|
+
|
|
208
|
+
if (!best || distanceKm < best.distanceKm) {
|
|
209
|
+
best = { localityPlace: candidate, distanceKm }
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return best ? { postcodePlace, ...best } : null
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* The country in which this address's postcode and locality are geographically consistent — or `null` to abstain.
|
|
218
|
+
*
|
|
219
|
+
* Order matters and is the whole safety argument. The caller's `defaultCountry` is tested FIRST; a coherent default
|
|
220
|
+
* short-circuits with `null` (nothing to correct, ≤2 lookups spent, the walk unchanged). Only when the default cannot
|
|
221
|
+
* make the pair consistent are the codex shape's other candidate systems tried, and only a UNIQUE coherent alternative
|
|
222
|
+
* produces a verdict — zero (no evidence) and two-or-more (a genuine tie) both abstain.
|
|
223
|
+
*
|
|
224
|
+
* The candidate set is `candidateSystemsForPostcode` — a model-free SHAPE test over each codex slice's own postcode
|
|
225
|
+
* pattern, no safelist and no prior. Its `SystemCode` values are ISO-3166 alpha-2 in lower case, so the upper-casing
|
|
226
|
+
* below is the whole conversion. Note the corollary: a country with no codex slice can never be proposed (the gazetteer
|
|
227
|
+
* holds `75001` in PL, and this pass will never return PL), which bounds the mechanism to the systems whose postcode
|
|
228
|
+
* shapes are actually specified.
|
|
229
|
+
*/
|
|
230
|
+
export async function findPostcodeCountryScope(
|
|
231
|
+
roots: readonly AddressNode[],
|
|
232
|
+
backend: ResolverBackend,
|
|
233
|
+
opts: PostcodeCountryScopeOpts
|
|
234
|
+
): Promise<PostcodeCountryScope | null> {
|
|
235
|
+
const postcode = opts.postcode.trim()
|
|
236
|
+
const defaultCountry = opts.defaultCountry.trim().toUpperCase()
|
|
237
|
+
|
|
238
|
+
if (!postcode || !defaultCountry) return null
|
|
239
|
+
|
|
240
|
+
const locality = firstLocalityValue(roots)
|
|
241
|
+
|
|
242
|
+
// Both halves of the pair are required. A postcode with no locality has nothing to be coherent WITH, which is what
|
|
243
|
+
// keeps this pass inert on "Springfield, IL 62701" (the parser tags Springfield as a `street` — a separate defect)
|
|
244
|
+
// and on every bare-postcode query.
|
|
245
|
+
if (!locality) return null
|
|
246
|
+
|
|
247
|
+
const gateKm = opts.gateKm ?? POSTCODE_COUNTRY_COHERENCE_GATE_KM
|
|
248
|
+
|
|
249
|
+
// 1. Is the caller's own default country coherent? If so we are done — positive evidence for the default,
|
|
250
|
+
// no override, and the common domestic path costs two lookups and changes nothing.
|
|
251
|
+
if (await coherenceIn(defaultCountry, postcode, locality, backend, gateKm)) return null
|
|
252
|
+
|
|
253
|
+
// 2. The default could not place this pair. Which other country the SHAPE allows can?
|
|
254
|
+
const candidates = candidateSystemsForPostcode(postcode)
|
|
255
|
+
.map((system) => system.toUpperCase())
|
|
256
|
+
.filter((country) => country !== defaultCountry)
|
|
257
|
+
|
|
258
|
+
if (!candidates.length) return null
|
|
259
|
+
|
|
260
|
+
const coherent: PostcodeCountryScope[] = []
|
|
261
|
+
|
|
262
|
+
for (const country of candidates) {
|
|
263
|
+
const hit = await coherenceIn(country, postcode, locality, backend, gateKm)
|
|
264
|
+
|
|
265
|
+
if (hit) {
|
|
266
|
+
coherent.push({ country, postcode, locality, ...hit })
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// 3. Exactly one country makes the pair consistent, or we abstain. Two coherent countries would mean the geometry
|
|
271
|
+
// genuinely does not decide, and guessing between them is precisely what this mechanism exists not to do.
|
|
272
|
+
return coherent.length === 1 ? coherent[0]! : null
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Stamp the adopted scope onto the tree's postcode and locality nodes, so a consumer can see that the walk's country
|
|
277
|
+
* was not the one the caller asked for — and which evidence bought the change. Additive: identity and coordinates are
|
|
278
|
+
* untouched, this only writes `metadata`.
|
|
279
|
+
*/
|
|
280
|
+
export function stampPostcodeCountryScope(roots: readonly AddressNode[], scope: PostcodeCountryScope): void {
|
|
281
|
+
const stack: AddressNode[] = [...roots]
|
|
282
|
+
|
|
283
|
+
while (stack.length) {
|
|
284
|
+
const n = stack.pop()!
|
|
285
|
+
|
|
286
|
+
stack.push(...n.children)
|
|
287
|
+
|
|
288
|
+
if (n.tag !== "postcode" && n.tag !== "locality" && n.tag !== "dependent_locality") continue
|
|
289
|
+
|
|
290
|
+
n.metadata = {
|
|
291
|
+
...n.metadata,
|
|
292
|
+
postcode_country_scope: scope.country,
|
|
293
|
+
postcode_country_scope_km: scope.distanceKm,
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
package/resolve.ts
CHANGED
|
@@ -31,6 +31,11 @@ import {
|
|
|
31
31
|
import { haversineKm } from "@mailwoman/spatial"
|
|
32
32
|
|
|
33
33
|
import { foldName } from "./fold-name.ts"
|
|
34
|
+
import {
|
|
35
|
+
findPostcodeCountryScope,
|
|
36
|
+
type PostcodeCountryScope,
|
|
37
|
+
stampPostcodeCountryScope,
|
|
38
|
+
} from "./postcode-country-coherence.ts"
|
|
34
39
|
import { findRescoreCandidate, hasResolvedPlace, postcodeCodeSubset } from "./span-rescore.ts"
|
|
35
40
|
import { applyAddressPoint, applyInterpolation, applyStreetCentroid } from "./street-tier.ts"
|
|
36
41
|
|
|
@@ -255,8 +260,9 @@ function isResolvedWithCoord(n: AddressNode): boolean {
|
|
|
255
260
|
* (right area, the safe answer) and flag `postcode_city_mismatch`.
|
|
256
261
|
*
|
|
257
262
|
* Only fires where the postcode resolved to a point, so it composes with postcode coverage (#193) — add a country's
|
|
258
|
-
* postcodes and this immediately disambiguates its same-named towns. Default-
|
|
259
|
-
* byte-stable
|
|
263
|
+
* postcodes and this immediately disambiguates its same-named towns. **Default-ON** since the #370 operator promotion
|
|
264
|
+
* (2026-07-04, commit `0010bb8c`) — `opts.postcodeConsistency: false` opts out, and the pass is byte-stable on every
|
|
265
|
+
* tree with no resolved postcode point (the `!anchor` early return below).
|
|
260
266
|
*/
|
|
261
267
|
function applyPostcodeConsistency(roots: readonly AddressNode[], gateKm: number): void {
|
|
262
268
|
// The resolved postcode anchor (first one with a real coordinate).
|
|
@@ -773,12 +779,43 @@ class WOFResolver implements Resolver {
|
|
|
773
779
|
resolvedRegionNode: null,
|
|
774
780
|
}
|
|
775
781
|
|
|
782
|
+
// Postcode-country coherence (#42): the ONE pre-walk pass, and the only mechanism allowed to override
|
|
783
|
+
// `defaultCountry`. Its three sibling coherence passes re-pick nodes AFTER the walk; that shape cannot
|
|
784
|
+
// work here, because what needs correcting is the walk's country SCOPE — which poisons the postcode
|
|
785
|
+
// node's own resolution, the postcode-consistency fallback that then drags the locality onto it, and
|
|
786
|
+
// the hard `country` filter on every admin lookup. So the verdict is taken once, up front, and the
|
|
787
|
+
// walk runs under the corrected country. Default-ON (operator-promoted 2026-08-05; `false` opts out) —
|
|
788
|
+
// needs a default country to correct and both a postcode and a locality to be coherent about; abstains
|
|
789
|
+
// unless EXACTLY one country (never the already-coherent default) makes the pair consistent. See
|
|
790
|
+
// postcode-country-coherence.ts.
|
|
791
|
+
let postcodeScope: PostcodeCountryScope | null = null
|
|
792
|
+
|
|
793
|
+
if (opts.postcodeCountryCoherence !== false && state.defaultCountry && state.postcode) {
|
|
794
|
+
postcodeScope = await findPostcodeCountryScope(tree.roots, this.#backend, {
|
|
795
|
+
postcode: state.postcode,
|
|
796
|
+
defaultCountry: state.defaultCountry,
|
|
797
|
+
...(opts.postcodeCountryCoherenceGateKm !== undefined ? { gateKm: opts.postcodeCountryCoherenceGateKm } : {}),
|
|
798
|
+
})
|
|
799
|
+
|
|
800
|
+
if (postcodeScope) {
|
|
801
|
+
// The override. `hardCountry` is not cleared because it is never consulted while a
|
|
802
|
+
// `defaultCountry` is set (`#lookupAndPick`'s precedence chain reaches it only as the last
|
|
803
|
+
// fallback), so replacing the default is sufficient to re-scope the entire walk.
|
|
804
|
+
state.defaultCountry = postcodeScope.country
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
|
|
776
808
|
const newRoots: AddressNode[] = []
|
|
777
809
|
|
|
778
810
|
for (const root of tree.roots) {
|
|
779
811
|
newRoots.push(await this.#walk(root, /* parentResolved */ null, state))
|
|
780
812
|
}
|
|
781
813
|
|
|
814
|
+
// Attribution for the override, stamped on the two nodes that bought it. Additive metadata only.
|
|
815
|
+
if (postcodeScope) {
|
|
816
|
+
stampPostcodeCountryScope(newRoots, postcodeScope)
|
|
817
|
+
}
|
|
818
|
+
|
|
782
819
|
// Dual-role hierarchy completion (#405/#415). Only when enabled, a region resolved, and the parser
|
|
783
820
|
// emitted NO locality — record the dropped locality as a SECONDARY ROLE (an interpretation) on the
|
|
784
821
|
// resolved region node, from the backend's precomputed coincident-roles relation (#403). One node,
|