test_shipped_config_tiebreak.py¶
tests/test_shipped_config_tiebreak.py
Disagreeing config headers left a gate's default unstated, and an answer went confidently backwards about the default build.
test_a_declared_header_still_wins
None test_shipped_config_tiebreak.test_a_declared_header_still_wins(Path tmp_path)
A declared header must still outrank the shipped-path heuristic.
tests/test_shipped_config_tiebreak.py:128
Checks
assert gate.default_state == "on", (f"a declared header was overruled by the shipped-path heuristic: {gate.default_state!r}" )
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-QUERY-003 | measured | test_a_declared_header_still_wins → _with_defaults → table_exists |
| REQ-DDB-QUERY-004 | measured | test_a_declared_header_still_wins → _with_defaults → _in_default_build |
| REQ-DDB-QUERY-013 | measured | test_a_declared_header_still_wins → _with_defaults → decided_default |
Source · 23 lines
def test_a_declared_header_still_wins(tmp_path: Path) -> None:
"""THE PRECEDENCE THAT MUST NOT INVERT. An operator naming a config header is better evidence
than a filename pattern, so a declared row wins even when a shipped-looking path disagrees.
@brief Declared beats shipped-path.
@return None.
@version 1
"""
conn = _conn(
tmp_path,
[
("off", "include/mbedtls/mbedtls_config.h", "heuristic"),
("on", "configs/my_declared_config.h", "declared"),
],
)
gate = _with_defaults(conn, (_gate(),))[0]
assert gate.default_state == "on", (
f"a declared header was overruled by the shipped-path heuristic: {gate.default_state!r}"
)
Activity · 3 steps
test_a_declared_header_still_wins_an_agreeing_set
None test_shipped_config_tiebreak.test_a_declared_header_still_wins_an_agreeing_set(Path tmp_path)
A declared header still outranks the shipped-path heuristic when they agree.
tests/test_shipped_config_tiebreak.py:233
Checks
assert "operator_declared.h" in gate.default_site, (f"a declared header must outrank the shipped-path heuristic: {gate.default_site!r}" )
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-QUERY-003 | measured | test_a_declared_header_still_wins_an_agreeing_set → _with_defaults → table_exists |
| REQ-DDB-QUERY-004 | measured | test_a_declared_header_still_wins_an_agreeing_set → _with_defaults → _in_default_build |
| REQ-DDB-QUERY-013 | measured | test_a_declared_header_still_wins_an_agreeing_set → _with_defaults → decided_default |
Source · 22 lines
def test_a_declared_header_still_wins_an_agreeing_set(tmp_path: Path) -> None:
"""THE PRECEDENCE MUST NOT INVERT. An operator naming a config header is better evidence than
a filename pattern, and that holds whether or not the states agree — so the agreeing-set rule
is a tie-break among HEURISTIC rows, never a promotion over a declared one.
@brief Declared beats shipped-path even with no disagreement.
@return None.
@version 1
"""
conn = _conn(
tmp_path,
[
("off", "include/mbedtls/mbedtls_config.h", "heuristic"),
("off", "custom/operator_declared.h", "declared"),
],
)
gate = _with_defaults(conn, (_gate(),))[0]
assert "operator_declared.h" in gate.default_site, (
f"a declared header must outrank the shipped-path heuristic: {gate.default_site!r}"
)1 more lines, not shown
Activity · 3 steps
test_a_disagreement_with_no_shipped_site_is_still_dropped
None test_shipped_config_tiebreak.test_a_disagreement_with_no_shipped_site_is_still_dropped(Path tmp_path)
A disagreement with NO shipped site must still be dropped.
tests/test_shipped_config_tiebreak.py:156
Checks
assert not gate.default_state, (f"an unresolvable disagreement invented a default: {gate.default_state!r}" )
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-QUERY-003 | measured | test_a_disagreement_with_no_shipped_site_is_still_dropped → _with_defaults → table_exists |
| REQ-DDB-QUERY-004 | inferred | test_a_disagreement_with_no_shipped_site_is_still_dropped → _with_defaults → _in_default_build |
| REQ-DDB-QUERY-013 | measured | test_a_disagreement_with_no_shipped_site_is_still_dropped → _with_defaults → decided_default |
Source · 24 lines
def test_a_disagreement_with_no_shipped_site_is_still_dropped(tmp_path: Path) -> None:
"""THE ORIGINAL RULE SURVIVES WHERE IT WAS RIGHT. When every site really is an equal guess,
inventing one is worse than silence — the gate must still come back unstated rather than
picking arbitrarily.
@brief An unresolvable disagreement stays unstated.
@return None.
@version 1
"""
conn = _conn(
tmp_path,
[
("on", "configs/profile_a.h", "heuristic"),
("off", "configs/profile_b.h", "heuristic"),
],
)
gate = _with_defaults(conn, (_gate(),))[0]
assert not gate.default_state, (
f"an unresolvable disagreement invented a default: {gate.default_state!r}"
)
Activity · 3 steps
test_agreeing_sites_still_cite_the_shipped_config
None test_shipped_config_tiebreak.test_agreeing_sites_still_cite_the_shipped_config(Path tmp_path)
When every site AGREES, the shipped config is still the one to cite.
tests/test_shipped_config_tiebreak.py:185
Checks
assert gate.default_state == "off", "the state was already right and must stay right"assert "mbedtls_config.h" in gate.default_site, (f"with every site agreeing, the citation must still be the repository's own shipped " f"header rather than whichever path sorted first: {gate.default_site!r}" )
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-QUERY-003 | measured | test_agreeing_sites_still_cite_the_shipped_config → _with_defaults → table_exists |
| REQ-DDB-QUERY-004 | measured | test_agreeing_sites_still_cite_the_shipped_config → _with_defaults → _in_default_build |
| REQ-DDB-QUERY-013 | measured | test_agreeing_sites_still_cite_the_shipped_config → _with_defaults → decided_default |
Source · 43 lines
def test_agreeing_sites_still_cite_the_shipped_config(tmp_path: Path) -> None:
"""THE OTHER HALF OF THE SAME EVIDENCE PROBLEM, found by replaying the frozen mbedtls index.
`dossier("MBEDTLS_THREADING_C")` now reports `default_state: 'off'` correctly — all three
`config_defaults` rows agree — and cites
`default_site: 'configs/config-symmetric-only.h:73'`.
That is an ALTERNATE BUILD PROFILE. The repository's own shipped header says the same thing at
`include/mbedtls/mbedtls_config.h:3787`, and it is the file a default build actually reads.
With no disagreement to settle, `_with_defaults` kept the first row it encountered, which is
whichever file path sorted first — `configs/` before `include/`.
THE STATE WAS NEVER WRONG; THE CITATION WAS. mbedtls Q3's marks are about what the DEFAULT
build does, and `default_site` is the field a reader follows to check the claim. Sending them
to a non-default profile invites them to doubt a correct answer — and `default_site` exists
precisely "so a reader can disagree with the choice", which it cannot do usefully against a
file that is not in play.
`is_shipped_config` is already the rule for the disagreement case one function up, so this
adds no new judgement about which file is authoritative — it applies the existing one when
the states happen to match.
@brief An agreeing set cites the repository's own header.
@return None.
@version 1
"""
conn = _conn(
tmp_path,
[
("off", "configs/config-symmetric-only.h", "heuristic"),
("off", "include/mbedtls/mbedtls_config.h", "heuristic"),
("off", "tests/configs/config_test_driver.h", "heuristic"),
],
)
gate = _with_defaults(conn, (_gate(),))[0]
assert gate.default_state == "off", "the state was already right and must stay right"
assert "mbedtls_config.h" in gate.default_site, (
f"with every site agreeing, the citation must still be the repository's own shipped "
f"header rather than whichever path sorted first: {gate.default_site!r}"
)
Activity · 4 steps
test_the_shipped_config_settles_a_disagreement
None test_shipped_config_tiebreak.test_the_shipped_config_settles_a_disagreement(Path tmp_path)
The shipped config must settle a disagreement among guesses.
tests/test_shipped_config_tiebreak.py:96
Checks
assert gate.default_state == "off", (f"the shipped config says off and the gate reports {gate.default_state!r} — an agent " f"cannot tell which preprocessor branch is the default build" )assert "mbedtls_config.h" in gate.default_site, gate.default_site
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-QUERY-003 | measured | test_the_shipped_config_settles_a_disagreement → _with_defaults → table_exists |
| REQ-DDB-QUERY-004 | measured | test_the_shipped_config_settles_a_disagreement → _with_defaults → _in_default_build |
| REQ-DDB-QUERY-013 | measured | test_the_shipped_config_settles_a_disagreement → _with_defaults → decided_default |
Source · 27 lines
def test_the_shipped_config_settles_a_disagreement(tmp_path: Path) -> None:
"""THE REGRESSION, EXACTLY AS MEASURED: three heuristic rows, two saying on, the shipped one
saying off. Before this the gate came back with no default and an answer picked the wrong
branch.
@brief A disagreement resolves to the shipped state.
@return None.
@version 1
"""
conn = _conn(
tmp_path,
[
("on", "configs/ext/tfm_mbedcrypto_config_profile_medium.h", "heuristic"),
("off", "include/mbedtls/mbedtls_config.h", "heuristic"),
("on", "tests/configs/user-config-malloc-0-null.h", "heuristic"),
],
)
gate = _with_defaults(conn, (_gate(),))[0]
assert gate.default_state == "off", (
f"the shipped config says off and the gate reports {gate.default_state!r} — an agent "
f"cannot tell which preprocessor branch is the default build"
)
assert "mbedtls_config.h" in gate.default_site, gate.default_site