Skip to content

716 archived field cc group models - #857

Open
ufedaseyeuconsultant wants to merge 5 commits into
openedx:mainfrom
ufedaseyeuconsultant:ufedaseyeu/716-archived-field-onto-upstream
Open

ufedaseyeuconsultant wants to merge 5 commits into
openedx:mainfrom
ufedaseyeuconsultant:ufedaseyeu/716-archived-field-onto-upstream

Conversation

@ufedaseyeuconsultant

Copy link
Copy Markdown
Contributor

Description

Adds archived = models.BooleanField(default=False) to CompetencyCriteriaGroup and
CompetencyCriterion, in one migration, per ADR-0002
Decision 7's archive-only retirement rule (a group or criterion referenced by learner status is
retired by archiving, never hard-deleted). No archived_at companion field: django-simple-history
(ADR-0003) already tracks both models, covering the "when" without a separate timestamp.

This PR makes no behavior changes. Nothing here sets, reads, or filters on archived; that's
downstream tickets' scope (#674, #675, #681). Both models' existing .. no_pii: class-level
docstring annotation already covers the new field, matching CompetencyRuleProfile.archived's
existing non-PII precedent, so no separate PII registry change was needed.

Impacted roles: Developer only. This is a schema-only change with no reachable behavior yet;
no Course Author, Learner, or Operator-facing effect until a downstream ticket starts using the
field.

Supporting information

Testing instructions

  1. Apply the migration: python manage.py migrate openedx_learning
  2. Confirm no missing migrations: python manage.py makemigrations --check --dry-run (should
    report nothing pending for openedx_learning)
  3. Run the new/updated model tests:
    pytest tests/openedx_learning/applets/cbe/test_criteria_group.py tests/openedx_learning/applets/cbe/test_criterion.py --no-cov
    — includes test_group_archived_defaults_to_false and test_criterion_archived_defaults_to_false,
    pinning the same "defaults to False" contract CompetencyRuleProfile.archived already has a test
    for
  4. Run the full CBE suite to confirm nothing else broke:
    pytest tests/openedx_learning/applets/cbe/ --no-cov
  5. Run PII annotation coverage: tox -e pii_check (or directly:
    code_annotations django_find_annotations --config_file .pii_annotations.yml --report --coverage)
    and confirm CompetencyCriteriaGroup/CompetencyCriterion are not listed among uncovered models

Other information

  • Migration rollback: trivially reversible (AddField on four tables — the two models plus their
    django-simple-history historical counterparts); no data migration involved.

🤖 Generated with Claude Code

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Oct 9, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @ufedaseyeuconsultant!

This repository is currently maintained by @axim-engineering.

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.

Details
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.

@ufedaseyeuconsultant

Copy link
Copy Markdown
Contributor Author

@tbain Same as PR before
alezconsultant#5

@tbain tbain 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.

One minor comment from me:

  1. tests/openedx_learning/applets/cbe/test_criteria_group.py: 32 and tests/openedx_learning/applets/cbe/test_criterion.py:35 These docstrings are unnecessary, we can remove them to reduce the noise

Otherwise nothing from Codex


Details ## Verdict

No actionable bugs found in PR #857 against issue #716.

The PR correctly:

  • Adds archived = BooleanField(default=False) to both models.
  • Adds one migration covering live and historical tables.
  • Omits archived_at.
  • Preserves existing PII annotations and history tracking.
  • Adds no runtime archive behavior, as required.

Verification:

  • Targeted tests: 19 passed.
  • Full CBE suite: 144 passed.
  • Migration drift check: passed.
  • git diff --check: passed.
  • PII check is blocked by pre-existing repository-wide safelist/coverage issues unrelated to this PR.

One non-blocking question: the new help_text says the field hides rows from a criteria-tree read endpoint, although no such filtering exists yet. This appears intended as documentation for downstream work, but may be worth confirming.

ufedaseyeuconsultant and others added 5 commits October 9, 2026 20:49
…terion (openedx#716)

Adds archived = models.BooleanField(default=False) to both models, in one
migration, per ADR 0002 Decision 7's archive-only retirement rule. No
archived_at companion field: django-simple-history (ADR 0003) already
tracks both models, covering the "when" without a separate timestamp.

Both models' existing `.. no_pii:` class-level docstring annotation
already covers the new field, matching CompetencyRuleProfile.archived's
existing non-PII precedent; no separate registry change needed.

This ticket makes no behavior changes: nothing here sets, reads, or
filters on the field. That is downstream tickets' scope (openedx#674, openedx#675, openedx#681).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Pins the same contract CompetencyRuleProfile.archived already has a test
for (test_rule_profile.py's test_creating_a_rule_profile_persists_its_columns):
a freshly created row is not archived unless told otherwise.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Cherry-picked 39561a6 and 0e9513b (openedx#716: add archived field to
CompetencyCriteriaGroup and CompetencyCriterion) onto upstream/main to
open a direct PR there instead of against this fork's lagging main.
The original migration depended on 0008_criteria_group_unique_constraints,
a migration from an unrelated, unmerged branch that doesn't exist on
upstream/main. Deletes it and regenerates via makemigrations against
upstream's current tip (0012_studentcompetencycriteriagroupstatus, from
48a04ee and 5984e3e), landing as 0013 with the identical field
operations, just renumbered and re-based.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Review nit: test_group_archived_defaults_to_false and
test_criterion_archived_defaults_to_false's docstrings add no
information the function name doesn't already give.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Rebased onto upstream/main, which merged openedx#853 since this branch was
last renumbered, adding its own 0013 migration depending on the same
0012_studentcompetencycriteriagroupstatus this branch's migration also
depended on. Deletes the old 0013 and regenerates via makemigrations,
landing as 0014; the field operations are otherwise identical to the
deleted file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ufedaseyeuconsultant
ufedaseyeuconsultant force-pushed the ufedaseyeu/716-archived-field-onto-upstream branch from 70421ca to a684d66 Compare October 9, 2026 17:51
@ufedaseyeuconsultant

Copy link
Copy Markdown
Contributor Author

@tbain Done

@tbain

tbain commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Approved, thanks :)

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.

[BE] Add archived field to Competency Criteria & Group models

3 participants