Skip to content

Refactor asset detail retrieval for unified model support#94

Merged
rhythmatician merged 4 commits intomasterfrom
bolster-quick-collection
Jan 6, 2026
Merged

Refactor asset detail retrieval for unified model support#94
rhythmatician merged 4 commits intomasterfrom
bolster-quick-collection

Conversation

@rhythmatician
Copy link
Collaborator

Enhance asset detail retrieval to support a unified model for both standard and client-specific queries. Update comments to clarify model relationships in asset retrieval.

Copilot AI review requested due to automatic review settings January 5, 2026 21:34
@rhythmatician rhythmatician force-pushed the bolster-quick-collection branch from 737a6f2 to 3c351a9 Compare January 5, 2026 21:35
@rhythmatician rhythmatician enabled auto-merge (rebase) January 5, 2026 21:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors asset detail retrieval to support a unified model (AssetToClientAssetManagerResponseModel) for both standard and client-specific asset queries. The changes enhance documentation to clarify the model relationship and add error logging for cleanup failures.

Key changes:

  • Updated return type documentation for get_details() methods to explain the safe cast from AssetToAssetManageResponseModel to AssetToClientAssetManagerResponseModel
  • Added comprehensive inline comments explaining why the type cast is safe (superset relationship with 8 additional optional fields)
  • Added error logging in async cleanup path to match existing sync implementation

Copy link
Contributor

Copilot AI commented Jan 5, 2026

@rhythmatician I've opened a new pull request, #95, to work on those changes. Once the pull request is ready, I'll request review from you.

)

* Initial plan

* Add client_company_id parameter to AsyncQuickCollection.get_details

Co-authored-by: rhythmatician <75549255+rhythmatician@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rhythmatician <75549255+rhythmatician@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

src/qualer_sdk/quick_collection.py:222

  • The new client_company_id parameter introduced in both sync and async get_details methods lacks test coverage. The existing unit tests in test_asset_collection.py only stub get_asset_manager_list but don't cover the new branching logic that calls get_asset_manager_list_get_2 when client_company_id is provided. Tests should be added to verify both the standard path (client_company_id=None) and the client-specific path (client_company_id provided).
        if not client_company_id:
            # Cast standard assets to client model (superset type). Safe because:
            # 1. AssetToClientAssetManagerResponseModel has all fields from AssetToAssetManageResponseModel
            # 2. Additional client-specific fields are optional and will be None
            # 3. Both models parse the same base asset JSON structure
            result = get_asset_manager_list.sync(
                client=self.client,
                model_filter_type=FilterType.COLLECTED_ASSETS,
                model_search_string=search_string,
                model_page=page,
                model_page_size=page_size,
            )
            return cast(list[AssetToClientAssetManagerResponseModel], result or [])
        else:
            return (
                get_asset_manager_list_get_2.sync(
                    client_company_id=client_company_id,
                    client=self.client,
                    query_filter_type=AssetFilterType.CLIENT_ASSETS_COLLECTED,
                    query_search_string=search_string,
                    query_page=page,
                    query_page_size=page_size,
                )
                or []
            )

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@rhythmatician rhythmatician merged commit ef6234f into master Jan 6, 2026
14 checks passed
@rhythmatician rhythmatician deleted the bolster-quick-collection branch January 6, 2026 00:07
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.

3 participants