Refactor asset detail retrieval for unified model support#94
Merged
rhythmatician merged 4 commits intomasterfrom Jan 6, 2026
Merged
Refactor asset detail retrieval for unified model support#94rhythmatician merged 4 commits intomasterfrom
rhythmatician merged 4 commits intomasterfrom
Conversation
… standard and client-specific queries
737a6f2 to
3c351a9
Compare
Contributor
There was a problem hiding this comment.
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 fromAssetToAssetManageResponseModeltoAssetToClientAssetManagerResponseModel - 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
Contributor
|
@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>
Contributor
There was a problem hiding this comment.
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_idparameter introduced in both sync and asyncget_detailsmethods lacks test coverage. The existing unit tests intest_asset_collection.pyonly stubget_asset_manager_listbut don't cover the new branching logic that callsget_asset_manager_list_get_2whenclient_company_idis 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 []
)
…gerResponseModel for consistency
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.
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.