Skip to content

fix: stop the progress tab's certificate card reading the entrance exam status - #2249

Merged
brian-smith-tcril merged 1 commit into
frontend-basefrom
bsmith/progress-entrance-exam
Nov 18, 2026
Merged

brian-smith-tcril merged 1 commit into
frontend-basefrom
bsmith/progress-entrance-exam

Conversation

@brian-smith-tcril

@brian-smith-tcril brian-smith-tcril commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The progress tab's certificate card no longer reads the learner's entrance exam status. master's card reads it from the courseware metadata query without fetching, and nothing on the progress tab fetches that query, so on master the card never has it (#2243). Under the shell a tab switch keeps the query cache, so once the courseware pages are ported the card would start hiding for a learner whose entrance_exam_passed is false. That field is also false for a learner allowed to skip the exam and for enrolled course staff, so the card stops reading it. No change a learner can see: the card shows what it shows on master. The legacy tree under src/ is untouched.

Part of #1905. Resolves #2190. Stacked above #2247.

Note

For reviewers: this PR's first version did the opposite. It fetched the courseware metadata on the progress tab and hid the card from a learner who had not passed the exam. Review reversed it (decision log entry 1).

What changed

Known differences from master

  • None a learner can see.
  • The card does not read the courseware metadata from the query cache. On master that read is always empty, since every way into the progress tab is a page load. Here a tab switch keeps the cache, and the read would hide the card on that path alone once a courseware page fills it.

Testing

