Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/CICs/UNFAOPostProcessorManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

**Status:** Active
**Owner:** PRIO MD&D Team
**Last reviewed:** 2026-06-02
**Last reviewed:** 2026-08-05
**Related ADRs:** ADR-001, ADR-002, ADR-008, ADR-009

---
Expand Down
108 changes: 75 additions & 33 deletions reports/technical_risk_register.md

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions tests/test_doc_accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,33 @@ def _governance_docs() -> list[Path]:
}


def test_a_cic_review_date_is_not_older_than_its_own_content():
"""Front matter that understates how stale a document is calibrates trust wrongly.

`UNFAOPostProcessorManager.md` said *Last reviewed 2026-06-02* while its body
carried an August correction note about a collaborator the class never called. The
error was in the safe direction — a reader distrusted it more than needed — but that
is luck, not design, and the same field could just as easily claim freshness a
document does not have.

Checked against the document's own dated content rather than against git, because
git records when a line was touched and this field claims when someone *read the
whole thing*. A date the body mentions later than the header is proof the header is
behind.
"""
for cic in sorted(_CIC_SUBJECT):
text = (_REPO / "docs" / "CICs" / cic).read_text()
header = re.search(r"\*\*Last reviewed:\*\*\s*(\d{4}-\d{2}-\d{2})", text)
assert header, f"{cic} declares no review date; a reader cannot calibrate it"
body_dates = re.findall(r"\b(20\d\d-\d{2}-\d{2})\b", text[header.end():])
newer = sorted(d for d in body_dates if d > header.group(1))
assert not newer, (
f"{cic} says it was last reviewed {header.group(1)}, but its body cites "
f"later dates {newer[:3]}. Either the review date is stale or the content "
"was added without re-reading the document it changed."
)


def test_every_cic_declares_which_class_it_documents():
"""Assert this guard's inputs are real (ADR-014 §2).

Expand Down
28 changes: 28 additions & 0 deletions tests/test_env_declaration.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,34 @@ def test_the_pinned_contract_edition_still_matches_the_registry(partner):
)


@pytest.mark.parametrize("partner", PARTNER_PACKAGES)
def test_the_docstring_states_the_same_edition_the_constants_declare(partner):
"""The module says the edition twice — in prose and in a constant. Only one is checked.

Both `appwrite_env.py` docstrings name the registry edition in a sentence
(*"That pin is registry v1.4.1"*) beside the constant that declares it. The drift
detector reads the constant, so on 2026-08-05 the pins moved to v1.4.4 with both
guards green and both docstrings still saying v1.4.1 — a reader following the prose
would have checked their coordinates against a superseded edition.

This is the same defect the register carries as C-80 and C-82: a claim in prose next
to a fact in code, with a guard on the fact only. Cheap to close here because the
prose states the value in a fixed form, so the two can simply be compared.
"""
module = _PARTNER_ENV[partner][0]
stated = re.findall(r"registry \*\*v([\d.]+)\*\*", module.__doc__ or "")
assert stated, (
f"{partner}/appwrite_env.py's docstring no longer states the registry edition in "
"the form this guard reads. If the sentence was reworded, reword the pattern too "
"— do not delete the check, or the prose goes unguarded again."
)
assert set(stated) == {module.SEAM_CONTRACT_VERSION}, (
f"[{partner}] the docstring says registry v{'/v'.join(sorted(set(stated)))} but "
f"SEAM_CONTRACT_VERSION declares v{module.SEAM_CONTRACT_VERSION}. The constant is "
"what the drift detector checks, so the prose is the half that rots silently."
)


@pytest.mark.parametrize("partner", _PARTNERS)
def test_the_pinned_commit_is_reachable_from_the_contract_repos_main(partner):
"""Existence is not reachability, and that distinction cost a merged PR (#196).
Expand Down
50 changes: 50 additions & 0 deletions tests/test_register_integrity.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,56 @@ def test_internal_references_resolve_and_foreign_ones_are_namespaced(register):
)


def test_test_files_named_by_live_entries_exist_or_name_their_repo(register):
"""A live entry pointing at a test nobody can find describes work against nothing.

Scoped to **Open Concerns and Disagreements** deliberately. A resolved entry citing
`test_mapping.py` or `test_reconciliation_parity.py` is recording what discharged it,
and those files are correctly gone — a blanket existence check would fire on eleven
such mentions and be deleted within a day (ADR-014 §3). Measured before scoping:
eleven missing across the whole register, **two** in live entries.

The two it found on 2026-08-05 were both real, and one of them is a shape this
register already polices for identifiers but not for paths:
``tests/forecast/test_wire_golden_fixture.py`` is **views-faoapi's** file. A bare
foreign path sends the reader hunting in this repo's tree, which is exactly the
argument `test_internal_references_resolve_and_foreign_ones_are_namespaced` makes
about a bare ``C-161``.

**The exemption is a declaration, not a proximity heuristic, and the first draft got
that wrong.** It reused `_FOREIGN_PREFIXES` — the identifier-namespacing list — over a
60-character window. That list holds ordinary English: ``models``, ``frames``,
``pipeline-core``. Mutation M1 planted a vanished file in a live entry and the guard
stayed green, because the sentence three words earlier happened to say *"pinned
pipeline-core-free"*. It had caught its two real findings by luck of their neighbours
and would have missed most others. So the owning repo must now be named **immediately
before the path**, in the possessive form a reader would write anyway.
"""
body = register.split("## Register Conventions")[0]
live = body[body.index("## Open Concerns"):body.index("## Resolved Concerns")]

