feat(fase1): hard/soft goal-stop in run_portfolio on accumulated ledger (F1)

This commit is contained in:
Kjell Tore Guttormsen 2026-07-07 08:11:43 +02:00
commit 16b6d80b82
4 changed files with 270 additions and 6 deletions

View file

@ -74,6 +74,23 @@ async def test_a_fanout_returns_one_runresult_per_project(
assert all(r.provenance.token_usage > 0 for r in result.runs)
async def test_a1_default_no_goal_leaves_stop_fields_unset(
make_portfolio_client_factory, fresh_store
) -> None:
"""Step 8 regression: with no ``goals``/``ledger`` the pass is unchanged — ``stopped_early`` is
False and ``stop_reason`` is None, and every project still runs (the new frozen fields default,
so the default path is byte-for-byte the prior behavior)."""
result = await run_portfolio(
_PORTFOLIO_IDS,
"local",
store=fresh_store,
client_factory=make_portfolio_client_factory(REPLIES),
)
assert result.stopped_early is False
assert result.stop_reason is None
assert len(result.runs) == 3
async def test_a2_unknown_project_id_raises(make_portfolio_client_factory, fresh_store) -> None:
"""The unknown-id error path: an id absent from the loaded portfolio raises ValueError."""
with pytest.raises(ValueError):