village-builder

VB-432: A village’s round clears only the memos a marriage touches

Status: done (2026-11-16) Priority: 3 Size: S Arch: between Phase: implement Design ref: backlog/VB-277.md, backlog/VB-242.md; AGENTS.md, Rules for cost Goal: VB-277 ranks heirs afresh after each marriage or handover inside a village’s round: rankings a round went 478 to 2,016 (medium-ref) and 468 to 3,586 (small-y40), up to 430 in one step, because under land residence every woman’s place is ranked again. Clear only the memos of the households a marriage or handover touches, behaviour unchanged. Acceptance criteria:

Notes (VB-432)

Implementation: heirRanking and ownFirstOf take a deps Set and fill it with the pawns the ranking read (line, holder, every candidate before the filter, their spouses, the ancestors that pick the nested farms). matchRules keeps readers (pawn -> households whose cached ranking read it); touched(pawns, homes) drops the rankings of the homes and of the readers of the pawns, and the places of those pawns and of the members of cleared households; handed and means are cleared whole (cheap, they read cached rankings). villageRound uses it after a marriage where neither holds a farm nor is held in trust (so wed’s handOn and goBack do not run); any other marriage, and every handover, still clear()s all. Checked: a temporary comparison of every cached ranking against a fresh one, populous seed 7 / founders seed 3 / heirs seed 5, small, 5-8 years: 0 stale. same.js: same. Numbers (populous seed 7 medium 10 years, --report counts): heirRank 14,522 -> 13,931 (-4%); populous small seed 7 6 years 2,029 -> 2,014. Rankings a round and longest marriage step at medium-ref and small-y40 not measured (fixtures are a night job). The saving is small at year 10; the rest is handovers’ full clear and rank(h) of first-time households. A follow-up (handover partial clear) is VB-539.