diff --git a/infra/gitea/custom/public/assets/dossier/view-dossier.js b/infra/gitea/custom/public/assets/dossier/view-dossier.js index 9a02344..8884067 100644 --- a/infra/gitea/custom/public/assets/dossier/view-dossier.js +++ b/infra/gitea/custom/public/assets/dossier/view-dossier.js @@ -31,7 +31,7 @@ export function render(data) { Active codes
${codes(g.active)}
${(g.deleted || []).length ? `Deleted codes
${codes(g.deleted, "del")}
` : ""} ${(g.linked || []).length ? `Linked codes
${codes(g.linked, "lnk")}
` : ""} - ${row("Status", esc(H.status))}${row("Years", esc(H.years_active))}${row("Built", esc(H.built_at))} + ${row("Status", esc(H.status))}${row("Years on file", esc(H.years_on_file || H.years_active))}${row("Built", esc(H.built_at))} ${row("Citation check", passed ? "citation check passed" : "citation check failed")} ${row("Extractor", esc(H.extractor))} ${(H.fallbacks || []).length ? row("Fallbacks", H.fallbacks.map(esc).join("; ")) : ""} diff --git a/tests/lex/views-book.test.mjs b/tests/lex/views-book.test.mjs index eaff465..9ab39d5 100644 --- a/tests/lex/views-book.test.mjs +++ b/tests/lex/views-book.test.mjs @@ -38,6 +38,14 @@ test("dossier view", () => { ok(h.includes("Invented governance excerpt.")); }); +test("dossier years label reads years_on_file, falls back to years_active", () => { + const st0 = st("/dossier?family=HOME-VISITS"); + const old = dossier.render({ header: H }, st0); + ok(old.includes("Years on file") && old.includes(esc(H.years_active))); + const cur = dossier.render({ header: { ...H, years_on_file: "2019–2027" } }, st0); + ok(cur.includes("Years on file") && cur.includes("2019–2027") && !cur.includes(esc(H.years_active))); +}); + test("dossier with no governance and a failed check", () => { const H2 = { ...H, governance: [], check_passed: false, facts: {}, gaps: ["No governance findings captured."] }; const h = dossier.render({ header: H2 }, st("/dossier?family=HOME-VISITS")); diff --git a/tests/llm/test_policy_live.py b/tests/llm/test_policy_live.py index a3eb4cb..062b685 100644 --- a/tests/llm/test_policy_live.py +++ b/tests/llm/test_policy_live.py @@ -23,6 +23,36 @@ FAMILY = "HOME-VISITS" VIEW_SECTIONS = ("header", "timeline", "valuation", "payment", "politics") +@pytest.fixture(scope="module", autouse=True) +def _restore_registry(): + """Opening the live replica loads its 8,662-family registry into + ``pfs.families`` (and caches the handle); put both back afterwards so + neighbouring tests see the registry they expect.""" + from llm import evidence + from pfs import families + + saved = ( + dict(families.FAMILIES), + families._PHRASE_RE, + families._PHRASE_INDEX, + families._CODE_INDEX, + ) + prior = evidence._REPLICA + yield + with families._REGISTRY_LOCK: + families.FAMILIES.clear() + families.FAMILIES.update(saved[0]) + ( + families._PHRASE_RE, + families._PHRASE_INDEX, + families._CODE_INDEX, + ) = saved[1:] + if evidence._REPLICA is not prior: + if evidence._REPLICA is not None: + evidence._REPLICA[2].close() + evidence._REPLICA = prior + + @pytest.fixture(scope="module") def cfg(): from llm import config