# Wayleave Premise ↔ Title Link Alignment

- **Date:** 2026-10-21
- **Status:** Planned — investigation not started
- **Status Date:** 2026-10-21
- **Phases:** 2
- **Phases Complete:** 0
- **Notes:** Raised while grilling `docs/2026-10-21-premise-list-freeholder.md`. Stub: the
  problem and the questions only. The build is decided by Phase 0's findings.

## Plan Phases

0. Measure how far the two links disagree
1. Decide the link and how coverage moves (build to be written after Phase 0)

## Problem

GeoLynx has two premise → title links, and wayleave uses the other one.

- **Through the building** — `basedata.abp.cross_reference` →
  `landregistry.toid_title_map.freehold_title_no`. Used by the Land Registry search, the
  Strategic Map Analyser, the stocklist freeholder search, and from 2026-10-21 the
  premise lists' Title / Freeholder columns (`landregistry.vw_building_freeholder`).
- **Direct** — `basedata.abp.title_no`. Used by wayleave coverage: a title linked to a
  wayleave resolves its premises through `wayleave.vw_uprns_from_titles`
  (`db/055`, `JOIN basedata.abp abp ON abp.title_no = wl.title_number`), and the linked
  titles list counts premises the same way (`wayleave_landreg_load.php`).
  `wayleave_landreg_save.php` calls it "a different feed: a title can resolve UPRNs while
  being absent from ccod".

**Visible symptom:** on the wayleave Premises tab, a premise brought in by a linked title
can show a different Title in its Title column, because the column reads the building
link and the coverage reads the direct one. The same title can also resolve to different
premise sets on the wayleave and on the analyser.

**Why this is not a display fix.** Coverage pending is derived
(`vw_wayleave_pending` diffs each source's live resolution against the approved rows). Switch
`vw_uprns_from_titles` to the building link and every title-sourced wayleave raises pending
additions and removals at once, with no one having changed anything.

## Questions for Phase 0

1. Per title, how many UPRNs does each link resolve, and how many are in one and not the other?
2. Which link is right where they disagree — sample both directions against the register.
3. Does `abp.title_no` carry leasehold titles as well as freehold? `toid_title_map` is freehold only.
4. `docs/improvement-opportunities.md` (title→UPRN fidelity, ~line 1087) asks the same
   question from the other side — fold it in.
5. If the building link wins: is the pending churn acceptable as a one-off approval round,
   or does the migration carry existing approvals across (as carrying config across a
   schema change is allowed)?

### Findings so far

- *2026-10-22, SF660048* (found testing the premise-list Title column): linked to a
  wayleave, listed with 0 premises, and resolves **0 premises by either link** (abp.title_no
  0, building 0, both 0). The wayleave carries 54 `title` coverage rows, all `removed` —
  most likely the title was linked before the approval model (042–055) and resolved
  differently then. Not evidence of the two links disagreeing. SF551000 (1 premise)
  resolves and shows correctly. A linked title that resolves nothing is visible as
  "0 premises" in the linked titles list, so not silent.

## Build

To be written after Phase 0.

## Testing checklist

To be written with the build.

## Risks

- Moving coverage's link changes what wayleaves cover without a decision — the thing the
  approval model exists to prevent. Any build must route the difference through approval
  or explicitly carry it.
