Skip to content

Fix offline flag forwarding and load subdevice trees from the OSW backend - #7

Merged
simontaurus merged 2 commits into
mainfrom
fix/offline-forwarding-and-components
Aug 5, 2026
Merged

Fix offline flag forwarding and load subdevice trees from the OSW backend#7
simontaurus merged 2 commits into
mainfrom
fix/offline-forwarding-and-components

Conversation

@simontaurus

Copy link
Copy Markdown
Contributor

fix: expose driver _offline flag on PostgREST controller

DataToolMixin._handle_data_change reads _offline from the archive database to
detect the online/offline transition, but the flag only existed on
PostgrestDatabaseDriver. The getattr always returned False, so
_on_archive_error() never fired and reset_opcua_connection_on_error was dead
code - a controller kept logging into the void while the database was unreachable.

Forwards _offline and _emulate_offline from the driver on both the v1 and v2
controllers.

feat: load subdevice tree from the OSW backend components relation

DataToolMixin.load_from_osw walks Tool.components and populates the
controller-only subdevices list, so get_all_channels(), get_channel_owner()
and archiving work across a whole device hierarchy loaded from the backend.

Component instance IRIs are read from __iris__ rather than the attribute, so the
lazy backend resolution (which would autofetch schemas and generate ad-hoc models)
is never triggered. Adds rebuild_channel_dict() to reindex channels after the
tree is wired, since subdevices are attached after __init__.

Tests

9 new tests. Full suite: 141 passed, 11 skipped.

_handle_data_change reads _offline from the archive database to detect the
online/offline transition, but the flag only existed on the driver, so
_on_archive_error never fired.
DataToolMixin.load_from_osw walks Tool.components and populates the
controller-only subdevices list. Component instance IRIs are read from
__iris__ so no schema is autofetched. Adds rebuild_channel_dict() to
reindex channels after the tree is wired.
@simontaurus
simontaurus merged commit 377c3f0 into main Aug 5, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant