From 20123a8abc469256efc2cc3b8f0b0a7d54b433bf Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 24 Jul 2026 16:56:08 +0000 Subject: [PATCH] Fix test_undefined_slot_raises: only swallow missing-parent-class errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The broad except (ValueError, KeyError) from the NWB Container fix was also catching "No such slot: X" errors, causing test_undefined_slot_raises to stop raising as expected. Now re-raises any error whose message does not contain "No such class" — which covers missing slot references, invalid ranges, etc. Only errors from is_a pointing to a class outside the submitted schema (e.g. NWB's NWBContainer → Container) are silently tolerated. Co-Authored-By: Claude Sonnet 4.6 Claude-Session: https://claude.ai/code/session_01EXeTeJsXisxTRXay6EoBSQ --- neuro_ghost/ingest_linkml.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/neuro_ghost/ingest_linkml.py b/neuro_ghost/ingest_linkml.py index fab86d7..3551c2a 100644 --- a/neuro_ghost/ingest_linkml.py +++ b/neuro_ghost/ingest_linkml.py @@ -252,9 +252,13 @@ def parse_linkml(path: Path) -> dict[str, Any]: try: induced_slots = sv.class_induced_slots(cls_name) - except (ValueError, KeyError): - # is_a points to a class outside this schema (e.g. NWB's "Container") - # Fall back to directly-declared slots only. + except (ValueError, KeyError) as exc: + msg = str(exc) + # Only tolerate "No such class" — that means is_a points outside + # this schema (e.g. NWB's NWBContainer → Container). A missing + # slot is a genuine schema error; re-raise so the caller sees it. + if "No such class" not in msg: + raise induced_slots = list(cls_def.attributes.values()) for sname in (cls_def.slots or []): try: