Skip to content

Test Source-version hierarchy through the concept API - #1021

Merged
snyaggarwal merged 2 commits into
OpenConceptLab:masterfrom
filiperochalopes:fix/version-hierarchy-membership
Nov 24, 2026
Merged

snyaggarwal merged 2 commits into
OpenConceptLab:masterfrom
filiperochalopes:fix/version-hierarchy-membership

Conversation

@filiperochalopes

@filiperochalopes filiperochalopes commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

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

Area File Coverage
Children core/integration_tests/tests_concepts.py A child added after v1 appears in HEAD but not in v1.
Parents core/integration_tests/tests_concepts.py Moving a child to a different parent changes HEAD without changing its parent in v1.

Key Decisions

Verification Checklist

…urce version list only that version's members
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T11:27:56.676153Z a9a3f36 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread core/concepts/views.py Outdated
"""
if self.kwargs.get('version', HEAD) == HEAD:
return queryset
members = Concept.get_base_queryset({**self.params, 'concept': None, 'concept_version': None})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 snyaggarwal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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:

  • ConceptChildrenView and ConceptParentsView now go through ConceptHierarchyMixin.get_hierarchy_queryset.
  • For a source version other than HEAD (latest included), that calls Concept.get_version_hierarchy_queryset(relation, repo_version), which reads only repo_version.concepts. In #3059's case, new-child isn't in v1's concepts, so v1's /children/ leaves it out, and /parents/ works the same way.
  • has_children follows 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:

  1. Take master's two get_queryset bodies, and drop filter_to_container_version. On top of master it only repeats the membership check for source versions.
  2. Keep your regression test. Master only tests get_version_hierarchy_queryset directly (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 after v1. Please confirm it passes on the merged branch.
  3. Collection versions (your open checklist item) are the one place this PR would still change anything. get_source_version returns 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: clearing concept in get_base_queryset brings in the default retired=False filter, so the subquery would drop retired members that test_get_200_includes_retired_children expects.

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.

@filiperochalopes

Copy link
Copy Markdown
Contributor Author

Updated this branch to master at fb8e9f09: the PR now changes only the API regression tests for /children/ and /parents/. The targeted suite passed locally (236 tests; pylint 10/10). The SIGTAP 202512 rerun found no unexpected child links, and 0101050186 appeared only in 202611 and HEAD. That instance reported 2.3.264-dev, so this is not a rerun on the exact 2.3.262 build. The audit also found 167 missing historical links, a separate legacy parallel-import issue tracked in OpenConceptLab/ocl_issues#3069. The original later-child leak is addressed by #985; this PR is now test coverage only.

@filiperochalopes filiperochalopes changed the title OpenConceptLab/ocl_issues#3059 | concept children and parents in a source version list only that version's members Test Source-version hierarchy through the concept API Nov 23, 2026
@snyaggarwal
snyaggarwal merged commit 20fe969 into OpenConceptLab:master Nov 24, 2026
3 checks passed
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