Skip to content

feat/841: explain archived competency rules in the course row - #3

Closed
bsparks wants to merge 8 commits into
ashatsila/785-edit-confiramation-for-ccfrom
ashatsila/841-archived-course-rules-message
Closed

bsparks wants to merge 8 commits into
ashatsila/785-edit-confiramation-for-ccfrom
ashatsila/841-archived-course-rules-message

Conversation

@bsparks

@bsparks bsparks commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

Description

Fixes openedx/openedx-core#841. On the Competency Management page, expanding a course whose rules for the selected competency were archived shows a message in place of the course's outline:

This course's rules for this competency were archived, so no new competency criteria associations can be added. This applies only to this course run. Learners' recorded progress is kept.

What changed:

The archived message. CourseRow renders the message, in the same place and with the same small-text markup as the existing "This course has no gradeable subsections." text, instead of mounting CourseOutlineSubtree. Because the subtree is never mounted, the outline of an archived course is never requested, and the message replaces every other state of the row: another competency's association, no write access, no gradeable subsections, and an outline error.
Loading. While the associations data is loading, a newly expanded row shows a small spinner instead of the outline, and requests no outline. The row reads the provider's status, the same value the Competency Criteria Associations panel uses, so the two panels agree on when the data is ready. Once it has loaded, the row shows the message or the outline without a page reload.
An outline that is already shown stays. When the data reloads after a competency switch, a search, or a page change, a row that already shows its outline keeps it, so the sections the author expanded stay expanded. Its add controls are hidden until the data has loaded. If the course is archived for the new selection, the message replaces the outline once the data arrives.
After a delete. A delete's background refetch keeps the previous data, so no spinner appears. A course that the delete archived switches from its outline to the message, and a row that already shows the message keeps it throughout.
Load failure. If the associations data fails to load, an expanded row shows its outline with no add controls.
Keyboard focus. When the outline is replaced by the message and keyboard focus was inside the outline, focus moves to the message, so a screen reader reads it. This includes removing the course's last association from its chip with the keyboard: Chromium drops focus to the page body when the remove button is disabled for the delete, so the outline remembers that focus was inside it when the delete began. Focus that is anywhere else stays where it is, and the message is not announced, because it has no live region.
The response type. archivedCourseKeys is a required field of CompetencyCriteriaGroupsResponse. A response without it reads as "no course archived".

Roles affected: Course Author (Competency Management page).

Screenshots
00-outline-not-archived
01-archived-message
02-loading
03-load-failed
04-archived-message-narrow
05-before-remove
06-after-remove-archived

Supporting information
Ticket: openedx/openedx-core#841.
Backend: openedx/openedx-core#944 adds archived_course_keys to the criteria-groups response. It is merged and is in openedx-core 1.29.0 and later.
Figma: A1 Archived message, A2 Loading, A3 Load failed.
This PR takes over AShatsila#12. The branch history contains the earlier commits and merges of master; the diff against master is the change described here.
Testing instructions

You need openedx-core 1.29.0 or later, a Competency taxonomy, and a course you can edit in Studio in which a learner has recorded progress against one of the competency's rules.

