Repository navigation
Test Source-version hierarchy through the concept API - #1021
snyaggarwal merged 2 commits into
Conversation
…urce version list only that version's members
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a9a3f36a58
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| """ | ||
| if self.kwargs.get('version', HEAD) == HEAD: | ||
| return queryset | ||
| members = Concept.get_base_queryset({**self.params, 'concept': None, 'concept_version': None}) |
There was a problem hiding this comment.
Preserve retired members when filtering hierarchy by version
For a non-HEAD request with a related concept that is retired in the requested source version, clearing concept activates the default retired=False filter in SourceChildMixin.get_filters_for_criterion(). Consequently, /children/ and /parents/ now omit that concept even though it belongs to the version, unless the caller supplies includeRetired=true. This changes the existing hierarchy behavior, which explicitly includes retired children in test_get_200_includes_retired_children. Build a membership-only queryset, or explicitly include retired rows in this subquery, so the version restriction does not also remove valid retired members.
Useful? React with 👍 / 👎.
snyaggarwal
left a comment
There was a problem hiding this comment.
Changes needed at a9a3f36: master already fixes this for source versions. This branch starts from 23ad045 (Nov 19). #985 merged on Nov 20, and it changed both views:
ConceptChildrenViewandConceptParentsViewnow go throughConceptHierarchyMixin.get_hierarchy_queryset.- For a source version other than HEAD (
latestincluded), that callsConcept.get_version_hierarchy_queryset(relation, repo_version), which reads onlyrepo_version.concepts. In #3059's case,new-childisn't inv1's concepts, sov1's/children/leaves it out, and/parents/works the same way. has_childrenfollows the version too (annotate_has_children(queryset, repo_version)).
That's also why core/concepts/views.py conflicts: both changes edit the same two get_queryset lines.
Suggested resolution:
- Take master's two
get_querysetbodies, and dropfilter_to_container_version. On top of master it only repeats the membership check for source versions. - Keep your regression test. Master only tests
get_version_hierarchy_querysetdirectly (core/importers/tests.py:6691-6699), so an API-level test of/children/on a released version is worth having. A/parents/case would be good too, such as a child moved to a new parent afterv1. Please confirm it passes on the merged branch. - Collection versions (your open checklist item) are the one place this PR would still change anything.
get_source_versionreturns None for collections, so they still read HEAD's links. If you want to cover them, I'd make that a separate issue with its own test. The membership rule there is the expansion's, and Codex's point applies: clearingconceptinget_base_querysetbrings in the defaultretired=Falsefilter, so the subquery would drop retired members thattest_get_200_includes_retired_childrenexpects.
Once it's down to the test, I'll approve. #3059 can then close against #985, with SIGTAP's 202512 check rerun on 2.3.262.
|
Updated this branch to master at |
TL;DR: Adds API regression coverage for Source-version hierarchy. The behavior change for OpenConceptLab/ocl_issues#3059 already landed in #985; this PR changes tests only.
Main Changes
core/integration_tests/tests_concepts.pyv1appears in HEAD but not inv1.core/integration_tests/tests_concepts.pyv1.Key Decisions
Verification Checklist
core/integration_tests/tests_concepts.py.202512on the local2.3.264-devAPI: no unexpected parent-child links. The missing links are tracked separately in Bug: Multi-version bulk import drops parent links from earlier Source versions ocl_issues#3069.2.3.262build requested in review.