From 41f96330fd0f4e4020626dedc6e97ec56b9098dc Mon Sep 17 00:00:00 2001 From: team3 Date: Tue, 7 Jul 2026 01:07:10 +0200 Subject: [PATCH] update --- backend/block_calls.py | 4 +++- backend/tests/test_block_calls.py | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/backend/block_calls.py b/backend/block_calls.py index 2deb6d3..1b7c1cf 100644 --- a/backend/block_calls.py +++ b/backend/block_calls.py @@ -508,7 +508,9 @@ async def _verify_block(ctx: GenContext, files: dict, title: str, gen: dict, q: if vorhanden is not None: # Korrektur: Facts ersetzen, Einstufung bleibt vorhanden["facts"] = _fk_of(e) bfacts[sn] = vorhanden["facts"] - else: # Lücken-Fund: neuer consensus-Sub + elif not keep_all: # Lücken-Fund: neuer consensus-Sub + # (Bottom-up unterdrückt das: die Subs stehen fest, der Fix-Call darf keine + # neuen einschleusen — sonst wächst die Sub-Zahl über die Board-1-Atome hinaus) bfacts[sn] = _fk_of(e) keep.append(e["title"]) sidecar_subs.append({"title": e["title"], diff --git a/backend/tests/test_block_calls.py b/backend/tests/test_block_calls.py index 8137dfc..fa00d67 100644 --- a/backend/tests/test_block_calls.py +++ b/backend/tests/test_block_calls.py @@ -270,7 +270,10 @@ async def test_verify_keep_all_behaelt_alle_atome(env, monkeypatch): db, ctx, files = env subs = ["Sub A", "Sub B", "Sub C"] await _seed_rows(db, "alpha", subs) - fix = {"subs": [_sub("Sub A", kp=["korrigiert"])]} + # Fix-Call liefert die Korrektur für Sub A UND einen belegten NEUEN Fund — der darf + # bei keep_all NICHT als Sub eingeschleust werden (Sub-Zahl bleibt bei den Board-1-Atomen). + fix = {"subs": [_sub("Sub A", kp=["korrigiert"]), + _sub("Extra Fund", kp=["belegt"], cf=[{"text": "x", "source": "s"}])]} verdikt = {"fremd": [3], "gruppen": [{"haupt": 1, "weitere": [2]}], "facts_probleme": [{"nr": 1, "discard": True, "hinweis": "Zahl falsch"}, {"nr": 2, "discard": True}], @@ -278,9 +281,10 @@ async def test_verify_keep_all_behaelt_alle_atome(env, monkeypatch): fake = _judge_slot({"1": verdikt, "2": verdikt}, fix=fix) monkeypatch.setattr(bc, "run_single_slot", fake) res = await bc._verify_block(ctx, files, "Alpha", _gen_von("Alpha", subs), {}, keep_all=True) - assert res["raw"] == {"Alpha": subs} # alle drei bleiben — nichts entfernt/gefaltet + assert res["raw"] == {"Alpha": subs} # exakt die drei Atome — nichts entfernt, nichts neu rows = {r["sub_norm"]: r["status"] for r in await db.list_subblocks(TOPIC, "alpha")} assert all(rows[_norm_title(s)] == "consensus" for s in subs) + assert "extra fund" not in rows # der Fix-Neuzugang wurde unterdrückt side = {s["title"]: s for s in res["sidecar"]["Alpha"]} assert side["Sub A"]["facts"]["key_points"] == ["korrigiert"] # Hinweis trotz discard=True assert side["Sub B"]["level"] == "expert" # Level-Korrektur greift