Skip to content

Make assign_asset report only an assignment that holds - #35

Merged
nickschuetz merged 1 commit into
mainfrom
fix/assign-asset
Oct 9, 2026
Merged

nickschuetz merged 1 commit into
mainfrom
fix/assign-asset

Conversation

@nickschuetz

Copy link
Copy Markdown
Owner

What

assign_asset could report success for an assignment that never happened:

  • It printed "Assigned" without checking the result of SetComponentProperty, then fell back to a SetComponentProperty addressed by entity id over bus.Event. That doesn't match the reflected call, and it also "succeeded".
  • It used azlmbr.math.Uuid() without importing azlmbr.math. That dropped it into a two-argument GetAssetIdByPath that does not match the reflected three-argument signature.
  • It treated an unknown asset path as found, because the catalog answers an invalid AssetId, not None.
  • It passed the asset id as text rather than the AssetId.

Now

  1. Resolve the asset with the reflected three-argument GetAssetIdByPath and check is_valid(). An unknown path is asset_not_found, with a hint to pass the product path.
  2. Find the component: an unknown type is component_type_not_found, and one not on the entity is component_not_on_entity.
  3. Set the property with the AssetId and check the outcome: set_property_failed.
  4. Read the property back before reporting success: assign_asset_failed if it did not stick.

Tests

  • Surface: each failure and the read-back success.
  • Live (full suite 56 of 56, run together with the other pending fixes): assigning the engine's ground-plane mesh to a Mesh component reads back and succeeds, and an unknown asset is asset_not_found.

assign_asset printed "Assigned" without checking the result, then fell back
to SetComponentProperty addressed by entity id over bus.Event, which also
"succeeded". It also used azlmbr.math.Uuid() without importing azlmbr.math
(dropping into a two-argument call that does not match the reflected
signature), treated an unknown asset path as found because the catalog
answers an invalid AssetId rather than None, and passed the id as text.

It now resolves the asset with the reflected three-argument
GetAssetIdByPath and checks is_valid(), finds the component (an unknown type
or one not on the entity is its own error), sets the property with the
AssetId and checks the outcome, and reads the property back before reporting
success. Failures are asset_not_found, component_type_not_found,
component_not_on_entity, set_property_failed and assign_asset_failed.

Surface tests cover each failure and the read-back success; a live test
assigns the engine's ground-plane mesh and refuses an unknown asset.
@nickschuetz
nickschuetz merged commit 52cc9f8 into main Oct 9, 2026
11 checks passed
@nickschuetz
nickschuetz deleted the fix/assign-asset branch October 9, 2026 13:49
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