fix(api): deprecate related.id in favour of related.ids#486
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the API ODM’s ECS Related model to deprecate related.id in favor of related.ids, while preserving backwards compatibility by copying a provided id into ids during model construction.
Changes:
- Mark
Related.idas deprecated with a migration hint to useRelated.ids. - Add
Related.__init__logic that mergesidintoids(avoiding duplicates). - Add unit tests validating
id→idsmigration, including propagation throughHitconstruction.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| api/howler/odm/models/ecs/related.py | Deprecates id and adds constructor-time migration from id to ids. |
| api/test/unit/odm/test_related.py | Adds unit tests for Related migration behavior and parent ODM propagation. |
Contributor
Howler API - Coverage ResultsDiff CoverageDiff: origin/main...HEAD, staged and unstaged changesNo lines with coverage information in this diff. Full Coverage ReportExpand |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
cccs-hxp
reviewed
Jul 14, 2026
| def __init__(self, data: dict = None, *args, **kwargs): | ||
| if data is not None and "id" in data and data["id"] is not None: | ||
| # Avoid mutating the caller-provided dict | ||
| data = dict(data) |
Contributor
There was a problem hiding this comment.
Since you re-construct the only potential list that you modify on line 60, making a shallow copy here works in the current __init__, but it might be safer to use deepcopy so that future changes don't end up modifying the provided dict by accident.
Co-authored-by: cccs-hxp <xuan.pham@cyber.gc.ca>
cccs-mb
approved these changes
Jul 16, 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.
No description provided.