test_the_gate_and_the_index_agree_on_one_declaration¶
Tests › tests/test_toolchain.py
What this test is for
Why it exists
THE INVARIANT THAT ACTUALLY MATTERS. One `toolchain.toml` statement, two consumers: the gate asks `gate_exclusion` per file, the index asks `expand_globs` once per build. A file the gate refuses to check must be a file the index was told to exclude, or the repository's single statement means two different things depending on which half of clew read it.
Verifies REQ-DDB-PIPE-011
Given
target = _write(tmp_path, "node_modules/dep/index.js", "module.exports = 1;\n")_write(tmp_path, "src/k.c")(tmp_path / "toolchain.toml").write_text('[ignore]\npaths = ["node_modules/**"]\n')
When
config = load_toolchain_config(tmp_path)cwd = os.getcwd()os.chdir(tmp_path)
2 more
try: _gate_matcher.cache_clear() gate_reason = gate_exclusion("node_modules/dep/index.js") finally: os.chdir(cwd) _gate_matcher.cache_clear()excluded = expand_globs(tmp_path, config.index_globs)
Then
- ✓ gate_reason is not None
- ✓ any(target == path or path in target.parents for path in excluded) holds
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) · 10 of 357 steps
… 83 earlier steps
… 254 later steps
1 more
- Build this wiki from the index · 1 of 400 steps
tests/test_toolchain.py:194 · its file's page
What it checks (2)
assert gate_reason is not None, "the gate must skip it; this test is about the other half"observesgate_exclusionviagate_reasonassert any(target == path or path in target.parents for path in excluded), ( f"the gate skips {target} but the index was handed no exclusion covering it: {excluded}" )observesexpand_globsviaexcluded
Where the product reaches it
Call flow
test_the_gate_and_the_index_agree_on_one_declaration→_write→load_toolchain_config→gate_exclusion→expand_globsWhat 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.
Requirements it verifies (1)
| requirement | linked by | implementers exercised |
|---|---|---|
| REQ-DDB-PIPE-011 | catalog | 1 of 3: binary_file |
Also reaches 2 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-009 measured
- REQ-DDB-WIKI-054 inferred