test_a_requirement_name_cannot_forge_table_rows

Tests › tests/guard/test_guard_impact.py

passed Passed in the packaged run.

What this test is for

Why it exists

The names come from the TARGET'S requirements catalog, and the rendered table is written to `docs/generated/impact/impact.md`, `git add`ed, and printed to stderr — where it lands in the agent's context. A name carrying `|` forges columns; one carrying a newline forges ROWS, so a catalog can write arbitrary content into a file the developer is about to commit and into the transcript of whatever is watching the commit.

Given

  1. entry = ImpactEntry( req_id="REQ-001", req_name="Name | with pipes\n| FORGED | ROW | here |\nand more", functions=[ ChangedFunction( name="fn\n| SECOND | FORGED | ROW |", file_path="a.c", new_version="1.0" ) ], )
→

When

  1. report = format_markdown([entry])
  2. rows = [line for line in report.splitlines() if line.startswith("|")]
→

Then

  1. ✓ len(rows) equals 3
  2. ✓ report contains "FORGED"
  3. ✓ report does not contain "\n| FORGED"

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.

`main` (clew/guard/main.py) · 7 of 357 steps

… 280 earlier steps

program launcherprogram launcherprogram launcherprogram launcherclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/impact.pyclew/guard/impact.pyclew/guard/impact.pyclew/guard/impact.pyother filesother filesother filesother filesopt (line 673)optloop (line 684)loopopt (line 482)optloop ×5 (line 699)loop ×5main281. _write_report → format_markdown281format_markdown282. format_markdown → _unmapped_markdown282_unmapped_markdown283. format_markdown → _markdown_row283_markdown_row▶ test enters284–288. _markdown_row → _cell284_cell ×5289. format_markdown → _unmapped_markdown289_unmapped_markdown290. _write_report → format_json290format_json291. run_precommit → git_add291git_add

… 66 later steps

tests/guard/test_guard_impact.py:593 · its file's page

What it checks (3)

  1. assert len(rows) == 3, f"repo text forged table rows: {rows}" not attributed
  2. assert "FORGED" in report, ( "the text must still be REPORTED — this is escaping, not filtering" ) observes format_markdown via report
  3. assert "\n| FORGED" not in report observes format_markdown via report

Where the product reaches it

  • main → _run → run_precommit → format_markdown (flow)

Call flow

test_a_requirement_name_cannot_forge_table_rows→format_markdown

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_a_requirement_name_cannot_forge_table_rows · 3 checksformat_markdownREQ-DDB-GUARD-010 · measured
Also reaches 1 requirement

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