Skip to content

fix(inventory): preserve metadata list item names - #658

Merged
albert-tb merged 2 commits into
mainfrom
tejas/ai-1336
Aug 5, 2026
Merged

fix(inventory): preserve metadata list item names#658
albert-tb merged 2 commits into
mainfrom
tejas/ai-1336

Conversation

@albert-tb

Copy link
Copy Markdown
Contributor

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 EntityLink serialization excluded those names. This caused consumers such as the inventory data agent to receive only list-item IDs. This addresses AI-1336.

How

  • Use an inventory-specific metadata type that accepts named links while remaining compatible with existing ID-only links.
  • Do not add extra list or custom-field API calls.
  • Keep the existing InventoryItem.metadata structure unchanged for callers.

Testing

  • uv --directory albert-python run ruff format src/albert/resources/inventory.py tests/collections/test_inventory.py
  • uv --directory albert-python run ruff check src/albert/resources/inventory.py tests/collections/test_inventory.py
  • Live integration test with -n 4: passed.

Made with Cursor

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>
@claude

claude Bot commented Aug 3, 2026

Copy link
Copy Markdown

Looks good - no bugs or correctness issues found.

Comment thread src/albert/resources/inventory.py Outdated
from albert.resources.tagged_base import BaseTaggedResource
from albert.resources.tags import Tag

InventoryMetadataItem = (

@prasad-albert prasad-albert Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call!

Preserve names from API metadata links consistently across SDK resources while keeping ID-only links compatible.
@claude

claude Bot commented Aug 4, 2026

Copy link
Copy Markdown

Looks good - no bugs or correctness issues found.

@albert-tb
albert-tb merged commit 98798c2 into main Aug 5, 2026
6 checks passed
@albert-tb
albert-tb deleted the tejas/ai-1336 branch August 5, 2026 14:39
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.

2 participants