Repository navigation
TIG-282: import taken and current courses from a transcript PDF - #547
Windshield-Viper wants to merge 23 commits into
Conversation
Header -> Import transcript: the student uploads the TigerHub unofficial transcript PDF, reviews the courses found (taken / taking now, target semester), and adds the ones they choose to the active plan. - POST /api/v1/import_transcript/ parses the PDF in memory with pypdf and returns a preview. Nothing is stored or saved; grades are never returned. - tigerpath/transcript.py: tolerant term/course/status parser, runnable locally to check a real transcript without uploading it. - Courses already in the plan, outside the four years, or missing a class year can't be added; catalog misses are listed. - Chosen courses are added with one normal schedule save. - Tests: 10 backend (parser, real PDF extraction, endpoint, no-save, bad uploads) and frontend helper tests. Decision log: docs/decisions/TIG-282-transcript-import.md Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Checked against a real TigerHub "Undergraduate Internal Transcript" PDF:
- open PDFs encrypted with an empty open-password (TigerHub's are);
- allow column spacing between dept and number ("COS 226");
- read status by column (grade basis, title, grade), skipping the
trailing Distrib Area, so taken courses aren't shown as in progress
and a title ending in "B" or an AUD basis is never a grade.
Regression tests use made-up courses in the same layout.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c51abfbacc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| # "Fall 2023", "Spring Term 2024" | ||
| _TERM_CALENDAR = re.compile(r"\b(Fall|Spring)(?:\s+Term)?\s+(\d{4})\b", re.IGNORECASE) | ||
| # Summer and other non-fall/spring terms end the current term so their courses aren't misfiled. | ||
| _TERM_OTHER = re.compile(r"\b(Summer|Winter|Intersession)\b(?:\s+Term)?\s+\d{4}", re.IGNORECASE) |
There was a problem hiding this comment.
Recognize year-first nonstandard terms
Handle non-fall headings in the same year-first format supported for fall and spring. For example, after 2022-2023 Spring, the heading 2022-2023 Summer does not match _TERM_OTHER, so the previous spring remains active and every summer course is returned as Spring 2023 instead of being skipped. This can cause summer or winter courses to be selected by default and imported into the wrong semester.
Useful? React with 👍 / 👎.
The import review step gets an "Add to" dropdown (defaults to the current plan). Importing into another plan switches to it, waits for its schedule, then adds the courses with one normal save, skipping any already there and saying how many in the confirmation. No backend change. Decision log D6 revised. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Placement depends entirely on the profile's class year; saying it in the review step makes a wrong year obvious before anything is added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
'2022-2023 Summer' wasn't recognised as a term heading, so summer courses were filed under the previous spring. Summer, winter and intersession headings now match in both orders, like fall and spring. Regression test added. (Codex review on #547.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3da422e7a3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| useEffect(() => { | ||
| if (!pendingImport || activePlanId !== pendingImport.planId || !schedule) return; | ||
| setPendingImport(null); | ||
| finishImport(pendingImport.rows, schedule, activePlan?.name); |
There was a problem hiding this comment.
Don't save imports after a failed plan load
When importing into another plan, a failed getSchedule() request is converted to emptySchedule(), which satisfies this effect and calls finishImport; if the subsequent save succeeds, the imported rows replace the target plan's entire existing schedule. Preserve the load error state and abort the pending import instead of treating the fallback schedule as successfully loaded.
Useful? React with 👍 / 👎.
When importing into another plan, a failed schedule load fell back to an empty schedule, which the pending import then saved, replacing the plan's real courses. The load failure is now tracked and the import is cancelled with an error notice instead. (Codex review on #547, P1.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 307228b594
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (targetPlanId == null || targetPlanId === activePlanId) { | ||
| if (!schedule) return Promise.resolve(0); | ||
| return Promise.resolve(finishImport(rows, schedule, activePlan?.name)); |
There was a problem hiding this comment.
Block imports when the active plan failed to load
When getSchedule() fails for the currently active plan, loadPlanContents exposes an empty placeholder and sets scheduleLoadFailed, but this branch checks only whether schedule is present and immediately saves the imported rows over that placeholder, replacing the plan's existing courses. The newly added failure guard covers only pending imports after switching plans; apply the same guard before calling finishImport for the active plan.
Useful? React with 👍 / 👎.
…d to load The failed-load guard only covered importing into another plan. Importing into the current plan after its schedule failed to load still saved over the empty placeholder. Same guard now applies to both paths. (Codex review on #547.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f499d2dba4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| _TERM_OTHER = re.compile( | ||
| r"\b(?:(?:Summer|Winter|Intersession)(?:\s+Term)?\s+\d{4}" | ||
| r"|\d{4}\s*[-\u2013/]\s*\d{2,4}\s+(?:Summer|Winter|Intersession))\b", |
There was a problem hiding this comment.
Recognize season-first academic summer terms
When a nonstandard term uses the same season-first academic-year format already accepted for spring, such as Summer Term 2022-23, this regex does not match because its season-first branch accepts only a single four-digit year. The previous fall or spring term therefore remains active, causing courses under that heading to be imported into the wrong semester instead of skipped. The year-first case from the prior review is fixed; this equivalent season-first format remains uncovered.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Checked this one: those headings are already recognised. The season-first branch matches Summer Term 2022 and the -23 after it doesn't block the match, so Summer Term 2022-23, Summer 2022-2023 and Intersession 2023-2024 all end the previous term and their courses are skipped. Added regression tests for exactly these formats (including a summer course after a spring term) in b2ee8f1.
'Summer Term 2022-23', 'Summer 2022-2023' and 'Intersession 2023-2024' were already recognised (the season-first pattern matches the first year); these tests make that explicit, including a summer course being skipped after a spring term. Responds to a Codex review note on #547. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b2ee8f1885
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (!pendingImport || activePlanId !== pendingImport.planId || !schedule) return; | ||
| setPendingImport(null); |
There was a problem hiding this comment.
Wait for the target plan's own schedule response
When an older getSchedule() request is still in flight during the plan switch, its response can populate schedule after activePlanId changes but before the target plan's request finishes. This condition accepts that unrelated schedule, clears pendingImport, and finishImport then saves the previous plan's courses plus the import over the target plan. Associate schedule loads with the requested plan or await the target plan's specific load before completing the import.
Useful? React with 👍 / 👎.
| if columns and columns[0].upper() in _GRADE_BASIS: | ||
| columns = columns[1:] |
There was a problem hiding this comment.
When a transcript contains an AUD grade-basis row with no grade, this removes the only audit marker and the later blank-grade fallback classifies the course as currently taking. Such rows are selected by default and saved as ordinary courses, so an audited course can incorrectly satisfy requirements; reject AUD rows or mark them non-addable instead of treating them as current enrollment.
Useful? React with 👍 / 👎.
- Plan loads now carry a sequence number and only the newest may set the schedule. A slow response for the previous plan arriving after a switch could otherwise be taken as the target plan's schedule, and a pending import would save the wrong plan's courses over it. Verified with delayed responses. - Transcript rows with grade basis AUD are skipped: audits earn no credit and must not be imported as courses that satisfy requirements. (Codex review on #547.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0479d1bae1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const importCourses = useCallback( | ||
| (rows, targetPlanId = activePlanId) => { | ||
| if (targetPlanId == null || targetPlanId === activePlanId) { | ||
| if (!schedule) return Promise.resolve(0); |
There was a problem hiding this comment.
Wait for the active plan schedule before importing
When the active plan's schedule is still loading, the modal treats schedule === null as an empty plan, enables Add, and closes after invoking this branch; this then resolves with 0 without importing anything or displaying an error. This can occur during initial startup or any plan reload when the transcript upload finishes before getSchedule(), so keep the import pending until the schedule arrives or disable confirmation while it is unavailable.
Useful? React with 👍 / 👎.
Clicking Add while the current plan was still loading did nothing and said nothing. The import now waits for that plan's schedule (the same pending path as importing into another plan) and reports an error if the load fails. (Codex review on #547.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 64e9eba01f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (!schedule) { | ||
| // Still loading: finish the import once this plan's schedule arrives (the effect below), | ||
| // or report the failure if the load fails. | ||
| setPendingImport({ planId: activePlanId, rows }); |
There was a problem hiding this comment.
Cancel pending import when leaving its plan
When Add is clicked while the active plan's schedule is still loading, this queues the import; if the user then selects another plan before that load completes, loadSeq invalidates the original request while pendingImport remains tied to the old plan. Nothing is imported at that point, and switching back to the old plan later unexpectedly applies the stale import. Clear the pending operation when its target is abandoned, or ensure its target schedule is loaded and saved independently of subsequent navigation.
Useful? React with 👍 / 👎.
An import queued while a plan was loading stayed pending if the student switched to another plan, then applied unexpectedly on returning. It is now cancelled with a notice when the student goes to any plan other than its target (the import's own switch is exempt). (Codex review on #547.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a454d7b255
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| _COURSE = re.compile(r"^\s*([A-Z]{3})\s*(\d{3}[A-Z]?)\b(.*)$") | ||
| # Layout-mode text separates table columns with runs of 2+ spaces. | ||
| _COLUMN_GAP = re.compile(r"\s{2,}") | ||
| _GRADES = {"A+", "A", "A-", "B+", "B", "B-", "C+", "C", "C-", "D", "F", "P", "INC"} |
There was a problem hiding this comment.
Skip courses with failing grades
When a transcript row has an F, _grade_status classifies it as TAKEN, so it is selected by default and saved as an ordinary course. Because the schedule and requirement verifier retain neither grade nor status, that failed course can then satisfy requirements despite earning no credit; handle F like W/AUD or otherwise make the row non-addable.
Useful? React with 👍 / 👎.
| if (!pendingImport) return; | ||
| // The student went to some other plan before the import finished: drop it rather than apply it | ||
| // later, out of the blue. (Moving from the starting plan to the target is the import's own switch.) | ||
| if (activePlanId !== pendingImport.planId && activePlanId !== pendingImport.fromPlanId) { |
There was a problem hiding this comment.
Cancel imports when returning to the source plan
When an import switches from plan A to plan B, if the user returns to A before B's schedule finishes loading, this condition exempts A because it equals fromPlanId; the pending import therefore survives and is unexpectedly applied the next time B is opened. The fresh evidence after the earlier cancellation review is the newly added fromPlanId exemption here, which should only permit the import's initial transition, not a later navigation back to the source.
Useful? React with 👍 / 👎.
- Rows graded F are skipped like W and AUD: they earn no credit and must not satisfy requirements. - A pending import is exempt from cancellation only while its own plan switch is in flight; returning to the starting plan afterwards now cancels it instead of leaving it to apply later. (Codex review on #547.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af04b1f824
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // later, out of the blue. Only while the import's own switch is in flight may the active plan | ||
| // still be the starting plan; going back to it afterwards cancels too. | ||
| const ownSwitch = importSwitching.current && activePlanId === pendingImport.fromPlanId; | ||
| if (activePlanId !== pendingImport.planId && !ownSwitch) { |
There was a problem hiding this comment.
Invalidate pending imports when any plan switch starts
When an import is queued because the active plan's schedule is still loading and the user then selects another plan, this check continues treating the old plan as active until setActivePlan's response is applied. The server may already have activated the newly selected plan when the old getSchedule response lands, allowing this effect to call finishImport; commitSchedule then posts the old plan's schedule and imported rows to the server-active plan, overwriting that plan. Cancel the pending import and invalidate its load when selectPlan is invoked, or bind schedule loads and saves to explicit plan IDs.
Useful? React with 👍 / 👎.
The server activates the new plan as soon as set_active_plan lands, before the client applies the response. A slow schedule load for the old plan arriving in that window could complete a pending import, and the save would go to the newly active plan. Starting any plan switch now bumps the load sequence so those responses are ignored; the pending import is then cancelled. Verified with delayed responses. (Codex review on #547.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d9243b4dbc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if len(token) == 1: | ||
| beside = [ | ||
| t | ||
| for t in (tokens[i - 1] if i else "", tokens[i + 1] if i + 1 < len(tokens) else "") | ||
| ] | ||
| if not any(_NUMERIC.match(t) for t in beside if t): | ||
| return CURRENT |
There was a problem hiding this comment.
Skip withdrawn rows after collapsed-column extraction
When layout extraction fails and the plain-text fallback produces a row such as ECO 100 GRD Intro to Microeconomics W SA, the loop skips SA and then returns CURRENT here because the single-letter W has no adjacent number. The withdrawn course is consequently selected by default and can satisfy requirements as an ordinary planned course; recognize W before applying the ambiguous title-ending-letter fallback.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed this needs handling, but recognising W here would bring back the earlier issue (a title ending in W, or F, getting dropped). Without columns the two can't be told apart, so fa19189 stops guessing: a lone grade letter with no credit number next to it marks the row Check grade, shown unchecked in the review list. A possible withdrawal is never added automatically and a real course is never silently dropped; tests cover both.
Without table columns, a row ending in a lone grade letter can't be told
apart from a title ending ('Part B') or a withdrawal ('Microeconomics W').
Earlier fallbacks either dropped such rows or kept them as in progress.
They are now marked 'Check grade' and shown unchecked: a possible
withdrawal is never added automatically, and a real course is never
silently dropped. Letters next to credit numbers still count as grades.
(Codex review on #547.)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fa191898cc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (id === activePlanId) return Promise.resolve(); | ||
| // The server switches plans as soon as this request lands, so a slower load for the plan | ||
| // we're leaving must not count any more (an import waiting on it would save to the new plan). | ||
| loadSeq.current += 1; |
There was a problem hiding this comment.
Invalidate loads for all active-plan mutations
The new sequence invalidation only covers selectPlan, but createPlan, copyPlan, and deletion of the active plan also change the server-side active plan. If one of these actions runs while a transcript import is waiting for the current schedule, the prior getSchedule() can resolve after the server switches plans but before planAction applies its response; the pending-import effect then accepts that schedule under the old activePlanId and posts it to the newly active plan, potentially replacing an existing replacement plan. Invalidate/cancel pending loads before every action that can change the active plan, not only tab selection.
Useful? React with 👍 / 👎.
| loadSeq.current += 1; | ||
| return planAction(api.setActivePlan(id)); |
There was a problem hiding this comment.
Reload after a failed plan switch
Because the current load is invalidated before setActivePlan settles, a rejected switch leaves the still-active plan without a usable load: when the user clicks another plan during initial loading or a reload, the original response is ignored, while planAction starts a replacement load only on success. The UI can therefore remain on “Loading your plan...” until another action or full refresh; recover by reloading the current plan when the switch fails.
Useful? React with 👍 / 👎.
| _COURSE = re.compile(r"^\s*([A-Z]{3})\s*(\d{3}[A-Z]?)\b(.*)$") | ||
| # Layout-mode text separates table columns with runs of 2+ spaces. | ||
| _COLUMN_GAP = re.compile(r"\s{2,}") | ||
| _GRADES = {"A+", "A", "A-", "B+", "B", "B-", "C+", "C", "C-", "D", "P", "INC"} |
There was a problem hiding this comment.
Do not count INC as a completed course
When a transcript contains INC, this set makes _grade_status classify it as TAKEN, so the UI preselects it and the saved schedule—where grade/status is discarded—can satisfy requirements as though credit were earned. Princeton defines INC as a course not completed at the end of the term, so incomplete rows should not be imported as completed courses by default.
Useful? React with 👍 / 👎.
- Create, copy and delete can change the server's active plan just like a tab switch, so they now also invalidate in-flight loads for the plan being left (a waiting import can't save onto the new plan). - If any of those actions fails, the current plan is reloaded so it never stays stuck on 'Loading your plan...'. - INC (incomplete: not finished at the end of the term) is no longer treated as completed; such rows are 'Check grade', unchecked. (Codex review on #547.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a3f8d600ec
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| } else if (seen.has(id)) { | ||
| reason = 'Listed twice on the transcript'; | ||
| } | ||
| if (!reason) seen.add(id); |
There was a problem hiding this comment.
Prefer a completed repeat over an unclear attempt
When a course first appears with INC or another unclear grade and is later repeated with a passing grade, this records the unclear row in seen, so the completed row is disabled as “Listed twice on the transcript.” Because the unclear attempt is unchecked by default, nothing is imported unless the student manually selects it, and doing so places the course in the incomplete attempt's semester rather than the semester where it was completed. Deduplicate repeated courses by preferring a completed occurrence over an unclear one.
Useful? React with 👍 / 👎.
When a course appeared first as INC/unclear and later with a passing grade, the first (unchecked) row blocked the completed one as 'Listed twice'. Repeats now keep the first taken/in-progress row, falling back to the first row only if every attempt is unclear. Test added. (Codex review on #547.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 93e14bb118
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const payload = await response.json().catch(() => ({})); | ||
| if (!response.ok) throw new Error(payload.error || 'Could not read that transcript. Please try again.'); |
There was a problem hiding this comment.
Reject login redirects during transcript upload
When the user's session expires before uploading, the endpoint's @login_required redirects the POST to the login page; fetch follows that redirect and receives a successful HTML response. The JSON parse failure is converted to {}, and because the redirected response is still ok, the modal treats it as a valid empty preview and incorrectly says that no Princeton courses were found. Reject redirected/non-JSON responses or validate the preview payload before returning it.
Useful? React with 👍 / 👎.
An expired session redirects the upload to the login page, which answers
200 with HTML; that used to read as an empty preview ('No Princeton
courses were found'). Redirected or non-JSON responses now raise a
'session expired' error, and the preview shape is validated.
(Codex review on #547.)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 87550d8154
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const changeActivePlan = useCallback( | ||
| (makeRequest) => { | ||
| loadSeq.current += 1; | ||
| return planAction(makeRequest()).catch((error) => { |
There was a problem hiding this comment.
Ignore stale active-plan action responses
When an import's switch to plan B is still pending and the user starts another active-plan action for plan C, this increment invalidates only loads that already exist. If B's response arrives afterward, its planAction starts a newer loadPlanContents() request; that request can read server-active C while the client applies B's response, causing the pending-import effect to accept C's schedule as B's and save the imported contents back over C. Sequence or ignore stale plan-action responses, or bind schedule reads and writes to explicit plan IDs, rather than sequencing only their follow-up loads.
Useful? React with 👍 / 👎.
If an import's switch to plan B was still in flight when the student started another plan change (to C), B's late response could start a load that read server-active C as B's schedule, and the pending import would save onto C. Active-plan actions are now sequenced: an older action's response is ignored once a newer one has started. Verified with delayed switches. (Codex review on #547.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6c785fc212
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const seq = ++actionSeq.current; | ||
| return makeRequest().then( | ||
| (payload) => { | ||
| if (seq !== actionSeq.current) return payload; // overtaken by a newer plan action |
There was a problem hiding this comment.
Reconcile the server after ignoring a stale plan action
When switches to plans B and C overlap and C completes first, the ignored B request can still finish last and make B active on the server; the client remains pointed at C, so C's load or a later schedule save can read from or overwrite B. Fresh evidence in the current code is that set_active_plan writes active_plan_id before returning (tigerpath/views.py:970-974), so ignoring the stale response here does not undo its server-side mutation; serialize these actions or explicitly restore the newest requested plan after a stale completion.
Useful? React with 👍 / 👎.
| .createPlan() | ||
| .then((payload) => | ||
| api.updatePlanSettings({ planId: payload.activePlanId, name, majorIds, minorCodes }) | ||
| ) |
There was a problem hiding this comment.
Recover state after partially creating a plan
When createPlan() succeeds but the subsequent updatePlanSettings() request rejects, the server has already created and activated the new plan, while changeActivePlan handles the rejection by reloading without applying a plans payload. The UI therefore retains the previous activePlanId and plan list but loads the new plan's schedule, so subsequent edits are saved to a plan different from the tab being shown; refresh/apply the newly created plan on this partial-failure path or roll it back.
Useful? React with 👍 / 👎.
- Active-plan changes are queued and run in order, so overlapping switches can't leave the server on one plan and the page on another. - After a failed or half-finished plan change (e.g. a plan created but its settings save failed), the page re-reads the plan list and the active plan so it matches the server. Verified with delayed and failing requests. (Codex review on #547.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a32aa6a2fb
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if columns and columns[0].upper() == "AUD": | ||
| return None # audited: no credit, so it can't count toward requirements; skip it |
There was a problem hiding this comment.
Detect audit basis after cross-listing text
When a layout-preserving row uses the advertised cross-listing form, such as COS 126/EGR 126 AUD Music Theory LA, _COURSE leaves /EGR 126 in columns[0], so this first-column-only check misses the AUD basis and _status returns CURRENT for the blank-grade audit. The UI then preselects and imports a no-credit audited course, allowing it to satisfy requirements. Fresh evidence relative to the earlier AUD finding is the optional cross-listing text inserted before the grade-basis column; detect the basis after that prefix as well.
Useful? React with 👍 / 👎.
A row like 'COS 126/EGR 126 AUD ...' left '/EGR 126' in front of the grade-basis column, so the audit wasn't detected. Extra cross-listed codes after the first are now stripped before the columns are read. Test added. (Codex review on #547.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 503a042515
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const finishImport = useCallback( | ||
| (rows, targetSchedule, planName) => { | ||
| const { schedule: next, added, skipped } = applyImport(targetSchedule, rows); | ||
| if (added > 0) commitSchedule(next); |
There was a problem hiding this comment.
Queue plan switches behind the import save
When importing into another plan and the user switches away immediately after the success notice, this starts an asynchronous schedule save without awaiting or serializing it with changeActivePlan. Because update_schedule resolves the destination from the server's current active plan rather than an explicit plan ID, if the subsequent switch is processed first, the imported target schedule is written over the newly active plan. Wait for the save before permitting the next active-plan action, or bind the save to the intended plan.
Useful? React with 👍 / 👎.
| // A failed or half-finished action (e.g. a plan created but not named) may still have changed | ||
| // the server: re-read the plan list and the active plan so the page matches it. | ||
| if (seq === actionSeq.current) { | ||
| api.getPlans().then(applyPlans).catch(() => {}); |
There was a problem hiding this comment.
Discard stale recovery plan-list responses
When an active-plan action fails and the user starts another plan action before this recovery getPlans() resolves, its unsequenced response can arrive after the newer action succeeds and reset activePlanId to the older server state. The newer schedule load remains current, so the UI can show one plan's tab with another plan's schedule and subsequent edits are saved to the wrong plan; guard this recovery response with the action sequence or make recovery part of the serialized queue.
Useful? React with 👍 / 👎.
The server saved schedules to whichever plan was active, so a save in flight during a plan switch, or an import into another plan, could land on the wrong plan. Loads and saves now take a planId (optional; the classic UI is unchanged), the planner saves to the plan its schedule came from, and imports into another plan read and save that plan by id instead of switching first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…witches Opening the target plan now waits until the import is saved, so the old copy can't be loaded and edited over it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Replaced by #548 (same code, plus the plan-scoped save fix), to start from a clean review thread. |
TIG-282: import taken and current courses from a transcript
Closes TIG-282. Base:
parallel-planning/view. Independent of TIG-330/337.What it does
Header → Import transcript. The student uploads the TigerHub unofficial transcript PDF. TigerPath lists the courses it found, each marked Taken or Taking now with the semester it'll go in. The student unchecks anything they don't want, picks which plan to Add to (defaults to the current plan), and confirms. The courses are added with one normal schedule save. Adding to another plan switches to it first and skips any courses already there; the confirmation says how many. The review step also says which class year it used for placement, so a wrong year in Settings shows up before anything is added.
Changes
tigerpath/transcript.py: the parser, written as small pure functions.COS 226orCOS126.IPmeans currently taking;W(withdrawn) is skipped.python -m tigerpath.transcript TRANSCRIPT.pdf [CLASS_YEAR]prints codes, terms and status, never grades.POST /api/v1/import_transcript/: login required. It parses the PDF in memory and returns a preview.ImportTranscriptModal, plushelpers/transcript.jsfor building the review rows and applying the import. The planner gets animportCoursesaction, and the header gets the new button.pypdf==6.21.4(pure Python).Rows that can't be added
Courses missing from the catalog are listed as "not added".
Testing
pytest tigerpath: 49 pass, 13 of them new. They cover the parser, extraction from generated PDFs, the TigerHub column layout, PDFs with an empty versus a real password, the endpoint (no save, no grades), bad uploads, login, and the no-class-year case.bun run test: helper tests pass.vite build: passes. ruff: clean on the new files.Not yet verified
A real transcript with finished terms, that is, letter grades in the Grade column. The layout is the same and tests cover it.
Decisions
docs/decisions/TIG-282-transcript-import.md. D6 was revised in review: import now lets you choose the plan.Merging with #545 and #546
This PR is independent of them. If it merges after #546,
App.jsx,usePlanner.js,Icon.jsxandstyles.cssconflict, but both sides only add code, so keep both. Forstyles.css, paste each branch's added section in whole rather than accepting git's line-by-line merge, which interleaves the two blocks and breaks the braces. A combined build with all three PRs passes its tests on a local branch. One spot needs more than keep-both: inusePlanner.js,selectPlanshould keep #546's compare-swap logic but make itsapi.setActivePlancalls through this PR'schangeActivePlan(() => ...), with both PRs' dependencies in theuseMemolist.Screenshots
Upload
Review, with the Add to picker and the class year it used
🤖 Generated with Claude Code