test_stated_document_meta_identifies_the_document_by_content¶
Tests › tests/test_declaration.py
What this test is for
Why it exists
WHY THIS EXISTS AT ALL, because the obvious alternative was tried and shipped broken. `options.*` records which TIER won per option, and it CANNOT answer "was this document applied". Measured on mbedtls 2026-08-14: one document declaring `locks`, `vendored` and `preprocessor` produced an index reading `options.locks.tier=explicit` (replayed from an older build), `options.predefined.tier=heuristic`, and no vendored row at all. Every reader reported health and a graded run was invalid.
Given
raw = b"vendored:\n - 3rdparty\nlocks:\n locks: []\n"
When
meta = stated_document_meta(raw, {"vendored": ["3rdparty"], "locks": {}})other = stated_document_meta(raw + b"\n", {"vendored": ["3rdparty"], "locks": {}})
Then
- ✓ meta["stated_sections"] equals "locks, vendored"
- ✓ len(meta["stated_sha256"]) equals 64
- ✓ other["stated_sha256"] differs from meta["stated_sha256"]
- ✓ other["stated_sections"] equals meta["stated_sections"]
- ✓ any("/" in value for value in meta.values()) is false
tests/test_declaration.py:314 · its file's page
What it checks (5)
assert meta["stated_sections"] == "locks, vendored", "sections must be SORTED, not file order"observesstated_document_metaviametaassert len(meta["stated_sha256"]) == 64observesstated_document_metaviametaassert other["stated_sha256"] != meta["stated_sha256"]observesstated_document_metaviametaassert other["stated_sections"] == meta["stated_sections"], ( "the SECTION LIST is unchanged by a whitespace edit, which is why the sha is the " "load-bearing half rather than the section names" )observesstated_document_metaviametaassert not any("/" in value for value in meta.values()), f"a path leaked into {meta}"observesstated_document_metaviameta
Where the product reaches it
No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.
Call flow
What it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
Also reaches 1 requirement
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-001 measured