test_long_file_documentation_is_capped_with_an_explicit_notice

Tests › tests/test_file_subject.py

passed Passed in the packaged run.

What this test is for

Why it exists

THE ONE FIELD ON THIS SUBJECT THAT IS UNBOUNDED BY ANYTHING THE INDEX CONTROLS. `members` is a list and is trimmed by `_DOSSIER_LISTS` like every other list on the surface; `documentation` is a scalar string and is therefore invisible to `_shrink_to_budget`. Measured in this repository: `clew/tiers.py` carries 2,794 characters of module docstring, `clew/cli.py` more, and a generated header's `@file` block has no ceiling at all. An unbounded scalar inside a budgeted payload is how the 65,536-byte cap gets exceeded by a reply that every list-trimmer reports as compliant.

Given

  1. doc = "x" * (DETAIL_CAP + 500)
  2. db = tmp_path / "long.db"
6 more
  1. conn = sqlite3.connect(db)
  2. conn.execute("CREATE TABLE path (rowid INTEGER PRIMARY KEY, name TEXT, type INTEGER)")
  3. conn.execute("INSERT INTO path (name, type) VALUES ('src/verbose.c', 1)")
  4. conn.execute("CREATE TABLE file_docs (file_path TEXT NOT NULL, doc TEXT NOT NULL)")
  5. conn.execute("INSERT INTO file_docs VALUES ('src/verbose.c', ?)", (doc,))
  6. conn.commit()
→

When

  1. built = file_subject(conn, "src/verbose.c")
  2. conn.close()
→

Then

  1. ✓ len(built.documentation) is less than len(doc)
  2. ✓ built.documentation contains "truncated"
  3. ✓ built.documentation contains str(len(doc))

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.

Build this wiki from the index · 1 of 400 steps

… 256 earlier steps

callercallercallercallerclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/wiki/symbols.pyclew/wiki/symbols.pyclew/wiki/symbols.pyclew/wiki/symbols.pyother filesother filesother filesother filesloop (line 173)loopbuild_wiki257. symbol_pages → _owners_by_file257_owners_by_file258. _owners_by_file → file_owners258file_owners259. file_owners → table_exists259table_exists▶ test enters260. _owners_by_file → list260list261. symbol_pages → table_exists261table_exists

… 139 later steps

3 more

tests/test_file_subject.py:209 · its file's page

What it checks (3)

  1. assert len(built.documentation) < len(doc), "an unbounded scalar defeats the payload budget" observes file_subject via built
  2. assert "truncated" in built.documentation, ( f"a silent cut reads as a complete document: {built.documentation[-120:]!r}" ) observes file_subject via built
  3. assert str(len(doc)) in built.documentation, ( "the notice must state the true length, so a reader knows how much it is not seeing" ) observes file_subject via built

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_long_file_documentation_is_capped_with_an_explicit_notice→file_subject

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_long_file_documentation_is_capped_with_an_explicit_notice · 3 checksfile_subjecthas_columnsREQ-DDB-QUERY-003 · measuredfile_subjectREQ-DDB-QUERY-004 · measured
Also reaches 2 requirements

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