On the Competency Management page of the taxonomy (/authoring/taxonomy//competencies), select the competency. In the Courses & Content panel, expand the course. Its sections and gradeable subsections are shown.
In the Competency Criteria Associations panel, delete the course's last Rule Group for this competency. Because a learner has progress, the backend archives the course-level group instead of deleting it.
Without reloading, the expanded course row now shows the archived message in place of its outline. Collapse and expand the row: the message is shown again. In the browser's developer tools, confirm that no course_index request was made for the course after the archive.
Search for the course by title. It is listed, and expanding it shows the message.
Select another competency for which the course has no archived rules and expand the course. Its outline is shown as usual. Select the first competency again: the message is back.
Expand another run of the same course whose rules are not archived. Its outline is shown.
Reload the page with the network throttled to "Slow 3G". Select a competency and expand a course before the Competency Criteria Associations panel has finished loading. The row shows a spinner and no add control. When the panel finishes loading, the row shows the message or the outline without a reload.
Expand a course that is not archived and expand one of its sections. Select another competency. The outline stays in place with the section still expanded, and its add controls return once the data has loaded.
Block the criteria-groups request in the developer tools and reload. Expanding a course shows its outline, and no subsection offers an add control.
Keyboard: with a course whose last association is shown as a chip in its own outline, Tab to that chip's remove button and press Enter. If the removal archives the course, the row shows the message and focus is on it, so a screen reader reads it. Repeat with focus outside the row (for example on the search field) and trigger the archive from the associations panel: focus stays where it was and the message is not announced.
Other information
Dependency. The message needs openedx-core 1.29.0 or later. Against an older backend the response has no archived_course_keys, so no course reads as archived and the page behaves as it did before.
Question for reviewers. The ticket's loading scenario says a course expanded while the associations data loads shows a loading indicator. A row expanded during the load does. A row that already shows its outline keeps it during a reload, as described above, because replacing it with the spinner would collapse the author's expanded sections on every competency switch or search. Until the data arrives, that row can show the outline, without add controls, of a course that is archived for the new selection.
Rejected creates. If another author archives a course while this author has its outline open, the backend rejects the create and the row keeps offering its add controls until the next refetch, because the create hook refetches only on success. This predates this PR; a follow-up could refetch on settle, as the delete hooks do.
Naming. The predicate is isCourseGroupArchived, not isCourseArchived, because "archived course" in this repository already means an ended Studio course run.
Tests. The PR adds 24 tests: 20 in the new CourseRow.test.tsx, 3 in CompetencyAssociationsContext.test.tsx, and 1 in CourseSearchBrowse.test.tsx. All 837 tests in src/taxonomy/competency-management pass. tsc --noEmit and dprint are clean. npx oxlint --type-aware reports one no-floating-promises error in CompetencyAssociationsContext.tsx, on a queryClient.invalidateQueries call for blocked courses; that line is unchanged from master. jsdom does not move focus off a button that becomes disabled and has no assistive technology, so step 10 above covers what the focus tests cannot; the keyboard removal was also checked in headless Chromium against a devstack with openedx-core 1.30.0.
AI assistance. This PR was written with Claude Code (Anthropic). A developer reviewed the code, the tests and this description.
Best Practices Checklist
[x] Any new files are using TypeScript (.ts, .tsx).
[x] Avoid propTypes and defaultProps in any new or modified code.
[x] Tests should use the helpers in src/testUtils.tsx (specifically initializeMocks)
[x] Do not add new fields to the Redux state/store. Use React Context to share state among multiple components.
[x] Use React Query to load data from REST APIs. See any apiHooks.ts in this repo for examples.
[x] All new i18n messages in messages.ts files have a description for translators to use.
[ ] Avoid using ../ in import paths. The new and changed files import siblings within src/taxonomy/competency-management with ../, matching the rest of that folder.

🤖 Generated with Claude (Fable 5.2)

AShatsila and others added 8 commits November 9, 2026 19:49
When a course run's course-level group for the selected competency is
archived, the expanded row in the Courses & Content panel shows a message
in place of the outline, and the outline is never fetched. The archived
course runs come from the groups response's archived_course_keys (openedx#840),
read through the provider as isCourseGroupArchived. While the groups or
profile query is loading, an expanded row shows a spinner. Keyboard focus
moves to the message only when it was inside the outline at the moment
the outline unmounted.

Closes openedx/openedx-core#841

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Brings in upstream master and the edit confirmation built on upstream's
score settings popover. The archived course rules message is kept on top
of upstream's blocked-course handling: an archived course shows the
message in place of its outline, so the blocked-course tooltip inside
the outline does not render for it.

The test for an expanded row while the groups load expects the loading
spinner, because the row does not know whether the course is archived
until the groups arrive.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…x#3397)

Bumps [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware) from 2.0.10 to 2.0.12.
- [Release notes](https://github.com/chimurai/http-proxy-middleware/releases)
- [Changelog](https://github.com/chimurai/http-proxy-middleware/blob/v2.0.12/CHANGELOG.md)
- [Commits](chimurai/http-proxy-middleware@v2.0.10...v2.0.12)

---
updated-dependencies:
- dependency-name: http-proxy-middleware
  dependency-version: 2.0.12
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
On the Competency Management page, changing a saved rule box's score
or a saved Rule Group's any/all value now asks the author to confirm
before anything is saved. The dialog says the change applies only to
future evaluations of the competency, and that learners already
evaluated keep the status they have. It appears on every such edit,
whether or not any learner has been evaluated.

The score settings popover gets Cancel and Save buttons. On a saved
rule box, Save and Enter run the existing checks and then open the
confirmation. Cancel, Escape, and a click outside discard the draft.
A click outside used to save. Cancelling the confirmation reopens the
popover with the unsaved comparison and percentage. For any/all,
choosing the other value opens the confirmation right away, and
cancelling switches the dropdown back.

When a save fails, the dialog stays open with a "Couldn't save this
change" alert that says what is still in effect, and the author can
retry or cancel. The alert replaces the failure toasts for these two
edits. After a failed save, the competency's groups are refetched
only when the server answered with a 4xx.

An unsaved rule box or Rule Group still saves without a dialog,
because no learner has been evaluated against it.

Implements openedx/openedx-core#785.

Co-authored-by: AShatsila <319486855+AShatsila@users.noreply.github.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…chived message

- A shown outline stays mounted while the associations data reloads, so
  its expanded sections survive a competency switch or a search or page
  change. The spinner shows only before the outline's first mount.
- The "focus was inside the outline" flag survives a spinner between the
  outline and the archived message.
- Removing the last association from its chip with the keyboard moves
  focus to the archived message. Chromium drops focus to the body when
  the remove button is disabled for the delete, so the outline remembers
  that focus was inside it when the delete began.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@bsparks

bsparks commented Dec 4, 2026

Copy link
Copy Markdown
Owner Author

Superseded by the upstream PR: openedx#3411. The branch stays, because #4 is stacked on it.

@bsparks bsparks closed this Dec 4, 2026
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.

4 participants