At the layer's commit, in frontend-base/: lint, the tests, build and build:ci pass. Lint ran with the package's .jsx files included (openedx/frontend-base#327).

Coverage. The package is at 100% of lines, against its 96.15% bar. Counted from the local coverage report the way Codecov counts a patch, this layer adds 17 lines with none missed or partly covered. One line outside the patch becomes partly covered: CertificateStatus.jsx line 101, master's last else if (decision log entry 6).

Manual testing. None for this version: nothing a learner can see changes, and the suite asserts both things the layer does (decision log entry 11).

Decisions

What was decided while building this layer; the scope is in #2190, the card's status in #2243 and the staff view in #2244.

Full decision log

Decisions: the entrance exam status on the progress tab (#2249)

Decisions made while building this layer of #2190. The scope is in #2190's plan, the
status on a learner's own page is #2243 and the staff view is #2244. The tab itself is
ported in #2247, the layer below.

The layer's first version, pushed 2026-11-12, made the certificate card apply the
status. Review reversed that (entry 1). The entries describe the layer as it is now and
say where the first version differed.

  1. The certificate card does not apply the entrance exam status. CertificateStatus
    calls getCourseExitMode without entranceExamPassed. The parameter defaults to
    null and the function's one test of it is === false, so the card renders as it
    would for a course with no entrance exam, which is what every learner sees on
    master.

    • This reverses the first version, in which ProgressTab fetched the courseware
      metadata on a learner's own page and waited for it, and the card rendered nothing
      for a learner whose entrance_exam_passed was false. The reason is arbrandes's
      review comment of 2026-11-13
      (fix: stop the progress tab's certificate card reading the entrance exam status #2249 (comment));
      Brian agreed on 2026-11-18.
    • entrance_exam_passed is false for more learners than the exam holds back.
      user_has_passed_entrance_exam
      returns whether the exam's milestone is still outstanding. The exemptions are in
      user_can_skip_entrance_exam, in the same file: course staff, and a learner an
      instructor allowed to skip the exam (EntranceExamConfiguration). The field does
      not consult it. This is read from edx-platform at that commit, not observed on a
      course with an entrance exam.
    • Those learners can take the whole course. Under the first version they would never
      see the cards for requesting a certificate, verifying their identity or upgrading.
    • The frontend cannot tell the two apart. entrance_exam_data in
      GET /api/courseware/course/ has five fields (current score, enabled, id, minimum
      score, passed) and none says the learner may skip.
    • The two errors are not equal. A learner the exam does hold back sees a card that
      is true of them (not passing, or upgrade), as on master. Hiding takes the card
      from a learner entitled to it.
  2. What a learner sees: what master shows. The layer changes nothing a learner
    can see.

  3. The card reads nothing from the query cache. master's line, the
    enabled: false read of the courseware metadata, is removed with its import and the
    entranceExamPassed line. It is not kept.

  4. The argument stays in the call as a commented-out line with Progress tab: the certificate card ignores the entrance exam #2243's URL:
    // entranceExamPassed, // https://github.com/openedx/frontend-app-learning/issues/2243,
    the form courseware/data/__factories__/index.js uses for its unported imports.

  5. ProgressTab.jsx is the layer below's file again. It runs no courseware
    metadata query and waits for none. None of the first version's costs remain: no
    extra request on the page, no error view when that request fails, no user activity
    recorded for the requester.

  6. The card's last else if stays as master wrote it.
    else if (mode === COURSE_EXIT_MODES.celebration || certIsDownloadable) had one way
    to its false side: entranceExamFail mode without a downloadable certificate. The
    card can no longer be in that mode, so the line is partly covered. It is not in the
    patch. Turning it into a plain else would change master's logic; Brian left it.
    getCourseExitMode keeps the mode, which the unit navigation uses.

  7. The courseware metadata slice of courseware/data/ stays in this layer. It
    was ported for the first version's fetch, and the rest of the module ports with
    Port the courseware container and redirects to frontend-base #2195. Moving it up to refactor: port the courseware data module to frontend-base #2260 was the other candidate. It stays because it was
    reviewed here, refactor: port the courseware data module to frontend-base #2260 adds the rest of each file at the same path with no change,
    and the cache case of entry 8 needs the real query key. In this layer nothing
    fetches the query outside the tests.

  8. Tests.

    • ProgressTab.test.jsx, "Entrance exam status": two assertions, each run on a
      learner's own page and on progress/10. The tab makes no request to
      /api/courseware/course/. With a failed entrance exam seeded in the query cache
      before the card mounts, the certificate card renders. The suite's beforeEach no
      longer answers the courseware request.
    • The cache cases hold entry 3. Run against the layer below's CertificateStatus.jsx,
      which has master's read, both fail and the two request cases pass (2026-11-18).
    • ProgressTabComponents.test.tsx loses the case that gave the card a mocked
      entranceExamPassed: false, and with it the mock of
      @src/courseware/data/apiHooks, its import, its beforeEach and its comment:
      nothing the file renders reads that module now.
    • courseware/data/apiHooks.test.tsx is new: the query carries the query defaults,
      the hook fetches once, and it requests nothing when disabled or without a course
      id. master has a file at this path with cases for eleven other hooks and queries
      and none of its own for useCoursewareMetadata, which only does the fetching in
      its useSequenceIds and useIsCourseLoaded cases; Port the courseware container and redirects to frontend-base #2195 ports those into this
      file.
    • getCourseMetadata and the normalizer get no cases of their own. The hook's fetch
      case runs both, and in this layer it is the only thing that does.
    • One comment in the lower layers' tests became false with the real query and stays
      corrected: course-exit/utils.test.ts said both courseware queries are stubs.
    • At the layer's commit (2026-11-18): npm run lint passes with the package's
      .jsx files included (openedx lint does not lint .jsx files frontend-base#327), and build and build:ci
      pass. The full run is entry 10.
  9. One commit. The reversal is amended into the layer's commit, whose message is
    rewritten since the first one described the fetch. The five layers above are
    rebased onto it with their commits unchanged.

  10. Coverage at this layer (2026-11-18). The full run: 36 suites,
    410 tests passed and 7 skipped. 100% of lines for the package. Counted from the
    local coverage report the way Codecov counts a patch, against the layer below, the
    layer adds 17 lines with none missed or partly covered. The partly covered line of
    entry 6, CertificateStatus.jsx line 101, is master's and outside the patch. The
    useMinimalCourseOutline stub's function is not called (Port the courseware container and redirects to frontend-base #2195).

  11. No manual pass for this version. The layer changes nothing a learner can see,
    and the suite asserts the two things it does: no courseware metadata request, and
    the card unmoved by what the query cache holds. The first version's pass
    (2026-11-12) looked at the real request and at the card going away with the
    response faked; both were of code this version removes.

🤖 Generated with Claude Code

@brian-smith-tcril brian-smith-tcril linked an issue Nov 12, 2026 that may be closed by this pull request
11 tasks
@codecov

codecov Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.77%. Comparing base (5443cd5) to head (e22c204).

Additional details and impacted files
@@                Coverage Diff                @@
##           frontend-base    #2249      +/-   ##
=================================================
- Coverage          96.78%   96.77%   -0.01%     
=================================================
  Files                475      478       +3     
  Lines               7368     7382      +14     
  Branches            1723     1769      +46     
=================================================
+ Hits                7131     7144      +13     
  Misses               223      223              
- Partials              14       15       +1     
Flag Coverage Δ
frontend-base 99.48% <100.00%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Pre-emptively approved, but Claude did flag one thing we should probably take a look at before merging. Comment inline.


const entranceExamPassed = entranceExamData?.entranceExamPassed ?? null;
// GET /api/courseware/course/ answers for the requester, not the target user: https://github.com/openedx/frontend-app-learning/issues/2244
const entranceExamPassed = targetUserId ? null : (entranceExamData?.entranceExamPassed ?? null);

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.

I don't think we should hide the card based on this flag. Probably best to keep master's behavior for now: always pass null here, and don't fetch the courseware metadata on the progress tab at all.

The problem is that the LMS only sets entrance_exam_passed to true if the learner actually passed the exam (code). It stays false for learners an instructor allowed to skip the exam, and for course staff who are enrolled. Those people can take the whole course, but with this change they'd never see the cards that let them request a certificate, verify their ID, or upgrade.

We can't tell "failed the exam" from "was allowed to skip it" on the frontend, so I think this needs the backend change described in #2244 first.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

…am status

On master the certificate status card reads the courseware metadata query
with enabled: false for the learner's entrance exam result, and nothing
on the progress tab fetches that query, so the card never has it (#2243).
Under the shell a tab switch keeps the query cache, so once a courseware
page fills it the card would hide for a learner whose entrance_exam_passed
is false, on a tab switch and not on a page load.

That field is also false for a learner allowed to skip the exam and for
enrolled course staff, who can take the whole course: hiding would take
their certificate, identity verification and upgrade cards away. The
card no longer reads the status. Its call to getCourseExitMode keeps the
argument as a commented-out line under the URL of #2243, and the tab
fetches no courseware metadata, on a learner's own page or on
progress/:targetUserId (#2244).

The courseware metadata slice of courseware/data ports here:
getCourseMetadata, coursewareMeta.ts, coursewareMetadataQuery with
useCoursewareMetadata in place of its stub, and the courseMetadata
factory. The rest of api.js, apiHooks.ts and the factories comes
with #2195; useMinimalCourseOutline stays a stub until then. master's
apiHooks.test.tsx has no case of its own for useCoursewareMetadata, so
cases for the hook are added beside it.

Part of #2190.

Co-Authored-By: Claude <noreply@anthropic.com>
@brian-smith-tcril
brian-smith-tcril force-pushed the bsmith/progress-entrance-exam branch from bea109b to e22c204 Compare November 18, 2026 20:27
@brian-smith-tcril brian-smith-tcril changed the title fix: read the entrance exam status on the progress tab fix: stop the progress tab's certificate card reading the entrance exam status Nov 18, 2026
@brian-smith-tcril
brian-smith-tcril merged commit 51f5783 into frontend-base Nov 18, 2026
10 of 11 checks passed
@brian-smith-tcril
brian-smith-tcril deleted the bsmith/progress-entrance-exam branch November 18, 2026 21:32
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.

Port the progress tab to frontend-base

2 participants