test_an_oversized_document_is_refused_unread¶
Tests › tests/test_datamodel.py
What this test is for
Why it exists
MEASURED CAUSE, not a hypothetical. One control target vendors a YAML parser's benchmark corpus, including a 10.7 MB deliberately-pathological document, and the first version of this stage did not finish walking it in twenty-five minutes at full CPU. Recognising documents by SHAPE means parsing documents nobody declared, so the parse needs a bound that content cannot defeat.
Given
root = _repo(tmp_path, {"widgetbus.toml": MANIFEST}, DEFINES)big = root / "conf" / "datamodel" / "huge.yaml"
3 more
filler = "".join(f"- PADDING_KEY_{n}\n" for n in range(200_000))big.write_text("---\n" + filler, encoding="utf-8")found = discover(root)
When
- —
Then
- ✓ big.stat().st_size is greater than 2 * 1024 * 1024
- ✓ found.oversized equals 1
- ✓ found.as_meta()["documents_oversized"] equals "1"
- ✓ found.listed does not contain "PADDING_KEY_0"
- ✓ {k.define_name for k in found.keys} equals set(DEFINES)
What it exercises
The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.
thread `clew-first-build-` — `_first_build_worker` (clew/mcp_server/server.py) · 4 of 142 steps
… 8 earlier steps
… 126 later steps
2 more
- Build, refresh and check the index · 4 of 153 steps
- clew — `main` (clew/cli.py) · 4 of 400 steps
tests/test_datamodel.py:855 · its file's page
What it checks (5)
assert big.stat().st_size > 2 * 1024 * 1024not attributedassert found.oversized == 1not attributedassert found.as_meta()["documents_oversized"] == "1"not attributedassert "PADDING_KEY_0" not in found.listednot attributedassert {k.define_name for k in found.keys} == set(DEFINES)not attributed
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_an_oversized_document_is_refused_unread→_repoWhat 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 5 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-001 measured
- REQ-DDB-CONFIG-007 measured
- REQ-DDB-INDEX-005 measured
- REQ-DDB-PIPE-003 measured
- REQ-DDB-SCHEMA-013 measured