test_stated_document_meta_identifies_the_document_by_content

Tests › tests/test_declaration.py

passed Passed in the packaged run.

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

  1. raw = b"vendored:\n - 3rdparty\nlocks:\n locks: []\n"
→

When

  1. meta = stated_document_meta(raw, {"vendored": ["3rdparty"], "locks": {}})
  2. other = stated_document_meta(raw + b"\n", {"vendored": ["3rdparty"], "locks": {}})
→

Then

  1. ✓ meta["stated_sections"] equals "locks, vendored"
  2. ✓ len(meta["stated_sha256"]) equals 64
  3. ✓ other["stated_sha256"] differs from meta["stated_sha256"]
  4. ✓ other["stated_sections"] equals meta["stated_sections"]
  5. ✓ any("/" in value for value in meta.values()) is false

tests/test_declaration.py:314 · its file's page

What it checks (5)

  1. assert meta["stated_sections"] == "locks, vendored", "sections must be SORTED, not file order" observes stated_document_meta via meta
  2. assert len(meta["stated_sha256"]) == 64 observes stated_document_meta via meta
  3. assert other["stated_sha256"] != meta["stated_sha256"] observes stated_document_meta via meta
  4. assert 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" ) observes stated_document_meta via meta
  5. assert not any("/" in value for value in meta.values()), f"a path leaked into {meta}" observes stated_document_meta via meta

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

test_stated_document_meta_identifies_the_document_by_content→stated_document_meta

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.

test_stated_document_meta_identifies_the_document_by_content · 5 checksstated_document_metaREQ-DDB-CONFIG-001 · measured
Also reaches 1 requirement

Its run touches their code; that is reach, not proof.