Skip to content

feat: block dominance conflicts on competency taxonomy re-import - #39413

Draft
alezconsultant wants to merge 1 commit into
openedx:masterfrom
alezconsultant:alezconsultant/902-import-dominance-validator
Draft

alezconsultant wants to merge 1 commit into
openedx:masterfrom
alezconsultant:alezconsultant/902-import-dominance-validator

Conversation

@alezconsultant

@alezconsultant alezconsultant commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Description

A re-import of a competency taxonomy can move a tag under another tag. When both tags hold live criteria in the same course run, the move breaks the competency dominance rule: no ancestor or descendant of a competency tag may hold live criteria in the same course run as that tag. With this PR, Studio rejects such a re-import, in the import plan (the preview) and in the import itself. The error names both tags, the course run, and the file row of the moved tag. This affects course authors and taxonomy administrators who re-import a competency taxonomy.

TaxonomyOrgView overrides _get_import_validators(), the hook that openedx-core's TaxonomyView calls on its two re-import endpoints. For a competency taxonomy the override adds validate_tag_import_dominance from openedx_learning.api. For any other taxonomy it returns what the parent returns, so no extra validator runs.

Dependency

This PR is a draft because it needs an openedx-core release that contains openedx/openedx-core#957, which adds the hook and the validator. The pinned openedx-core==1.26.0 has neither, so the import of validate_tag_import_dominance fails and CI stays red until the pin is raised. The version bump will be added to this PR once that release exists.

Supporting information

  • An administrator of one organization sees the key of a conflicting course run that belongs to another organization. The error must name the course run so that the administrator can act on it, and the taxonomy is shared between those organizations.
  • A criterion created after the validator's query and before the import commits is not caught by this check. The next re-import of the taxonomy rejects the resulting pair.

Testing instructions

Automated: openedx/core/djangoapps/content_tagging/rest_api/v1/tests/test_views.py covers a rejected import, a rejected import plan, an import into a plain taxonomy that runs no dominance validator, and an organization administrator who sees a conflict in another organization's course run. The tests pass locally against the openedx-core branch of the linked PR.

Manual, with openedx-core from the linked PR installed:

  1. Create a competency taxonomy with the tags "Critical Thinking" and "Evaluation" at the root and "Deduction" under "Evaluation".
  2. In one course run, add a competency criterion for "Critical Thinking" and one for "Deduction".
  3. Export the taxonomy, change the parent of "Deduction" to "Critical Thinking", and re-import the file.
  4. The import plan and the import both fail with an error that names "Deduction", "Critical Thinking", and the course run. "Deduction" stays under "Evaluation".
  5. Archive one of the two criteria and re-import the same file. The import succeeds.

Related to openedx/openedx-core#902

🤖 Generated with Claude Code

TaxonomyOrgView overrides _get_import_validators() to add
validate_tag_import_dominance for a competency taxonomy. The import
and the import plan endpoints then reject a file that would nest two
tags that both hold live criteria in the same course run, and the
error names both tags and the course. Other taxonomies run no extra
validator.

Related to openedx/openedx-core#902

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Nov 20, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @alezconsultant!

This repository is currently maintained by @openedx/wg-maintenance-openedx-platform-oncall.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Update the status of your PR

Your PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

2 participants