fix(inventory): preserve metadata list item names - #658
Merged
Conversation
Keep names returned by the API on inventory metadata entity links so SDK consumers and serialized results can use readable custom-field values without additional lookups. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Looks good - no bugs or correctness issues found. |
| from albert.resources.tagged_base import BaseTaggedResource | ||
| from albert.resources.tags import Tag | ||
|
|
||
| InventoryMetadataItem = ( |
Collaborator
There was a problem hiding this comment.
Do you think we can fix it at the shared MetadataItem level (EntityLinkWithName in types.py) instead of an inventory-specific alias (as long as we're not breaking existing functionality)? That would keep things consistent across collections and avoid duplicating a type.
From what I can tell, writes should be fine - PATCH already sends bare IDs, and create paths use exclude_none/exclude_unset, so id-only links still dump as {"id": "..."}. The change would mainly affect read/export, where preserving names seems desirable everywhere.
Preserve names from API metadata links consistently across SDK resources while keeping ID-only links compatible.
|
Looks good - no bugs or correctness issues found. |
prasad-albert
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Inventory metadata list values now preserve the names returned by the Albert API when inventory items are retrieved and serialized.
Why
The API already returns readable names for list-based custom-field values, but the SDK's
EntityLinkserialization excluded those names. This caused consumers such as the inventory data agent to receive only list-item IDs. This addresses AI-1336.How
InventoryItem.metadatastructure unchanged for callers.Testing
uv --directory albert-python run ruff format src/albert/resources/inventory.py tests/collections/test_inventory.pyuv --directory albert-python run ruff check src/albert/resources/inventory.py tests/collections/test_inventory.py-n 4: passed.Made with Cursor