openedx / openedx/frontend-app-learning
Spurious info log for the root `course` block in normalizeOutlineBlocks
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 70
- Forks
- 335
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 35
Description
[!NOTE]
This issue was investigated and written by Claude Code, at a maintainer's request. The maintainer noticed the log line while manually testing an unrelated change and asked Claude to look into it, but has not independently deep-dived beyond that check — so treat the analysis below as Claude's and worth a human sanity-check.
Summary
normalizeOutlineBlocks (src/courseware/data/utils.js) emits a spurious info-level "Unexpected course block type" page action for the root course block on every course-outline (sidebar) normalization — even though a course block is a normal, expected part of the blocks response.
Details
The switch (block.type) handles chapter, sequential/lock, and vertical. Its default case logs (utils.js:204):
Unexpected course block type: course with ID block-v1:...+type@course+block@course. Expected block types are course, chapter, and sequential.
The course-blocks response includes the root course block, which no case handles, so it falls through to default. The message is self-contradictory: it flags course as "unexpected" while its own text lists course among the expected types (and the text also omits vertical/lock, which the switch does handle).
Impact
Low — info level, no functional effect. But it fires once per course-outline normalization, i.e. on essentially every courseware page load, polluting telemetry with a benign "unexpected" page action.
Provenance / scope
- Introduced in #1375 (course outline sidebar); it predates and is unrelated to the Redux → React Query migration (#1946). The path that emits it — the
getCourseOutlineStructurethunk →normalizeOutlineBlocks— is still Redux and untouched by the migration (verified via git history: thelogInfoline traces to #1375, andutils.jsis unmodified on the migration branches). - Standalone bug; not a sub-issue of the migration epic.
Suggested fix
Add a case 'course': that no-ops (the root block maps to no section/sequence/unit model), so it's skipped rather than logged. Optionally correct the default message to list the block types actually handled.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/courseware/data/utils.js at normalizeOutlineBlocks and inspect the switch handling course-outline block types. Ensure the root course block is skipped without emitting the unexpected-type info log, then verify that normal chapter, sequential/lock, and vertical handling remains unchanged. Check the default message against the block types handled by the switch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100