feat(fase2): feed debate converged output into candidate generation
This commit is contained in:
parent
7573c4439f
commit
1694141bff
2 changed files with 67 additions and 4 deletions
|
|
@ -138,6 +138,37 @@ async def test_wiring_budget_middleware_and_retrieval_tool(
|
|||
assert any(isinstance(t, FunctionTool) for t in tools)
|
||||
|
||||
|
||||
async def test_g_validated_proposal_derives_from_debate(
|
||||
docs_dir, make_client_factory, fresh_store, monkeypatch
|
||||
) -> None:
|
||||
"""F1: the candidate fed to generation derives from the DEBATE, not just retrieval. Spy
|
||||
the context passed to generate_via_llm; the proposer's converged output ('Reduce scope',
|
||||
present in _VALID but NOT in the docs_dir fixture) must reach generation. Deleting the
|
||||
debate->generation wiring makes this fail."""
|
||||
from portfolio_optimiser import run as run_mod
|
||||
|
||||
captured: dict[str, str] = {}
|
||||
real_generate = run_mod.generate_via_llm
|
||||
|
||||
async def spy_generate(chat_client, project, context, meter, **kw):
|
||||
captured["context"] = context
|
||||
return await real_generate(chat_client, project, context, meter, **kw)
|
||||
|
||||
monkeypatch.setattr(run_mod, "generate_via_llm", spy_generate)
|
||||
result = await run_project(
|
||||
"FV42-GSV-E1",
|
||||
"local",
|
||||
docs_dir=docs_dir,
|
||||
verdict_input=_VI,
|
||||
client_factory=make_client_factory(_VALID),
|
||||
store=fresh_store,
|
||||
)
|
||||
debate_marker = "Reduce scope" # in _VALID (proposer output); NOT in docs_dir
|
||||
assert result.debate_output and debate_marker in result.debate_output
|
||||
assert debate_marker in captured["context"] # debate output reached generation
|
||||
assert isinstance(result.outcome, ValidatedProposal)
|
||||
|
||||
|
||||
async def test_f_malformed_contract_raises_before_any_chat(docs_dir, make_client_factory) -> None:
|
||||
calls = {"n": 0}
|
||||
base = make_client_factory(_VALID)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue