Repository navigation
[BE] Add archived field to Competency Criteria & Group models #716
Description
Blocked by: #613 (the CBE data model these two models belong to).
Repo: openedx-core, single-repo. No openedx-platform changes.
Use Case
As a developer implementing CBE's archive-vs-delete behavior across several tickets (#674, #675, the create-side archived-branch guard, and eventually #681), I want CompetencyCriteriaGroup and CompetencyCriterion to have a settled archived field from the start, so that none of those tickets has to race to add it themselves or coordinate around who lands first.
Description
Current state
Neither CompetencyCriteriaGroup nor CompetencyCriterion has an archived field. Multiple downstream tickets each need it to implement ADR 0002 Decision 7's archive-only retirement rule, and were drafted with "whichever lands first adds it" coordination language instead of a single owner.
Requested change
Add archived = models.BooleanField(default=False) to both CompetencyCriteriaGroup and CompetencyCriterion, in one migration. No archived_at companion field: django-simple-history (already applied per ADR 0003) covers the "when." This ticket makes no behavior changes: nothing here sets the field to True or reads/filters on it, that's downstream tickets' scope.
Explicitly out of scope
- Setting
archived=Trueanywhere. - Filtering or checking
archivedanywhere. - Any UI.
Acceptance Criteria
There is no manual QA path. Acceptance is determined by a PR reviewer verifying the following against ADR 0002 and ADR 0003:
-
archived = models.BooleanField(default=False)exists on bothCompetencyCriteriaGroupandCompetencyCriterion. - One migration adds both columns.
- No
archived_atcolumn was added. -
django-simple-historyalready tracks both models (per ADR 0003); the new field is captured in the history table without further changes. -
archivedis registered as non-PII, matchingCompetencyRuleProfile.archived's existing category;make pii_checkpasses. - No backfill needed: greenfield field, no existing rows depend on a different default.
Context
- [BE] Implement CBE core data models (CompetencyTaxonomy, criteria, learner status) #613: the model definitions this ticket adds a field to.
- Downstream consumers: [BE] Delete Competency Criterion #674 and [BE] Build endpoint for removing a Competency Criteria Group #675 (set
archived=Trueon the archive-vs-hard-delete branch), the archived-branch authoring-guard ticket (no GitHub issue yet; rejects new authoring against an archived row), and [BE] GET Competency Criteria & Groups #681 (not yet drafted; expected to filterarchived=Falseby default). - ADR 0002 Decision 3 (
docs/openedx_learning/decisions/0002-competency-criteria-model.rst): theCompetencyRuleProfile.archivedprecedent this field matches (boolean, noarchived_at, non-PII). - ADR 0003 (
docs/openedx_learning/decisions/0003-competency-criteria-versioning.rst):django-simple-historyalready applied to both models, answering the "when" without a separate timestamp field.
Technical Details
Data Structures
CompetencyCriteriaGroup.archived: models.BooleanField(default=False)
CompetencyCriterion.archived: models.BooleanField(default=False)
Logic
None. This ticket only adds the columns and their migration; no function, view, or serializer changes.
Example Resolution Prompt
Add
archived = models.BooleanField(default=False)to bothCompetencyCriteriaGroupandCompetencyCriterioninsrc/openedx_learning/applets/cbe/models.py, and generate one migration for both. Noarchived_atcompanion field. Registerarchivedas non-PII, matchingCompetencyRuleProfile.archived's existing annotation. Do not add any logic that sets, reads, or filters on the field, that belongs to downstream tickets, not this one.
Files to create and modify
New files
| File | Purpose |
|---|---|
src/openedx_learning/applets/cbe/migrations/000X_add_archived_field.py |
Adds archived to both models in one migration. |
Modified files
| File | Nature of modification |
|---|---|
src/openedx_learning/applets/cbe/models.py |
Add archived = models.BooleanField(default=False) to CompetencyCriteriaGroup and CompetencyCriterion. |
| PII annotation registry (per #613's own PII acceptance criteria) | Register archived as non-PII on both models. |
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
thelmick-unicon commentedon Aug 21, 2026
The discussion period for this ticket is now complete, and we appreciate all the feedback. We'll be moving forward with development based on the current ticket pending final Axim sign-off. That said, the conversation doesn't have to stop. If you still have feedback, please continue to add to this ticket. We'll review anything new and determine whether it fits within the current timeline or makes more sense as its own ticket for future work. Thanks again for helping make this better!
@ormsbee This is ready for your final review. Thank you!
docs: correct why the tag foreign key is PROTECT
10 remaining items
jesperhodge commentedon Sep 30, 2026
PR: alezconsultant#5
feat: add archived field to CompetencyCriteriaGroup and CompetencyCri…
test: cover archived field defaults on group and criterion (openedx#716)
fix: renumber openedx#716's migration onto upstream's current tip
fix: renumber openedx#716's migration past upstream's new 0013
feat: add archived field to CompetencyCriteriaGroup and CompetencyCri…