repo = Path(__file__).resolve().parent.parent
#: `views-faoapi's `tests/...`` — the repo abutting the path, not merely nearby.
owned_elsewhere = re.compile(r"views-[\w-]+(?:'s)?[\s:]*$")

unresolved = []
for match in re.finditer(r"`(?:(tests/[\w/]+\.py)|(test_\w+\.py))`", live):
rel = match.group(1) or f"tests/{match.group(2)}"
if (repo / rel).exists():
continue
if owned_elsewhere.search(live[max(0, match.start() - 40) : match.start()]):
continue
line = live.count("\n", 0, match.start()) + 1
unresolved.append(f"line ~{line} of the live sections: {rel}")

assert not unresolved, (
"live register entries name test files that do not exist here and do not name "
f"the repository that owns them: {unresolved}. If the file is another repo's, "
"say so beside it. If it is ours, it was deleted and the entry is describing "
"work against a file nobody can open."
)


# ── Closing conditions must not already be met (S2 / #183) ───────────────────
#
# The guards above catch a heading that SAYS it is resolved. They cannot catch an
Expand Down
8 changes: 4 additions & 4 deletions views_postprocessing/crafd/appwrite_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
views-appwrite and referenced by pinned URL, never copied — copies were the
platform's original failure (þing-01 sáttmál S6):

https://github.com/views-platform/views-appwrite/blob/90fc105/docs/ADRs/platform/coordinate_registry.toml
https://github.com/views-platform/views-appwrite/blob/fcf32c9/docs/ADRs/platform/coordinate_registry.toml

That pin is registry **v1.4.1** — declared below as ``SEAM_CONTRACT_VERSION`` /
That pin is registry **v1.4.4** — declared below as ``SEAM_CONTRACT_VERSION`` /
``SEAM_CONTRACT_COMMIT`` so the pin is a value a test can check rather than a fact
buried in prose. A pinned URL does not rot, but it does go stale, and nothing in this
repository could previously tell you it had (register C-57).
Expand Down Expand Up @@ -47,8 +47,8 @@
#: declaration against that edition of the registry. ``tests/test_env_declaration.py``
#: enforces the pair — for this package and for ``unfao`` alike — against a local
#: views-appwrite checkout when one is present.
SEAM_CONTRACT_VERSION = "1.4.1"
SEAM_CONTRACT_COMMIT = "90fc105"
SEAM_CONTRACT_VERSION = "1.4.4"
SEAM_CONTRACT_COMMIT = "fcf32c9"

CONNECTION_ENV = (
"APPWRITE_ENDPOINT",
Expand Down
8 changes: 4 additions & 4 deletions views_postprocessing/unfao/appwrite_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
views-appwrite and referenced by pinned URL, never copied — copies were the
platform's original failure (þing-01 sáttmál S6):

https://github.com/views-platform/views-appwrite/blob/90fc105/docs/ADRs/platform/coordinate_registry.toml
https://github.com/views-platform/views-appwrite/blob/fcf32c9/docs/ADRs/platform/coordinate_registry.toml

That pin is registry **v1.4.1** — declared below as
That pin is registry **v1.4.4** — declared below as
``SEAM_CONTRACT_VERSION`` / ``SEAM_CONTRACT_COMMIT`` so the pin is a value a test can
check rather than a fact buried in prose. A pinned URL does not rot, but it does go
stale, and nothing in this repository could previously tell you it had (register C-57).
Expand Down Expand Up @@ -44,8 +44,8 @@
#: Bumping these is not bookkeeping: it asserts that someone re-checked this module's
#: declaration against that edition of the registry. ``tests/test_env_declaration.py``
#: enforces the pair against a local views-appwrite checkout when one is present.
SEAM_CONTRACT_VERSION = "1.4.1"
SEAM_CONTRACT_COMMIT = "90fc105"
SEAM_CONTRACT_VERSION = "1.4.4"
SEAM_CONTRACT_COMMIT = "fcf32c9"

CONNECTION_ENV = (
"APPWRITE_ENDPOINT",
Expand Down
Loading