test: neutral names for the reference path and the office-IT baseline
Rename the reference-project helpers and test names (_reference_k, test_reference_path_*) and the cost-baseline helper (_kontor_it_baseline, which already returned KONTOR-IT-E1). Names only; no assertion changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
11faf6ef56
commit
9cdbd57cf6
8 changed files with 25 additions and 22 deletions
|
|
@ -137,7 +137,7 @@ async def test_provenance_records_an_anchored_bundle_run(fresh_store) -> None:
|
||||||
assert result.provenance.cost_baseline_anchored is True
|
assert result.provenance.cost_baseline_anchored is True
|
||||||
|
|
||||||
|
|
||||||
async def test_road_path_is_anchored_by_construction(docs_dir, fresh_store) -> None:
|
async def test_reference_path_is_anchored_by_construction(docs_dir, fresh_store) -> None:
|
||||||
"""The reference path derives its baseline from the reference project's own ``cost_items``, so it is
|
"""The reference path derives its baseline from the reference project's own ``cost_items``, so it is
|
||||||
ALWAYS anchored — the stamp says so rather than leaving the reader to know it."""
|
ALWAYS anchored — the stamp says so rather than leaving the reader to know it."""
|
||||||
result = await run_project(
|
result = await run_project(
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,7 @@ async def test_the_run_stamps_which_source_answered_and_completes(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def test_the_road_path_stamps_no_bundle_identity_at_all(
|
async def test_the_reference_path_stamps_no_bundle_identity_at_all(
|
||||||
docs_dir: Any, fresh_store: Any
|
docs_dir: Any, fresh_store: Any
|
||||||
) -> None:
|
) -> None:
|
||||||
"""(e, control) A run with no knowledge base has no bundle identity, and says so by ABSENCE
|
"""(e, control) A run with no knowledge base has no bundle identity, and says so by ABSENCE
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ def test_neither_flag_is_still_refused_by_name(capsys: pytest.CaptureFixture[str
|
||||||
assert "run refused" in err and "--docs-dir" in err and "--bundle-dir" in err
|
assert "run refused" in err and "--docs-dir" in err and "--bundle-dir" in err
|
||||||
|
|
||||||
|
|
||||||
def test_the_road_path_still_requires_a_real_docs_dir(
|
def test_the_reference_path_still_requires_a_real_docs_dir(
|
||||||
tmp_path: Path, capsys: pytest.CaptureFixture[str]
|
tmp_path: Path, capsys: pytest.CaptureFixture[str]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""(d) The anti-omvei arm. With no bundle, ``--docs-dir`` is still the only door AND it is
|
"""(d) The anti-omvei arm. With no bundle, ``--docs-dir`` is still the only door AND it is
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,7 @@ async def test_run_result_carries_the_trace(tmp_path, fresh_store) -> None:
|
||||||
assert [s.target for s in result.skipped_links] == [_DANGLING]
|
assert [s.target for s in result.skipped_links] == [_DANGLING]
|
||||||
|
|
||||||
|
|
||||||
async def test_road_path_has_an_empty_trace(docs_dir, fresh_store) -> None:
|
async def test_reference_path_has_an_empty_trace(docs_dir, fresh_store) -> None:
|
||||||
"""The reference path navigates no bundle, so "nothing was skipped" is literally true there — which
|
"""The reference path navigates no bundle, so "nothing was skipped" is literally true there — which
|
||||||
is exactly why the empty tuple is an honest DEFAULT rather than a withheld fact."""
|
is exactly why the empty tuple is an honest DEFAULT rather than a withheld fact."""
|
||||||
result = await run_project(
|
result = await run_project(
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ from test_portfolio import REPLIES
|
||||||
from test_portfolio_learning_loadbearing import (
|
from test_portfolio_learning_loadbearing import (
|
||||||
_ALIGNED_REPLY,
|
_ALIGNED_REPLY,
|
||||||
_bundle_kplus1,
|
_bundle_kplus1,
|
||||||
_road_k,
|
_reference_k,
|
||||||
)
|
)
|
||||||
|
|
||||||
from portfolio_optimiser import ledger as ledger_mod
|
from portfolio_optimiser import ledger as ledger_mod
|
||||||
|
|
@ -797,7 +797,7 @@ async def test_intra_wave_visibility_is_the_documented_semantic_difference(
|
||||||
# rebuilt fixture would present as "the sentinel stopped arriving", i.e. as the very semantic
|
# rebuilt fixture would present as "the sentinel stopped arriving", i.e. as the very semantic
|
||||||
# difference this test claims to measure. The ``failures`` assertions below exist so that
|
# difference this test claims to measure. The ``failures`` assertions below exist so that
|
||||||
# confusion can never happen silently again.
|
# confusion can never happen silently again.
|
||||||
pair = (_road_k(tmp_path, rationale=sentinel), _bundle_kplus1(tmp_path))
|
pair = (_reference_k(tmp_path, rationale=sentinel), _bundle_kplus1(tmp_path))
|
||||||
monkeypatch.setattr("portfolio_optimiser.run.load_reference_projects", lambda: pair)
|
monkeypatch.setattr("portfolio_optimiser.run.load_reference_projects", lambda: pair)
|
||||||
|
|
||||||
# k=1 — two waves. The control: the cross-project fold fires and the sentinel arrives.
|
# k=1 — two waves. The control: the cross-project fold fires and the sentinel arrives.
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ def _make_docs(tmp_path, name: str) -> str:
|
||||||
return str(d)
|
return str(d)
|
||||||
|
|
||||||
|
|
||||||
def _road_k(tmp_path, *, rationale: str) -> Project:
|
def _reference_k(tmp_path, *, rationale: str) -> Project:
|
||||||
return Project(
|
return Project(
|
||||||
id="REF-K",
|
id="REF-K",
|
||||||
name="Reference k",
|
name="Reference k",
|
||||||
|
|
@ -92,7 +92,7 @@ async def test_verdict_on_k_reaches_kplus1_hypothesis_prompt(
|
||||||
*k+1*'s hypothesis-generation prompt (both the sentinel rationale and *k*'s verdict id, via the
|
*k+1*'s hypothesis-generation prompt (both the sentinel rationale and *k*'s verdict id, via the
|
||||||
ExpeL few-shot). Detach ``bundle_dir=project.bundle_dir`` at run.py:496 → *k+1* runs the reference
|
ExpeL few-shot). Detach ``bundle_dir=project.bundle_dir`` at run.py:496 → *k+1* runs the reference
|
||||||
path → the Step-1 fold is skipped → the sentinel never arrives → RED."""
|
path → the Step-1 fold is skipped → the sentinel never arrives → RED."""
|
||||||
k = _road_k(tmp_path, rationale=_SENTINEL)
|
k = _reference_k(tmp_path, rationale=_SENTINEL)
|
||||||
kplus1 = _bundle_kplus1(tmp_path)
|
kplus1 = _bundle_kplus1(tmp_path)
|
||||||
monkeypatch.setattr("portfolio_optimiser.run.load_reference_projects", lambda: (k, kplus1))
|
monkeypatch.setattr("portfolio_optimiser.run.load_reference_projects", lambda: (k, kplus1))
|
||||||
factory, recorded = make_recording_client_factory(_ALIGNED_REPLY)
|
factory, recorded = make_recording_client_factory(_ALIGNED_REPLY)
|
||||||
|
|
@ -120,7 +120,7 @@ async def test_kplus1_alone_against_fresh_store_carries_no_signal(
|
||||||
"""T-2.0b CAUSALITY CONTROL: running ONLY *k+1* against a fresh (empty) store carries the
|
"""T-2.0b CAUSALITY CONTROL: running ONLY *k+1* against a fresh (empty) store carries the
|
||||||
sentinel into NO prompt — proving the signal in T-2.0a is caused by the threaded store, not
|
sentinel into NO prompt — proving the signal in T-2.0a is caused by the threaded store, not
|
||||||
incidental to the fixture (makes the positive test genuinely load-bearing)."""
|
incidental to the fixture (makes the positive test genuinely load-bearing)."""
|
||||||
k = _road_k(tmp_path, rationale=_SENTINEL)
|
k = _reference_k(tmp_path, rationale=_SENTINEL)
|
||||||
kplus1 = _bundle_kplus1(tmp_path)
|
kplus1 = _bundle_kplus1(tmp_path)
|
||||||
monkeypatch.setattr("portfolio_optimiser.run.load_reference_projects", lambda: (k, kplus1))
|
monkeypatch.setattr("portfolio_optimiser.run.load_reference_projects", lambda: (k, kplus1))
|
||||||
factory, recorded = make_recording_client_factory(_ALIGNED_REPLY)
|
factory, recorded = make_recording_client_factory(_ALIGNED_REPLY)
|
||||||
|
|
@ -158,7 +158,7 @@ async def test_dropped_verdict_in_kplus1_inbox_reaches_store(
|
||||||
)
|
)
|
||||||
write_verdict(str(inbox), dropped)
|
write_verdict(str(inbox), dropped)
|
||||||
|
|
||||||
k = _road_k(tmp_path, rationale=_SENTINEL)
|
k = _reference_k(tmp_path, rationale=_SENTINEL)
|
||||||
kplus1 = _bundle_kplus1(tmp_path, verdict_dir=str(inbox))
|
kplus1 = _bundle_kplus1(tmp_path, verdict_dir=str(inbox))
|
||||||
monkeypatch.setattr("portfolio_optimiser.run.load_reference_projects", lambda: (k, kplus1))
|
monkeypatch.setattr("portfolio_optimiser.run.load_reference_projects", lambda: (k, kplus1))
|
||||||
factory, _recorded = make_recording_client_factory(_ALIGNED_REPLY)
|
factory, _recorded = make_recording_client_factory(_ALIGNED_REPLY)
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ _FAKE_UNIT_COST = 10_000_000.0
|
||||||
_FAKE_CLAIM = 3_000_000.0
|
_FAKE_CLAIM = 3_000_000.0
|
||||||
|
|
||||||
|
|
||||||
def _fv42_baseline() -> CostBaseline:
|
def _kontor_it_baseline() -> CostBaseline:
|
||||||
return baseline_from_project(
|
return baseline_from_project(
|
||||||
next(p for p in load_reference_projects() if p.id == "KONTOR-IT-E1")
|
next(p for p in load_reference_projects() if p.id == "KONTOR-IT-E1")
|
||||||
)
|
)
|
||||||
|
|
@ -83,7 +83,7 @@ def test_fabricated_cost_code_is_rejected() -> None:
|
||||||
rejected, even though its own arithmetic clears the LP/P90/nominal stages. Detach the
|
rejected, even though its own arithmetic clears the LP/P90/nominal stages. Detach the
|
||||||
reconciliation stage and the SAME proposal validates."""
|
reconciliation stage and the SAME proposal validates."""
|
||||||
result = validate_proposal(
|
result = validate_proposal(
|
||||||
_proposal(_FAKE_CODE, 1.0, _FAKE_UNIT_COST, _FAKE_CLAIM), baseline=_fv42_baseline()
|
_proposal(_FAKE_CODE, 1.0, _FAKE_UNIT_COST, _FAKE_CLAIM), baseline=_kontor_it_baseline()
|
||||||
)
|
)
|
||||||
assert isinstance(result, Rejection), "a hallucinated cost code must never reach validated"
|
assert isinstance(result, Rejection), "a hallucinated cost code must never reach validated"
|
||||||
assert "unknown cost code" in result.reason
|
assert "unknown cost code" in result.reason
|
||||||
|
|
@ -95,7 +95,8 @@ def test_real_baseline_line_still_validates() -> None:
|
||||||
rejection above is caused by the code being absent from the baseline, not by the new stage
|
rejection above is caused by the code being absent from the baseline, not by the new stage
|
||||||
rejecting everything."""
|
rejecting everything."""
|
||||||
result = validate_proposal(
|
result = validate_proposal(
|
||||||
_proposal(_REAL_CODE, _REAL_QTY, _REAL_UNIT_COST, _REAL_CLAIM), baseline=_fv42_baseline()
|
_proposal(_REAL_CODE, _REAL_QTY, _REAL_UNIT_COST, _REAL_CLAIM),
|
||||||
|
baseline=_kontor_it_baseline(),
|
||||||
)
|
)
|
||||||
assert isinstance(result, ValidatedProposal)
|
assert isinstance(result, ValidatedProposal)
|
||||||
|
|
||||||
|
|
@ -117,7 +118,7 @@ def test_inflated_unit_cost_on_a_real_code_is_rejected() -> None:
|
||||||
line then validates, because the code itself is genuine."""
|
line then validates, because the code itself is genuine."""
|
||||||
inflated = _REAL_UNIT_COST * 1.20
|
inflated = _REAL_UNIT_COST * 1.20
|
||||||
result = validate_proposal(
|
result = validate_proposal(
|
||||||
_proposal(_REAL_CODE, _REAL_QTY, inflated, _REAL_CLAIM), baseline=_fv42_baseline()
|
_proposal(_REAL_CODE, _REAL_QTY, inflated, _REAL_CLAIM), baseline=_kontor_it_baseline()
|
||||||
)
|
)
|
||||||
assert isinstance(result, Rejection)
|
assert isinstance(result, Rejection)
|
||||||
assert "unit_cost" in result.reason and _REAL_CODE in result.reason
|
assert "unit_cost" in result.reason and _REAL_CODE in result.reason
|
||||||
|
|
@ -127,7 +128,7 @@ def test_inflated_quantity_on_a_real_code_is_rejected() -> None:
|
||||||
"""RED: the same for quantity — a real code at an invented quantity (+20%) is rejected."""
|
"""RED: the same for quantity — a real code at an invented quantity (+20%) is rejected."""
|
||||||
result = validate_proposal(
|
result = validate_proposal(
|
||||||
_proposal(_REAL_CODE, _REAL_QTY * 1.20, _REAL_UNIT_COST, _REAL_CLAIM),
|
_proposal(_REAL_CODE, _REAL_QTY * 1.20, _REAL_UNIT_COST, _REAL_CLAIM),
|
||||||
baseline=_fv42_baseline(),
|
baseline=_kontor_it_baseline(),
|
||||||
)
|
)
|
||||||
assert isinstance(result, Rejection)
|
assert isinstance(result, Rejection)
|
||||||
assert "quantity" in result.reason
|
assert "quantity" in result.reason
|
||||||
|
|
@ -139,7 +140,7 @@ def test_within_tolerance_deviation_is_admitted() -> None:
|
||||||
at all."""
|
at all."""
|
||||||
result = validate_proposal(
|
result = validate_proposal(
|
||||||
_proposal(_REAL_CODE, _REAL_QTY, _REAL_UNIT_COST * 1.02, _REAL_CLAIM),
|
_proposal(_REAL_CODE, _REAL_QTY, _REAL_UNIT_COST * 1.02, _REAL_CLAIM),
|
||||||
baseline=_fv42_baseline(),
|
baseline=_kontor_it_baseline(),
|
||||||
)
|
)
|
||||||
assert isinstance(result, ValidatedProposal)
|
assert isinstance(result, ValidatedProposal)
|
||||||
|
|
||||||
|
|
@ -149,7 +150,7 @@ def test_tolerance_is_configurable() -> None:
|
||||||
caller-supplied tolerance."""
|
caller-supplied tolerance."""
|
||||||
result = validate_proposal(
|
result = validate_proposal(
|
||||||
_proposal(_REAL_CODE, _REAL_QTY, _REAL_UNIT_COST * 1.02, _REAL_CLAIM),
|
_proposal(_REAL_CODE, _REAL_QTY, _REAL_UNIT_COST * 1.02, _REAL_CLAIM),
|
||||||
baseline=_fv42_baseline(),
|
baseline=_kontor_it_baseline(),
|
||||||
tolerance=0.001,
|
tolerance=0.001,
|
||||||
)
|
)
|
||||||
assert isinstance(result, Rejection)
|
assert isinstance(result, Rejection)
|
||||||
|
|
@ -204,7 +205,9 @@ def _factory(reply: str):
|
||||||
return factory
|
return factory
|
||||||
|
|
||||||
|
|
||||||
async def test_road_path_anchors_the_gate_to_the_reference_baseline(docs_dir, fresh_store) -> None:
|
async def test_reference_path_anchors_the_gate_to_the_reference_baseline(
|
||||||
|
docs_dir, fresh_store
|
||||||
|
) -> None:
|
||||||
"""RED (reference wiring): a numerically-impeccable fabricated cost line is REJECTED end-to-end
|
"""RED (reference wiring): a numerically-impeccable fabricated cost line is REJECTED end-to-end
|
||||||
through ``run_project``. Detach the reference-path baseline (stop passing it) and the same run
|
through ``run_project``. Detach the reference-path baseline (stop passing it) and the same run
|
||||||
returns a ValidatedProposal."""
|
returns a ValidatedProposal."""
|
||||||
|
|
@ -220,7 +223,7 @@ async def test_road_path_anchors_the_gate_to_the_reference_baseline(docs_dir, fr
|
||||||
assert "unknown cost code" in result.outcome.reason
|
assert "unknown cost code" in result.outcome.reason
|
||||||
|
|
||||||
|
|
||||||
async def test_road_path_control_real_line_validates(docs_dir, fresh_store) -> None:
|
async def test_reference_path_control_real_line_validates(docs_dir, fresh_store) -> None:
|
||||||
"""Causality control for the reference wiring: the real 05.2 line validates through the same path."""
|
"""Causality control for the reference wiring: the real 05.2 line validates through the same path."""
|
||||||
result = await run_project(
|
result = await run_project(
|
||||||
"KONTOR-IT-E1",
|
"KONTOR-IT-E1",
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@ def _make_docs(tmp_path: Path, name: str) -> str:
|
||||||
return str(d)
|
return str(d)
|
||||||
|
|
||||||
|
|
||||||
def _road_k(tmp_path: Path, *, verdict_input: dict[str, str] | None) -> Project:
|
def _reference_k(tmp_path: Path, *, verdict_input: dict[str, str] | None) -> Project:
|
||||||
return Project(
|
return Project(
|
||||||
id="REF-K",
|
id="REF-K",
|
||||||
name="Reference k",
|
name="Reference k",
|
||||||
|
|
@ -275,7 +275,7 @@ async def test_a_given_verdict_on_k_does_reach_kplus1(
|
||||||
"""T4 CONTROL (mirrors ``test_portfolio_learning_loadbearing``): when an expert DID review
|
"""T4 CONTROL (mirrors ``test_portfolio_learning_loadbearing``): when an expert DID review
|
||||||
project *k*, that verdict reaches *k+1*'s hypothesis prompt. This is the event T5 denies —
|
project *k*, that verdict reaches *k+1*'s hypothesis prompt. This is the event T5 denies —
|
||||||
proving first that it can happen is what makes T5's negative assert mean anything."""
|
proving first that it can happen is what makes T5's negative assert mean anything."""
|
||||||
k = _road_k(tmp_path, verdict_input={"decision": "approved", "rationale": _SENTINEL})
|
k = _reference_k(tmp_path, verdict_input={"decision": "approved", "rationale": _SENTINEL})
|
||||||
kplus1 = _bundle_kplus1(tmp_path)
|
kplus1 = _bundle_kplus1(tmp_path)
|
||||||
monkeypatch.setattr("portfolio_optimiser.run.load_reference_projects", lambda: (k, kplus1))
|
monkeypatch.setattr("portfolio_optimiser.run.load_reference_projects", lambda: (k, kplus1))
|
||||||
factory, recorded = make_recording_client_factory(_ALIGNED_REPLY)
|
factory, recorded = make_recording_client_factory(_ALIGNED_REPLY)
|
||||||
|
|
@ -295,7 +295,7 @@ async def test_an_ungiven_verdict_on_k_never_reaches_kplus1(
|
||||||
prompt — no verdict is minted, none enters the shared store, and *k*'s candidate key never
|
prompt — no verdict is minted, none enters the shared store, and *k*'s candidate key never
|
||||||
shows up as a prior judgement. RED before the seam: *k* minted an ``approved`` verdict from a
|
shows up as a prior judgement. RED before the seam: *k* minted an ``approved`` verdict from a
|
||||||
``verdict_input`` no expert supplied, and the threaded store carried it forward."""
|
``verdict_input`` no expert supplied, and the threaded store carried it forward."""
|
||||||
k = _road_k(tmp_path, verdict_input=None)
|
k = _reference_k(tmp_path, verdict_input=None)
|
||||||
kplus1 = _bundle_kplus1(tmp_path)
|
kplus1 = _bundle_kplus1(tmp_path)
|
||||||
monkeypatch.setattr("portfolio_optimiser.run.load_reference_projects", lambda: (k, kplus1))
|
monkeypatch.setattr("portfolio_optimiser.run.load_reference_projects", lambda: (k, kplus1))
|
||||||
factory, recorded = make_recording_client_factory(_ALIGNED_REPLY)
|
factory, recorded = make_recording_client_factory(_ALIGNED_REPLY)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue