village-builder

VB-279: Refactor: the heir cache’s end: roundHeirs, its watch and its family memo gone

Status: done (2026-11-15) Priority: 2 Size: S Arch: between Phase: implement Design ref: none (code structure). Survey and measurements: backlog/VB-242.md. Goal: heirRanking (src/sim/heirs.js:20-90) has seven parameters, and two of them serve only the round’s cache, roundHeirs (heirs.js:103-147). watch records which rankings depend on which pawns and spouses. family reuses a household’s line while hh.members is the same array of the same length, which leans on how moveTo replaces one array and appends to the other. After VB-277 the marriages rank afresh in each village’s step; the view is still built by the round’s demand phase (countDemand(st, roundHeirs(st).rank), lifecycle.js:149), by an offer’s close for its handover (closeOffer, lifecycle.js:320), and by matchRules (src/sim/matching.js:7, :33) unless VB-277 has made it rank afresh; matchRules also serves the player’s wish (matchBar, VB-274) and its options (sim/opportunities). Remove the cache. Acceptance criteria:

Implementation notes (15 Nov 2026)