fix(semantic-scene): preserve page/intents when all widgets are dangling, drop dead exception-name set

- _with_known_widgets_only used to discard the entire SemanticScene
  (returning None) when filtering dangling-element-id widgets left an
  empty list, losing valid page/intents. Now returns a SemanticScene
  with widgets=[] instead, matching design.md's 'dropped, not a hard
  failure' intent.
- Removed _SDK_UNAVAILABLE_EXCEPTION_NAMES, dead code left over from an
  abandoned name-based exception-matching approach; the blanket except
  Exception already maps every SDK failure correctly.

openspec: semantic-scene capability, archived change semantic-scene-runtime
This commit is contained in:
2026-07-07 08:31:03 +08:00
parent 725bf4cd9c
commit ca5e300289
3 changed files with 6 additions and 13 deletions
+5 -2
View File
@@ -123,7 +123,7 @@ def test_enrich_scene_filters_dangling_element_ids() -> None:
]
def test_enrich_scene_returns_none_when_all_widgets_are_dangling() -> None:
def test_enrich_scene_returns_empty_widgets_when_all_widgets_are_dangling() -> None:
client = FakeClient(
response={
"page": "Chat",
@@ -138,4 +138,7 @@ def test_enrich_scene_returns_none_when_all_widgets_are_dangling() -> None:
config=SemanticConfig(enabled=True),
)
assert result is None
assert result is not None
assert result.page == "Chat"
assert result.intents == ["send a message"]
assert result.widgets == []