fix: address final review findings
- for_device(): suffix fallback for descriptive names
("french_door_refrigerator" → refrigerator registry)
- Capability.href_prefix: replaces rt_filter for pattern caps;
DOOR_GENERIC now uses href_prefix='/door/' (batch reps have no rt)
- discover(): apply href_prefix gate before rt_filter in pattern loop
- Remove dead bound_hrefs variable from discover()
- Remove vestigial default_observe_port from RuntimeDescriptor
This commit is contained in:
1 parent
6f681622c2
commit
1c4cb2e272
8 files changed
+26
-11
No files matched your search
@@ -37,7 +37,6 @@ def discover(
|
||||
log: Optional[Callable[[str], None]] = None,
|
||||
) -> list[BoundEntity]:
|
||||
out: list[BoundEntity] = []
|
||||
bound_hrefs: set[str] = set()
|
||||
|
||||
for href, rep in resources.items():
|
||||
if not isinstance(rep, dict):
|
||||
@@ -58,11 +57,12 @@ def discover(
|
||||
matched = True
|
||||
|
||||
if matched:
|
||||
bound_hrefs.add(href)
|
||||
continue
|
||||
|
||||
# Pattern cap fallback — first matching pattern wins
|
||||
for cap in pattern_caps:
|
||||
if cap.href_prefix and not href.startswith(cap.href_prefix):
|
||||
continue
|
||||
if cap.rt_filter is not None and cap.rt_filter not in rts:
|
||||
continue
|
||||
if cap.match_fn is not None and not cap.match_fn(rep, resources):
|
||||
|
||||
Reference in new issue
Block a user