From ee25212618f91e5466170f9bb61f5fad1b15ec51 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 7 Oct 2026 01:12:54 +0200 Subject: [PATCH] Answer stability round 1: readsRow counts a selector, checkNameReads defers to refuseSingleRead, climbed names the child's row, and geo-se.py owns its big-city reading --- data-import/geo-se.py | 2 +- namefence.go | 4 ++-- path.go | 5 +++-- table.go | 5 +++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/data-import/geo-se.py b/data-import/geo-se.py index 6ef1c51..34e6141 100644 --- a/data-import/geo-se.py +++ b/data-import/geo-se.py @@ -37,7 +37,7 @@ NVDB_PAGE = 50000 OUT = Path(__file__).resolve().parent.parent / "data" / "geo" / "SE" CACHE = Path(__file__).resolve().parent / "cache" TIMEZONE = "Europe/Stockholm" -# The big cities the delivery-digit rule excepts: docs/research/research-geo-se.md, postnummer Structure. +# This script's reading of the "exceptions in big cities" in docs/research/research-geo-se.md, postnummer Structure. ONE_POSITION = {"Stockholm", "Göteborg", "Malmö"} # A tätort's floor: "minst 200 invånare", docs/research/research-geo-se.md, Ortnamn. UNMATCHED_POPULATION = 200 diff --git a/namefence.go b/namefence.go index b1a5e15..357a380 100644 --- a/namefence.go +++ b/namefence.go @@ -9,8 +9,8 @@ import ( "github.com/larvit/fejkdata/internal/invariant" ) -// checkNameReads refuses each binding of t read only once, a read of a name inside the field bound -// to it, and a read {n} beside {n.w} where n's pick renders w twice. +// checkNameReads refuses each binding of t that refuseSingleRead refuses, a read of a name inside +// the field bound to it, and a read {n} beside {n.w} where n's pick renders w twice. func checkNameReads(label string, t *template, names resolvedNames) error { for _, tok := range t.tokens { if tok.Kind != grammar.NameBind { diff --git a/path.go b/path.go index 3384122..0cff466 100644 --- a/path.go +++ b/path.go @@ -185,8 +185,9 @@ func probePath(n node, tail []string, steps []pathStep) ([]pathStep, error) { // For a read through a name, memo keeps the variant drawn at each of levels, so paths sharing a // prefix share it. It returns the leaf and the pins its row is in. func drawSteps(s *drawstate.State, n node, steps []pathStep, pins *pinSet, memo *drawMemo, levels []pickKey) (node, *pinSet) { - // climbed is the table a ".." stepped up to. The next step down from it draws its row afresh, - // into pins of its own, which memo shares with every path of the pick stepping down there. + // climbed is the table a ".." stepped up to. The next step down from it draws the child's row + // afresh, into pins holding only the rows from climbed up, which memo shares with every path + // of the pick stepping down there. var climbed *rowsTable for _, st := range steps { if c, ok := n.(*choice); ok { diff --git a/table.go b/table.go index deaef03..3fa0e0d 100644 --- a/table.go +++ b/table.go @@ -265,13 +265,14 @@ func (t *table) route(tail []string, descended bool) (tableRoute, error) { if err != nil { return tableRoute{}, err } - selected, readsRow := sel != "", descended || len(tail) > 0 + selected := sel != "" + readsRow := selected || descended || len(tail) > 0 // A selector further down pins this table by ancestry; drawing first could draw a row the // selector is not inside. pinnedBelow := grammar.HasSelector(tail) r := tableRoute{sel: sel, draw: !selected && readsRow && !pinnedBelow} switch { - case !selected && !readsRow: + case !readsRow: r.next = t case len(tail) == 0: r.next = t.rowNode