From 4f8f590b935ea27f8ae8afd78c363ef006fe40cd Mon Sep 17 00:00:00 2001 From: Marius Ciepluch <11855163+norandom@users.noreply.github.com> Date: Tue, 8 Sep 2026 15:01:08 +0200 Subject: [PATCH] fix(model-grounded-detection): type the config literals list mypy could not see that row["literals"] is a list on an object-valued dict. Narrowed at the use site rather than widened at the boundary. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01T7XD7x5KonMdmGRkp63EQG --- src/openultrasast/model/config_value.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/openultrasast/model/config_value.py b/src/openultrasast/model/config_value.py index f39c70a..1813327 100644 --- a/src/openultrasast/model/config_value.py +++ b/src/openultrasast/model/config_value.py @@ -28,7 +28,10 @@ def verdict(cpg: CpgResult, spec: ConfigSpec, *, function: str = "") -> Verdict permissive = {value.strip().strip("'\"").lower() for value in spec.permissive} for row in settings: - for literal in row["literals"]: + literals = row["literals"] + if not isinstance(literals, list): + continue + for literal in literals: if str(literal).strip().strip("'\"").lower() in permissive: return Verdict( rung=Rung.ENTAILED, @@ -37,7 +40,7 @@ def verdict(cpg: CpgResult, spec: ConfigSpec, *, function: str = "") -> Verdict ) # A setting whose value the model could not read. Not safe, not decided. - computed = [row for row in settings if not row["literals"]] + computed = [row for row in settings if not row["literals"]] # type: ignore[truthy-iterable] if computed: row = computed[0] return Verdict(