Repository navigation
refactor: port the courseware container and redirects to frontend-base - #2262
Draft
brian-smith-tcril wants to merge 1 commit into
Draft
brian-smith-tcril wants to merge 1 commit into
brian-smith-tcril wants to merge 1 commit into
Conversation
CoursewareContainer.tsx, CoursewareRedirects.tsx and courseware/index.js move to the same paths under frontend-base/src, and the three courseware routes and two preview routes load the container lazily in place of their stub page, in the learning-courseware chunk. The container's one change is how its position effect is limited to a change of the route's unit. master lists the unit alone as the effect's dependency, which the package's lint reports. Here the effect lists every value it reads and returns early unless the route's unit differs from the one it last handled, kept in a ref, as the sidebar's useUnitShiftBehavior detects a unit change on master. It saves in the same cases: not when the sequence loads after the unit opens, once for each move to another unit, and on mounting at a unit whose sequence is already loaded. The course component and the celebration helper the container imports are stubs at master's import paths until their own ports (#2196, #2201). The course stub prints the course, sequence and unit ids it is given inside a main landmark; the helper stub does nothing. Redirect destinations resolve Learning's roles. master's rules build paths at the root of its own site; under the shell Learning's routes sit below /learning. coursewarePath returns the courseware role's URL for the course, getSequenceUrl for a sequence and the new getUnitUrl for a unit, and for a preview the learning role's URL followed by /preview/course and the ids. The outline failure rule returns the course outline role's URL whatever the course's tab list holds, as master redirects there unconditionally. The preview rule for a user who is not staff still removes /preview from the pathname. courseware/urls.ts has one guard that throws when no route provides a role, behind getCourseOutlineUrl, getCoursewareUrl, getSequenceUrl and getUnitUrl. shouldRetryQuery takes an Error where master's takes unknown. A query that spreads queryDefaults takes its error type from the policy's parameter, so every query was typed as failing with unknown, and the container is the first TypeScript file to hand a query to TabPage, whose props expect the library's default, Error. On master the policy is set on the client and no query infers from it. The fake HTTP error in queryClient.test.ts is an Error carrying the response, as an axios failure is. CoursewareContainer.test.jsx renders the route array under a browser router, as master's suite renders under one, so its cases keep asserting on the browser's address and history; the addresses gain /learning. The cases still push a path and then load the container: the push goes to the browser's history, and loadContainer waits for the spinner to come and go. tests/render.tsx gains renderBrowserRoutes beside renderRoutes for this. master mocks the unit, one component below the course component, as a fake unit; with the course component a stub, the suite mocks the fake unit one level up, at ./course, until the course component ports (#2196), so the cases that read the fake unit keep master's assertions. The stub has its own two cases, for the ids it prints and the page rules. What differs from master's suite inside its cases: the header assertions, the header being the shell's, where the cases now assert that the two metadata requests and the outline request succeeded, which is what the header stood for; the sequence navigation assertions, commented out under #2196; and six cases that need the real course component, skipped under #2196 with their bodies unchanged, the position save on Next among them. No expected value changes. The suite turns the retry policy off, as master's test client does for every query, and answers the outline tab's request, since a redirect to the course home renders that tab. New cases, after master's: two for the position save, clicking links around the routes (nothing saved on opening a unit and one save for each move; a save on coming back to a unit whose sequence is still in the cache), and seven for the forms that take more than one redirect, asserting every address the router passes through, in order: the course root with no resume position, a section with and without a unit, a unit no sequence holds, an unknown id, and a preview path for staff and for a user who is not staff. CoursewareContainerHandlers.test.tsx is new: with the course component mocked as three buttons, it calls the three handlers the container passes down, which the stub never calls. buildBinaryCourseBlocks comes with the suite, and routes.test.tsx drops the courseware stub's cases. No commented line naming #2195 remains. Part of #2195. Co-Authored-By: Claude <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## bsmith/courseware-route-wrappers #2262 +/- ##
====================================================================
+ Coverage 97.16% 97.21% +0.05%
====================================================================
Files 527 531 +4
Lines 8241 8389 +148
Branches 1913 1951 +38
====================================================================
+ Hits 8007 8155 +148
Misses 222 222
Partials 12 12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Every courseware URL form now resolves in Learning's frontend-base package to the course, sequence and unit it resolves to on
master. The courseware container and its redirect rules port, and the three courseware routes and two preview routes load them in place of the stub page. The course component itself is a stub until #2196: the page reads "course: not yet ported" and prints the three resolved ids. No user-facing change onmaster: the legacy tree undersrc/is untouched.Part of #1905. Resolves #2195. Stacked above #2261.
Note
For reviewers: the ported files are added under
frontend-base/src/as new files, so this diff cannot show what changed frommaster. Theport-diffscript in #2234's description prints that diff, fromfrontend-base/manifest.tsv.courseware/index.jsis identical tomaster's, andCoursewareContainer.tsxdiffers in its position effect alone.CoursewareContainer.test.jsxis the file to read through that script: its cases aremaster's, and what differs is listed under Testing.What changed
CoursewareContainer.tsx,CoursewareRedirects.tsxandcourseware/index.jsmove to the same paths underfrontend-base/src/. The five routes share one lazy loader and thelearning-coursewarechunk; their ids and roles are unchanged.master's effect lists the route's unit as its only dependency, so that the sequence loading after the unit opens does not save; the package's lint reports that line. Here the effect lists every value it reads and returns early unless the route's unit differs from the one it last handled, kept in a ref, asmaster'ssidebar/hooks/useUnitShiftBehavior.tsdetects a unit change. It saves in the same cases: not when the sequence loads later, once for each move to another unit, and on mounting at a unit whose sequence is already loaded.master's rules build paths at the root of its own site; under the shell Learning's routes sit below/learning.coursewarePathreturns the courseware role's URL for a course,getSequenceUrlfor a sequence, the newgetUnitUrlfor a unit, and for a preview the learning role's URL followed by/preview/course/and the ids. The outline-failure rule returns the course outline role's URL whatever the course's tab list holds, asmasterredirects there unconditionally.courseware/urls.tshas one guard, which throws when no route provides a role, behindgetCourseOutlineUrl,getCoursewareUrl,getSequenceUrlandgetUnitUrl.master's import paths.courseware/course/index.tsxprints the three ids inside a<main>(Port the courseware sequence and unit to frontend-base #2196);courseware/course/celebration/index.tsexports ahandleNextSectionCelebrationthat does nothing (Port the celebrations to frontend-base #2201).shouldRetryQuerytakes anErrorwheremaster's takesunknown. A query that spreadsqueryDefaultstakes its error type from the policy's parameter, so every query in the package was typed as failing withunknown, and the container is the first TypeScript file to hand a query toTabPage, whose props expect the library's default,Error. Onmasterthe policy is a client default and no query infers from it.tests/render.tsxgainsrenderBrowserRoutesbeside the memory-routerrenderRoutes, for the container suite.buildBinaryCourseBlockscomes with the suite;courseBlocks.factory.jshas every buildermaster's has. No commented line naming Port the courseware container and redirects to frontend-base #2195 remains in the package.Known differences from
mastermasterselects the Course tab. The course bar selects the tab whose URL is the longest prefix of the address, and a unit's address is under none of the tabs' (The course bar selects no tab in courseware frontend-base#359). Nothing in this layer sets it.Testing
In
frontend-base/: lint, the tests,buildandbuild:cipass. 49 suites, 846 tests passed and 17 skipped (the six this layer skips, below, and eleven from earlier layers). Lint ran with the package's.jsxfiles included (openedx/frontend-base#327).CoursewareContainer.test.jsxis held tomaster's cases: the harness around them adapts, a case that cannot run is parked whole, and no expected value changes.master's suite renders underBrowserRouter, so the cases keephistory.push(…),global.location.hrefand thehistory.replaceStatespy. The addresses they expect gain/learningand nothing else.mastermocks the unit, one component below the course component, as a fake unit. With the course component a stub, the suite mocks the same fake unit one level up, at./course, so the cases that read it keepmaster's assertions; Port the courseware sequence and unit to frontend-base #2196 moves the mock back down.loadContainerwaits for the spinner to appear and then to go, since the routes load lazily.it.skipunder Port the courseware sequence and unit to frontend-base #2196's URL with their bodies unchanged: the first-section celebration record, the sequence navigation slot, the completion check on Next, the position save on Next, the disabled Next control and the page title. The sequence navigation assertions are commented out under the same URL.master's test client does for every query, and answers the outline tab's request, since a redirect to the course home renders that tab.New cases, after
master's in the same file: two for the position save, clicking links placed around the routes (nothing saved on opening a unit and one save for each move; a save on coming back to a unit whose sequence is still in the cache); and seven for the forms that take more than one redirect, each asserting every address the router passes through, in order.New files.
CoursewareContainerHandlers.test.tsxcalls the three handlers the container passes down, which the stub never calls, with the course component mocked as three buttons.course/index.test.tsxrenders the stub: the ids it prints, and the page rules.urls.test.tsmatches each of the four URL forms against the route array and tests the guard.Coverage. The package is at 100% of lines at this layer, against its 96.15% bar. Counted as codecov counts a patch, against #2261's head, the layer adds 154 lines with none missed and none partly covered.
Manual testing on the package's dev site against tutor dev, with one enrolled learner in the demo course: the course root, a sequence alone, a unit alone and an id that is nothing, each as a URL, settle on a unit with the stub's ids matching the address; a preview address loses
/previewfor the learner; the course bar's tabs switch pages from a unit; the outline tab's and the progress tab's sequence links land on a resolved unit; the console. The rows of #2195's redirect table that need a section's id, a staff user or a failed request are left to the suite. The record is below.Decisions
What was decided while building this layer; the scope, the redirect table and the test plan are in #2195.
Full decision log
Decisions: the courseware container and redirects (#2262)
Decisions made while building this layer of #2195. The scope, the
redirect table and the test plan are in #2195's plan and are not
repeated.
The top layer of three, one commit. The courseware data module
(refactor: port the courseware data module to frontend-base #2260) and the two route wrappers (refactor: port the route wrappers to frontend-base as layout routes #2261) are the layers below.
CoursewareContainer.tsxismaster's file apart from itsposition effect, which limits itself with a ref. The imports are
relative paths that exist in the package, and the file reads
nothing from the platform.
master's effect lists[routeUnitId]as its dependencies, withthe comment "only when the route's unit changes; the sequence
loading later must not save" (refactor: make the courseware redirects declarative and drop their fire-once guards #2146).
master's lint hasreact-hooks/exhaustive-depsoff; the package's reports the lineas a warning. Listing the six values it reads would save the
position when the sequence loads, the thing the comment rules
out.
the route's unit is the one it last handled, kept in
handledUnitId, a ref that starts empty so that mounting at aunit counts as a change.
master's comment sits on the guard.rule: "We recommend treating the dependency lint error as a
compilation error"
(Removing Effect Dependencies).
For an effect that reacts to one value and reads others it gives
an Effect Event
(the same page);
the package's React, 18.3.1, has no
useEffectEvent. A ref guardis not in those pages. It is in this codebase:
master'ssidebar/hooks/useUnitShiftBehavior.tscomparespreviousUnitIdRef.currentwith the unit id in an effect, theref created in
sidebar/SidebarContext.tsxasnull("Startnull so first render triggers unit shift logic"). Leaving
master's line with its warning, for a file identical tomaster's, was the other candidate; the outline tab'sstart_courseeffect was made to list what it reads in its ownport (refactor: port the outline tab to frontend-base #2252), and this one follows it.
effect runs twice on mount, and
master's would save twice at aunit whose sequence is cached where this one saves once.
coursewarePathreturns role URLs, in three branches. Nosequence id: the courseware role's URL for the course, on a preview
too, since the course root has no preview route. A preview: the
learning role's URL,
/preview/course/, and the ids. OtherwisegetUnitUrlwith a unit id andgetSequenceUrlwithout.masterjoins whichever ids it is given, so a unit id without asequence id would land in the sequence slot. No rule calls it that
way (each passes a unit id only beside a sequence id), and here
such a call returns the course's URL.
getCourseOutlineUrl(courseId),the course outline role's URL with no look at the course's tab
list, since
masterredirects tohomeunconditionally.pathname.replace('/preview', '')removes the same segment from/learning/preview/course/….DECODE_ROUTES.COURSEWARE, which the packagedoes not have; they name
routes.tsx.courseware/urls.tshas one guard and four forms.getRoleUrlresolves a role for a course and throws
No route provides the role <role>when none does, the guardgetSequenceUrlalready had.getCourseOutlineUrl,getCoursewareUrl,getSequenceUrlandgetUnitUrlare built on it;getSequenceUrlis now the coursewareURL and the sequence id, and returns what it returned before. The
outline form is here because the redirect is its caller and needs a
URL without the tab-list gate of
useCourseOutlineUrl; a?.url ?? nullat the call would be a branch no test can take.Two stubs at
master's import paths.courseware/course/index.tsx(Port the courseware sequence and unit to frontend-base #2196): a<main>holding "course:not yet ported" and the three ids as
courseId=…,sequenceId=…,unitId=…, an absent id printingundefined. The tab page givesthe courseware tab no
<main>of its own, since the realcomponent brings one.
courseware/course/celebration/index.ts(Port the celebrations to frontend-base #2201):handleNextSectionCelebration, typed with the two arguments thecontainer passes and doing nothing.
The five routes share one lazy loader.
lazyCoursewareloads./coursewarein thelearning-coursewarechunk, aslazyProgressTabserves the progress tab's two routes. Ids androles are unchanged; the preview index keeps its 404 loader.
routes.test.tsxloses the five courseware stub cases and theirfive page-rule rows; the stub's own test asserts the page rules on a
unit.
shouldRetryQuerytakes anError.masterdeclares it(failureCount: number, error: unknown). A query that spreadsqueryDefaultsinfers its error type from that parameter, so everyquery in the package was typed as failing with
unknown.TabPage'scourseStatusprops areUseQueryResult, whose errortype is the default
Error. The three tab pages are.jsx, sonothing checked the mismatch until the container, a
.tsxfile,passed its queries to
TabPage(TS2322inbuild). Onmasterthe policy is a client default and no query infers from it.
Error, and thehttpErrorhelper inqueryClient.test.tsreturnsObject.assign(new Error(…), { response: { status } }), anErrorcarrying the response as anaxios failure does. No assertion changes, and
queryDefaultsisas the layers below have it.
masterhasit: spreading the policy through a constant typed with
Error,which put the real type one step away from the function it
describes; and typing
queryDefaultsasPick<UseQueryOptions, 'retry' | 'refetchOnWindowFocus'>, which fixes the error typeand breaks inference of the data type in every query.
retryUnlessClientErroralso takesunknownand sits in aspread options object
(
src/data/query.ts);its
useGradebookQuerywrapper names the generics, with theerror defaulting to
DefaultError, so nothing is inferred fromthe policy.
The container suite is held to
master's cases. The rule,arrived at over three rounds of review: the cases stay
master's,the harness around them adapts, and a case that cannot run is
parked whole, not rewritten. No expected value differs.
tests/render.tsxgainsrenderBrowserRoutes(routes), acreateBrowserRouteroverjsdom's address, beside the memory-router
renderRoutesthepackage's other suites use.
master's suite renders underBrowserRouterand asserts onglobal.location.hrefandhistory.replaceState; a memory router has neither. With it the33 addresses the cases expect differ from
master's by/learningalone; "should stay on the sequence without aredirect to it" is
master's, spy and all; and theaudit_expiredcase expectsuhoh%20oh%20noasmasterdoes,which a memory router would hold unencoded.
afterEachdisposesof the router.
loadContainer().masterpushes onto frontend-platform'shistory, which itsBrowserRouterreads. Herehistoryis a small object in thesuite whose
pushiswindow.history.pushStateunder/learning, which the browser router reads when it is created.Passing the path to
loadContainerinstead changed that call inevery case.
loadContainerwaits for the spinner to appear, then for noneto be on the page.
master's one line,waitForElementToBeRemoved(screen.getByRole('status')), cannotbe kept: the routes load lazily, so the spinner is not there when
the render returns, and when it is awaited first it is already
gone by the time the test resumes; the helper then holds a
detached node whose topmost ancestor still contains it, and times
out.
master's fake unit, mocked one level up.mastermocks./course/sequence/Unitasdiv.fake-unitunder the real courseand sequence components. Here the suite mocks
./coursewith thesame element, shown when the route has a unit, as the sequence
shows a unit. Every
.fake-unitline ismaster's, the two thatassert it absent at the course root included, and the assertions
mastermakes straight after the load stay as they are: the fakeunit is on the page only once a redirect has reached a unit.
Port the courseware sequence and unit to frontend-base #2196 moves the mock back to
./course/sequence/Unit. The mockdeclares prop types for the two ids it reads, so it needs no
eslint-disable. Asserting on the stub's<main>in place ofthe fake unit was the first version; it changed most cases in
ways that came from the stub and not from the port.
course/index.test.tsx, throughthe routes with the requests mocked: the three ids it prints, and
no page-rule diagnostics. Both go with the stub in Port the courseware sequence and unit to frontend-base #2196.
master's suite.master's testclient sets
retry: falsefor every query. Here each querycarries the policy in its own options, which a client cannot
override, so the suite mocks
@src/queryClientwithqueryDefaults.retryfalse, and the two counts of a failinglookup read
toHaveLength(1)as onmaster.it.skipunder Port the courseware sequence and unit to frontend-base #2196's URL, its bodymaster's line for line:it clicks the real navigation's Next, which the stub does not
have. Driving the same case with
router.navigatewould havekept its name and changed what it tests. The effect is this
layer's, so two new cases under "the position save" cover it,
clicking links placed in a layout route around the route array
(the idiom of
master's "later visit to the course root" case):nothing saved on opening a unit, then one save for each move;
and a save on coming back to a unit whose sequence is still
cached. Against
master's effect both pass; against a ref thatstarts at the route's unit the second fails; with no guard both
fail.
link in a layout route around the route array.
stay. Port the dates tab to frontend-base #2189 had this issue drop them, since
shared/access.test.tscovers each code's destination andTabPage.test.jsxthe redirect. They run here asmasterhasthem, and a test file's diff against
master's is kept as smallas it can be.
(
/api/course_home/outline/…) in itsbeforeEach. Two of theaccess cases redirect a denied learner to the course home, which
renders the real outline tab; with its request unanswered the tab
threw (entry 16), and the package's suite fails on a console
error, which it did in two runs of five.
("the position save", "the addresses a redirect passes through"),
after
master's "request count", somaster's blocks keep theirorder and a diff pairs each with itself.
masterinside its cases, the configreads and
/learningaside: the render calls; the header helperand its seven calls; the parked navigation helper and its six
calls; six
it.skiplines; the link case's layout route; threestatements the package's lint splits over lines. Against
master's file the port adds 345 lines and removes 144; 167 ofthe added lines are the two blocks at the end.
Left out or parked.
assertLoadedHeader: the header is the shell's, and nothing inthe package renders
.learning-header(HeaderSlotisdroppedsince refactor: port the dates tab to frontend-base #2234; the org and title line is Replicate Learning header for frontend-base #2193's widget, which this
suite never renders). On
masterthe helper proves that thecourse metadata and the course blocks loaded.
assertMetadataAndOutlineLoadedstands where it was called,seven times: it waits for the course-home metadata, courseware
metadata and outline queries to read
success, the idiomwaitForMetadataWithOutlinePendingalready uses in this suite."Blocks" in
master's comment is the learning-sequences outline,which the suite builds from its course blocks. It is a stand-in:
with the course component stubbed, nothing on the page depends on
the outline.
master'sCourse.jsxsets the page title to thesequence's, section's and course's titles from the outline once
the outline query succeeds, so after Port the courseware sequence and unit to frontend-base #2196 the check can read
document.title. The helper carries a one-line comment withPort the courseware sequence and unit to frontend-base #2196's URL so that port replaces it. The org and number return
only in Replicate Learning header for frontend-base #2193's widget.
assertNoSequenceNavigationand its six calls are commented outunder Port the courseware sequence and unit to frontend-base #2196's URL: it queries the real course component's
navigation, and against the stub its first lookup finds no element
to assert on.
it.skipunder Port the courseware sequence and unit to frontend-base #2196's URL: the first-sectioncelebration record, the sequence navigation slot, the completion
check on Next, the position save on Next, the disabled Next
control, and the page title.
master's mock of./course/sequence/Unitstays, as a virtualmock (
{ virtual: true }, under Port the courseware sequence and unit to frontend-base #2196's URL): the module is notin the package yet, and the skipped cases still read
mockRenderUnitNav. The mocked component gains a name, which thepackage's lint requires.
Each hop of a multi-hop redirect has a case. The suite's
render records every pathname the router is at, from
router.subscribe. Seven cases assert the whole list: the courseroot with no resume position; a section; a section and a unit; a
unit no sequence holds; an id that is none of the three; a preview
sequence for a user who is not staff; a preview section for staff.
The ones that fall back to the course root go on to the resume
position, so the list shows the root as a hop.
CoursewareContainerHandlers.test.tsxcalls the threehandlers. It mocks
./courseas three buttons and./course/celebrationas a spy, in a file of its own beside thesuite, as
ProgressTabComponents.test.tsx(refactor: port the progress tab to frontend-base #2247) andOutlineTabComponents.test.tsx(refactor: port the outline tab to frontend-base #2252) are beside theirs. Sixcases: the completion request with the unit's key; the celebration
recorded when the next sequence is in another section and the
first section is celebrated; nothing recorded with the next
sequence in the same section, with the flag off, and on the
course's last sequence; nothing requested by the previous handler.
The factory's output is cast to the shape the cases read, since
the factory is JavaScript and TypeScript reads the trees it fills
in as empty (
build:citype-checks the tests).urls.test.tsmatches each of the four forms against theroute array and tests the guard for both roles.
Factories.
buildBinaryCourseBlockscomes with the suite. Nocommented line naming Port the courseware container and redirects to frontend-base #2195 remains in the package.
On a courseware page the shell's course bar selects no tab,
where
masterselects the Course tab (manual pass, 2026-11-18).On
masterthe container renders the tab page withactiveTabSlug="courseware", the Course tab's id in thecourse_metadataresponse. The shell's course bar takes no slugfrom the page: it selects the tab whose URL is the longest prefix
of the address (
findActiveTab), the Course tab's URL ends in/home, and a unit's address is under none of the tabs'. It isthe shell's rule and nothing this layer sets, so it is filed as
The course bar selects no tab in courseware frontend-base#359 and does not hold this layer.
Seen twice, not this layer's: an intermittent failure in the
outline tab's suite. Two full runs of the package's tests
(2026-11-17 and 2026-11-18), out of about twenty over the two
days, failed
OutlineTab.test.jsx"Certificate Available Alert ›appears" (
queryByText('Your grade and certificate status will be available soon.')found nothing). The case ismaster's,unchanged, in refactor: port the outline tab to frontend-base #2252's layer. It passed on the next full run both
times, and never failed when its suite ran alone. Not diagnosed:
the case asserts with
queryByTextstraight afterfetchAndRender, which waits for the heading and for the spinnerto go, so an alert added a tick later would be missed under load.
Seen while keeping the access cases, the same on
masterbyreading, not this layer's: the outline tab throws for a denied
learner whose outline request fails.
TabPage'sderiveViewreturns
isDeniedbefore it looks for a failed tab-data query,and the outline tab shows its page to a denied learner, so
OutlineTabrenders with no outline data and its nesteddestructure of
courseBlocksthrows.master's line has?? {}after
.data, which only moves the throw tocourseBlocks; theport's line has none.
master's container suite renders onlythe courseware routes, so the outline tab never renders at that
address there. Filed as Outline tab throws for a denied learner when the outline request fails #2263.
Checks (2026-11-18).
npm run lintclean, with no warning,with the package's
.jsxfiles included(
openedx lintdoes not lint.jsxfiles frontend-base#327);npm test, 49 suites, 846 passed, 17skipped (the six of entry 9 and eleven from earlier layers); 100%
of lines for the package.
npm run buildandnpm run build:cipass. Counted as codecov counts a patch, against refactor: port the route wrappers to frontend-base as layout routes #2261's head: 154
added lines, none missed and none partly covered.
Manual testing
Manual testing — the courseware container and redirects (#2195)
One section per layer of the stack. A layer's section asks only for what that layer changes
and a test cannot see, and says what each step needs beyond the page itself.
Drafted 2026-11-18 before the pass. The boxes are Brian's ticks; what was and was not
observed goes under each section's Record.
Setup, for both sections
The same as for the outline tab; nothing new.
cd frontend-base && nvm use && npm ci && npm run dev, served athttp://apps.local.openedx.io:2000/learning/, with tutor dev'smfeservice stopped sothe port is free.
LEARNING_MICROFRONTEND_URLpointing atapps.local.openedx.io:2000/learning, as for Port the dates tab to frontend-base #2189.course-v1:OpenedX+DemoX+DemoCourse.The courseware data module
Nothing to do. No route renders this layer's code until the container layer.
The route wrappers
On
bsmith/courseware-route-wrappers.What needs eyes: a real browser's address bar going through the two redirects and the page
rendering after them, the shell's course bar with the two new layout routes in the tree,
and a real browser's console. The suite runs the wrappers in jsdom.
http://apps.local.openedx.io:2000/learning/course/course-v1%3AOpenedX%2BDemoX%2BDemoCourse/homeinto the address bar. The address becomes
…/learning/course/course-v1:OpenedX+DemoX+DemoCourse/homeand the outline tabrenders.
Why here:
DecodePageRouteis back, as the layout route of the course routes. Itnow decodes every segment of the path.
http://apps.local.openedx.io:2000/learning/course/course-v1:OpenedX DemoX DemoCourse/dates.The address becomes
…/course/course-v1:OpenedX+DemoX+DemoCourse/datesand the datestab renders.
Why here:
PathFixesProvideris back, as a layout route around all of Learning'sroutes.
turn. Each opens with no page load (the Network tab shows no document request), and
the course bar stays in place.
Why here: the route tree gained a pathless route and the two course routes render
a wrapper where they rendered a bare outlet; the shell reads the course from the
matched routes, which no test of Learning's renders.
warnings from Learning's code.
Record
2026-11-18, Brian, on the dev site, on
bsmith/courseware-route-wrappers(e0cef2b8).Network tab was watched for a document request on each tab click (step 3), and
whether the console held warnings that are not Learning's (step 4).
Checked without you
jsdom's browser router, which encodes an address as a browser does, started at an encoded
course key, at a key with spaces, and at
c%6Furse. Each settled on the clean address andrendered the page. Steps 1 and 2 are the same thing in a real browser.
master. In the samethrowaway case, started at
…/course-v1:Org+Caf%C3%A9+Run/home, nothing rendered: thebrowser holds the address encoded, the wrapper decodes it to
é, the two never match, andthe wrapper keeps redirecting.
master's wrapper underBrowserRouterin jsdom did thesame, so this layer does not introduce it. Not seen in a real browser.
Left to the suite
decodeRoutes.test.tsxlearning,course,previeworhomedecode-page-route/index.test.jsx, "should decode an escaped character in the fixed segment"index.test.jsx, "should leave a trailing slash as it is"index.test.jsx, "should decode a preview url"PathFixesProvider.test.jsx,index.test.jsxindex.test.jsx, "should send one page event for each pathname of a course route". Seeing it by hand needs an analytics key on the site.The container and redirects
On
bsmith/courseware-container.What needs eyes: the redirect rules against the real responses (the resume position, the
sequence, the error a unit id draws from the sequence endpoint, the outline), the course bar
on a courseware page, the earlier tabs' links reaching a unit, and a real browser's console.
The suite answers every request itself.
The page is a stub until #2196: it reads "course: not yet ported" and lists
courseId=…,sequenceId=…andunitId=…. "The stub matches" below means those three equal the ids inthe address.
http://apps.local.openedx.io:2000/learning/course/course-v1:OpenedX+DemoX+DemoCourse.The address settles on
…/course/<course>/<sequence>/<unit>and the stub matches.Why here: the container and its redirects replace the stub page on the courseware
routes; this is the resume lookup and the outline for real.
Enter. The address goes back to a unit of that sequence and the stub matches.
unit follows the course key, and press Enter. The address settles on
…/<sequence>/<unit>again and the stub matches.Why here: the sequence endpoint's real answer to a unit id, and the lookup of the
unit's parent, both of which the suite stands in for.
…/learning/course/course-v1:OpenedX+DemoX+DemoCourse/block-v1:OpenedX+DemoX+DemoCourse+type@sequential+block@nothing.The address goes to the course root and on to where step 1 settled.
Why here: the sequence endpoint's real answer to an id it does not know.
/previewafter
/learningand press Enter. The address loses/previewand the stub matches.Why here:
useIsPreviewnow compares against/learning/preview.then go back: each opens with no page load.
Why here: the shell picks the selected tab from the address, and this is the first
Learning page whose address is under none of the tabs' own.
any. Nothing is expected here; what shows is recorded below.
sequence title; on the Progress tab, click a subsection's title. Each lands on a unit
with the stub matching, with no page load.
Why here: those links landed on the stub page of Add frontend-base route tree with stub pages, roles and provides #2188 until now.
Learning's code.
Record
2026-11-18, Brian, on the dev site, on
bsmith/courseware-container(53eaf560).On
masterthe Course tab is selected there: the container renders the tab page withactiveTabSlug="courseware", the Course tab's id from thecourse_metadataresponse iscourseware, andisActiveTabselects the tab whose id equals the slug. The shell'scourse bar does not take a slug from the page: it selects the tab whose URL is the
longest prefix of the address (
findActiveTab), the Course tab's URL ends in/home,and a unit's address is
…/course/<course>/<sequence>/<unit>, under none of the tabs'.So this is the shell's rule and not something this layer's code sets; it is a difference
from
masterthat a learner sees.tab was watched for a document request (steps 6 and 7), which sequence and subsection
were clicked (step 7), and whether the console held warnings that are not Learning's
(step 8).
Checked without you
Left to the suite
CoursewareContainer.test.jsx, "when the URL contains a section ID…" (needs a section's id, which no page shows)firstandlastmarkersCoursewareContainer.test.jsx, "when the sequence has no units", "when the URL contains a unit marker"CoursewareContainer.test.jsx, "when the URL has the /preview prefix" (needs a staff user)CoursewareContainer.test.jsx, "when the learning-sequences outline fails"CoursewareContainer.test.jsx, "when receiving a course_access error_code"CoursewareContainer.test.jsx, "the addresses a redirect passes through"CoursewareContainer.test.jsx, "the position save" (the stub has no navigation to move with)CoursewareContainerHandlers.test.tsx🤖 Generated with Claude Code