fix(student): address review feedback on time-slot error classification (main-v1 backport) - #1409
Open
JoelJosephPhilip wants to merge 1 commit into
Conversation
…on (main-v1 backport) Same fix as the main-branch follow-up on vicharanashala#1399. Extracts the ForbiddenError message-matching logic out of the inline regex into classifyItemForbiddenError, a small pure function, so the message-matching rules can be unit tested directly. Also addresses the review points raised on vicharanashala#1399: - Documents the exact backend message strings this matches against, including the two other known-but-not-time-slot messages (archived course version, out-of-order progression) and the "not enrolled" message, which is a known, deliberately unfixed gap: it isn't really a time-slot issue, so it isn't routed to the amber banner, but it's also not really "lesson locked" either. - Adds a console.warn fallback for any ForbiddenError message that doesn't match a known pattern, so a future backend wording change surfaces in the console instead of silently falling back to the generic locked-lesson message. - Adds unit tests pinning all three real time-slot message variants, confirming the archived-course and out-of-order-progression messages are correctly NOT classified as time-slot, and confirming a novel message is flagged as unrecognized. The original main-v1 backport (vicharanashala#1400) already merged before this review feedback came in, so this is a separate follow-up PR rather than an update to that one.
JoelJosephPhilip
had a problem deploying
to
jest-test
September 17, 2026 07:15 — with
GitHub Actions
Failure
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
This is the main-v1 counterpart of the review-feedback follow-up on #1399 (the time-slot error banner fix). #1400 (the original main-v1 backport) had already merged before Meenakshi's review landed on #1399, so this is a separate follow-up PR rather than an update to an already-merged one.
Ports the same changes:
classifyItemForbiddenError, a small pure function, so it can be unit tested directly.console.warnfallback for any unrecognized ForbiddenError message.Test plan
tsc --noEmit: clean, 0 errors.vitest run: 32/32 passing (all frontend tests in the repo, including 6 new tests forclassifyItemForbiddenError).See the review discussion on #1399 for the full context: #1399 (comment) and #1399 (comment)