fix(learn): greptile review comments + swap arrow chars for lucide icons#43
fix(learn): greptile review comments + swap arrow chars for lucide icons#43devin-ai-integration[bot] wants to merge 2 commits into
Conversation
- python-runner.worker.js: reset cached pyodide promise on load failure so a single CDN hiccup doesn't permanently brick the runner for the session (P1) - python-runner.worker.js: collect stdout/stderr as byte arrays and decode with TextDecoder at the end instead of O(n^2) char-by-char string concat (P2) - LessonWorkspace.tsx: validate the stored language preference against the known LessonLanguage set before returning it from localStorage (P2) - LessonWorkspace.tsx: tear down all language workers on component unmount via terminateAllRunners() so pending jobs and kill timers don't leak when the user navigates away mid-run (P2) Co-Authored-By: Lakkhan Madarchod <ayush1337@hotmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Greptile SummaryThis PR is a focused follow-up to #42 that fixes four issues flagged in the previous review: resetting the cached Pyodide promise on CDN failure, switching stdout/stderr collection from O(n²) string concatenation to a byte-array buffer, adding a runtime guard on the localStorage language preference, and wiring up a
Confidence Score: 5/5All four changes are narrowly scoped, correctly implemented, and introduce no new side-effects. The Pyodide promise reset is correctly placed in both the inner IIFE catch and the outer await catch; microtask scheduling in the worker's single-threaded event loop eliminates any interleaving hazard between the two resets. The byte-array switch is a straightforward correctness and performance improvement that also incidentally fixes UTF-8 multi-byte output (previously mangled by String.fromCharCode). The localStorage guard and the cleanup useEffect are small, well-isolated changes with no surprising interactions. No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "fix(learn): address greptile review comm..." | Re-trigger Greptile |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
codejeet | 7e76637 | Commit Preview URL Branch Preview URL |
May 16 2026, 09:58 AM |
…ext links Replace unicode \u2190 / \u2192 with ArrowLeft / ArrowRight from lucide-react in: - components/learn/LessonWorkspace.tsx (course back link + prev/next pagination) - components/learn/QuizWorkspace.tsx (course back link) - app/learn/[course]/page.tsx (Learn back link) Each link now uses inline-flex with a 1.5-unit gap so icon and text sit on the same baseline. Sizes scale with text: h-3.5/w-3.5 for text-xs, h-4/w-4 for text-sm. Co-Authored-By: Lakkhan Madarchod <ayush1337@hotmail.com>
Devin Test Results — All 4 tests passedTested on branch preview: https://devin-1778869109-greptile-pr42-fixes-codejeet.shydev.workers.dev
Heads-up (non-blocking)
Before vs After (most adversarial check)Production still has the raw chars; PR #43 preview has lucide icons. Same URL path, different output. 🔴 BEFORE — production codejeet.comDOM: 🟢 AFTER — PR #43 branch previewDOM: Test 4 — localStorage poison + reloadSet Not visually tested (intentional)The remaining greptile fixes are correct by code review and CI build but not visually distinguishable in a recording:
Greptile re-reviewed PR #43 with 5/5 confidence on these. Devin session: https://app.devin.ai/sessions/37c6cc147b4e4ff1bf85ae32a42cf61d |
Summary
Follow-up to #42 addressing the four greptile-apps review comments left on that PR, plus a small UI polish (raw unicode arrows replaced with lucide icons after user feedback that the back-link UI looked bad).
Greptile review fixes
public/learn-runtime/python-runner.worker.jspyodidePromisetonullwhen the Pyodide load rejects, so a single CDN failure (network blip, bad version path, etc.) doesn't permanently brick the Python runner for the rest of the session. Added a belt-and-suspenders second reset in the outer await as well.public/learn-runtime/python-runner.worker.js+=, which is O(n²) overall. Switched to a byte-array buffer and a singleTextDecoder.decodeat the end.components/learn/LessonWorkspace.tsxloadLanguagePref()was casting the raw localStorage value straight toLessonLanguage. A stale or tampered value (e.g."rust") would slip through. Now validates against anALL_LESSON_LANGUAGES-derived set before returning.components/learn/LessonWorkspace.tsxterminateAllRunners()but it was never called. Added auseEffectcleanup so that pending jobs and the main-thread kill timer get torn down when the user navigates away mid-run.UI polish
Swapped raw unicode arrows (
←,→) forlucide-reacticons on the learn back/prev/next links in three places:components/learn/LessonWorkspace.tsx— course back link (text-xs) + lesson prev/next pagination (text-sm)components/learn/QuizWorkspace.tsx— course back linkapp/learn/[course]/page.tsx— Learn back linkEach link is now
inline-flexwith a 1.5-unit gap so the icon and text share a baseline; icon size scales with the link's text size (h-3.5 w-3.5fortext-xs,h-4 w-4fortext-sm).Review & Testing Checklist for Human
/learn/arrays-easy/01-largest-element, switch to Python, click Submit. Should still report 5/5 (regression check — same pyodide path, just different stdout collection).localStorage["codejeet:learn:v2:lang"] = "rust", reload the page. The language selector should fall back to the course default instead of trying to render Rust./learn/arrays-easy(Learn back),/learn/arrays-easy/01-largest-element(Arrays — Easy back + Next lesson), and/learn/arrays-easy/quiz/01-array-basics(course back).Notes
lib/learn/generated.tseven thoughbun run prebuildproduces a diff againstmain. The diff is purely stylistic (quoted vs unquoted JSON keys) and orthogonal to the review comments — keeping the PR focused on the actual fixes.errorKind: "internal"but the next Submit will trigger a fresh load attempt instead of re-awaiting the bad promise.useEffect(() => () => terminateAllRunners(), [])cleanup runs on unmount only (empty deps). Switching language within the same lesson does not tear down workers, which is the desired behavior — we want to keep the warmed-up Pyodide/browsercc instances around for subsequent Submits.Link to Devin session: https://app.devin.ai/sessions/37c6cc147b4e4ff1bf85ae32a42cf61d
Requested by: @ayush-that