openedx / openedx/frontend-app-learning

Spurious info log for the root `course` block in normalizeOutlineBlocks

Open Beginner friendly
#2,059 0 comments 0 reactions 0 assignees View on GitHub

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 getCourseOutlineStructure thunk → normalizeOutlineBlocks — is still Redux and untouched by the migration (verified via git history: the logInfo line traces to #1375, and utils.js is 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.