Skip to content

fix: device material check after restart; PLR materials in action results - #396

Merged
Xuwznln merged 3 commits into
devfrom
fix/testlab-restart-gaps
Nov 25, 2026
Merged

Xuwznln merged 3 commits into
devfrom
fix/testlab-restart-gaps

Conversation

@Xuwznln

@Xuwznln Xuwznln commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Two core gaps found while running the TestLab station on dev.

  1. Restart put devices holding a preset carrier into maintenance. On a restart with an existing database, Host checks each device material's config.type (require_plr_config_type → find_plr_resource_class) before any material tree is rebuilt. The lookup only sees already-imported classes; its registry fallback imports the module of the registry entry (e.g. pkg.resources.warehouses). A driver-package factory that imports the class it returns inside the function body (here the core preset BottleCarrier) leaves the class invisible after that import, so the device went into maintenance (TestLab: 6 process devices). A fresh database does not hit it because building the graph calls the factory. The built-in preset modules are registered in plr_additional_res_reg, but register() only ran later in to_plr_resources. find_plr_resource_class now calls register() first, so packages no longer need a module-level import as a workaround. The regression test reproduces it in a fresh interpreter with a lazily importing factory; it fails on dev and passes here.
  2. PLR instances in action results. ResultInfoEncoder serialised a returned PLR resource through __dict__. A PLR material with an authority uuid is now returned as {"uuid": ...}, the same shape as a ResourceSlot result, so drivers do not have to convert it themselves.

TestLab on dev + this branch: fresh DB two runs, restart, single run, both workflows concurrently — all 25/25, zero cross-task overlap per device, inventory consistent across restarts. Host-like probe (registry built as the station does): dev + the package without its module-level import → class not found; this branch → found.

@Xuwznln
Xuwznln merged commit 2e2cc49 into dev Nov 25, 2026
9 of 10 checks passed
@Xuwznln
Xuwznln deleted the fix/testlab-restart-gaps branch November 27, 2026 13:10
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