You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Found live while running OSHConnectBroker-Py against a fleet node whose disk was full (every POST returned HTTP 500) — vendored wheel from the nats-mode-fix branch.
System.insert_self() (resources/system.py) only assigns self._resource_id when res.ok; on a non-ok response it neither raises nor records the failure. Callers like Node.add_system(insert_resource=True) then return normally, so the caller believes the system was inserted. The failure finally surfaces far away as:
AttributeError: 'System' object has no attribute '_resource_id'
e.g. in System.add_insert_datastream() (parent_res_id=self._resource_id) — with no hint of the original HTTP error. Note _resource_id is only created in __init__ when a resource_id kwarg is passed, so a from_resource()-built System doesn't even have the attribute set to None — any pre-insert access is an AttributeError rather than a clean is None check.
Suggested fix (either or both):
insert_self() raises (or at minimum logs at error level and sets a failed flag) when res.ok is false, including status code and response text.
Initialize self._resource_id = None unconditionally in __init__ so downstream code can do a clean None check instead of dying on AttributeError.
Repro: point add_system(insert_resource=True) at any node that rejects the POST (500/4xx) and then call add_insert_datastream() on the returned System.
Two more manifestations of this bug family found during downstream E2E (OSHConnectBroker-Py#13): (a) System.from_resource() / discovery never populates _resource_id even though the parsed SystemResource carries system_id — every get_id() on a discovered system raises AttributeError; (b) control streams discovered via System.discover_controlstreams() lack their parent system id, so NATS subject construction fails with 'parent system id is unresolved' until the caller manually invokes set_parent_resource_id(). Downstream worked around both (_safe_id fallback + explicit parent set on adoption), but wrapper hydration on discovery would fix the whole class.
Activity
tipatterson-dev commentedon Jul 28, 2026
Two more manifestations of this bug family found during downstream E2E (OSHConnectBroker-Py#13): (a)
System.from_resource()/ discovery never populates_resource_ideven though the parsed SystemResource carriessystem_id— everyget_id()on a discovered system raises AttributeError; (b) control streams discovered viaSystem.discover_controlstreams()lack their parent system id, so NATS subject construction fails with 'parent system id is unresolved' until the caller manually invokesset_parent_resource_id(). Downstream worked around both (_safe_idfallback + explicit parent set on adoption), but wrapper hydration on discovery would fix the whole class.