test_source_caps_and_flags_truncation

Tests › tests/test_query.py

passed Passed in the packaged run.

What this test is for

Why it exists

A comparison query layer shipped an UNBOUNDED source tool and one call returned 26 KB, distorting its own token accounting. The cap is the fix, so it is asserted: at most max_lines, truncated=True, and the reported end_line describes exactly what came back.

Verifies REQ-DDB-QUERY-002

Given

  1. —
→

When

  1. full = q.source(rich_db, "sensor_poll", repo_root)
  2. capped = q.source(rich_db, "sensor_poll", repo_root, max_lines=2)
→

Then

  1. ✓ full is not None
  2. ✓ len(full.lines) is greater than 2
  3. ✓ capped is not None
  4. ✓ len(capped.lines) equals 2
  5. ✓ capped.truncated is True
  6. ✓ capped.start_line equals full.start_line
  7. ✓ capped.end_line equals full.start_line + 1
  8. ✓ capped.lines equals full.lines[:2]

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.

Look up one name: everything the index holds about it · 7 of 226 steps

… 17 earlier steps

callercallercallercallerclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/recovery.pyclew/query/recovery.pyclew/query/recovery.pyclew/query/recovery.pydossier18. _documentation_mentions → table_exists18table_exists19. _documentation_mentions → has_columns19has_columns20. has_columns → table_exists20table_exists21–22. _hint_from → _name_exists21_name_exists +1 more

… 23 steps between

callercallercallercallerclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyother filesother filesother filesother filesdossier46. _ambiguity_counts → table_exists46table_exists47. _ambiguity_counts → function_candidates47function_candidates48. function_candidates → table_exists48table_exists▶ test enters49–51. function_candidates → _test_scope_term49_test_scope_term +2 more52–53. matching_identity → qualified_name_of52qualified_name_of +1 more

… 24 steps between

callercallercallercallerclew/query/payload.pyclew/query/payload.pyclew/query/payload.pyclew/query/payload.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyother filesother filesother filesother filesdossier78. _referenced_by → table_exists78table_exists79. _macro_def → symbol_provenance79symbol_provenance80. symbol_provenance → records_provenance80records_provenance▶ test enters81. records_provenance → has_columns81has_columns82. _gate_definitions → _gate_definition_gaps82_gate_definition_gaps83. _flatten_subject → _empty_callers_note83_empty_callers_note

… 143 later steps

3 more

tests/test_query.py:713 · its file's page

What it checks (7)

  1. assert full is not None and len(full.lines) > 2 observes source via full
  2. assert capped is not None observes source via capped
  3. assert len(capped.lines) == 2 observes source via capped
  4. assert capped.truncated is True observes source via capped
  5. assert capped.start_line == full.start_line observes source via capped
  6. assert capped.end_line == full.start_line + 1 observes source via capped
  7. assert capped.lines == full.lines[:2] observes source via capped

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_source_caps_and_flags_truncation→source

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_source_caps_and_flags_truncation · 7 checkssourcesymbol_provenanceREQ-DDB-INDEX-004 · measuredsourceREQ-DDB-QUERY-001 · measuredsourcefunction_candidatesREQ-DDB-QUERY-003 · measuredsourcefunction_candidatesREQ-DDB-QUERY-010 · measured

Requirements it verifies (1)

requirementlinked byimplementers exercised
REQ-DDB-QUERY-002catalogunknown
Also reaches 4 requirements

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