Conversation
WalkthroughThis update introduces new internal tools, scripts, and data structures, refines UI components, and removes legacy test scripts. Notable additions include a Python solutions data module, a submissions management hook, improved solution and submissions rendering in the problem solver, and a unified development startup script. Several test and integration scripts are deleted, and ESLint configuration is enhanced for contextual code linting. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ProblemSolver
participant useSubmissions
participant UserAttemptsService
participant pythonSolutions
User->>ProblemSolver: Open problem page
ProblemSolver->>useSubmissions: Fetch submissions (userId, problemId)
useSubmissions->>UserAttemptsService: getAcceptedSubmissions(userId, problemId)
UserAttemptsService-->>useSubmissions: Array of submissions
useSubmissions-->>ProblemSolver: { submissions, loading, error }
ProblemSolver->>pythonSolutions: Load solutions for problemId
pythonSolutions-->>ProblemSolver: Array of Solution objects
ProblemSolver->>User: Render problem, solutions, submissions, notes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~35 minutes Poem
Note 🔌 MCP (Model Context Protocol) integration is now available in Early Access!Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
This comment was marked as resolved.
This comment was marked as resolved.
4256892 to
62478c2
Compare
There was a problem hiding this comment.
Actionable comments posted: 13
🔭 Outside diff range comments (1)
src/pages/ProblemSolver.tsx (1)
120-151: Stabilise keyboard-shortcut listener
toggleLeft/Bottom/RightPanelare recreated on every render, so the effect’s dependency array changes each time, causing the globalkeydownlistener to be detached/attached on each render.
Wrap the three toggles inuseCallback(or move them outside component scope) and give the effect an empty dependency list to register the listener once.-const toggleLeftPanel = () => { … } +const toggleLeftPanel = useCallback(() => { … }, [showLeftPanel]);
🧹 Nitpick comments (5)
.github/workflows/ci.yml (2)
1-9: Add least-privilege permissions and cancel in-progress runsReduce GITHUB_TOKEN scope and cancel superseded runs to save CI minutes.
name: CI/CD Pipeline on: push: branches: [ main ] pull_request: branches: [ main ] +permissions: + contents: read + +concurrency: + group: ci-${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true
172-179: Optional: add job timeouts to avoid hanging runnersSet timeout-minutes per job to prevent stuck processes from burning CI minutes.
Example:
deploy-staging: name: Deploy to Staging - runs-on: ubuntu-latest + runs-on: ubuntu-latest + timeout-minutes: 15Consider similar timeouts for the other jobs (e.g., 20–30 minutes).
Also applies to: 175-176
src/pages/ProblemSolver.tsx (3)
39-47: Remove leftover debug effectThis
useEffectonly queries DOM nodes and stores them in an unused variable – it produces no side-effects and will keep running on every tab switch.
Drop it or convert it to a real implementation to avoid dead code.
81-106: Quoted string output may look odd
toCompactJsonreturnsJSON.stringify(value)for plain strings, so"abc"becomes"\"abc\"".
If the goal is to show raw strings (like test outputs) without double quoting, strip the outer quotes whentypeof value === 'string' && !looksLikeJson.
412-470: Unused helper – consider removing
toHumanReadableisn’t referenced anywhere in the component. Dead code increases bundle size and maintenance cost; delete it unless you plan to use it imminently.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.github/workflows/ci.yml(1 hunks)src/components/AIChat.tsx(3 hunks)src/pages/ProblemSolver.tsx(9 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/components/AIChat.tsx
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/ci.yml
24-24: the runner of "actions/cache@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🪛 YAMLlint (1.37.1)
.github/workflows/ci.yml
[error] 13-13: trailing spaces
(trailing-spaces)
[error] 56-56: trailing spaces
(trailing-spaces)
[error] 87-87: trailing spaces
(trailing-spaces)
[error] 90-90: trailing spaces
(trailing-spaces)
[error] 93-93: trailing spaces
(trailing-spaces)
[error] 101-101: trailing spaces
(trailing-spaces)
[error] 139-139: trailing spaces
(trailing-spaces)
[error] 143-143: trailing spaces
(trailing-spaces)
[error] 146-146: trailing spaces
(trailing-spaces)
[error] 150-150: trailing spaces
(trailing-spaces)
[error] 153-153: trailing spaces
(trailing-spaces)
[error] 162-162: trailing spaces
(trailing-spaces)
[error] 190-190: trailing spaces
(trailing-spaces)
[error] 210-210: no new line character at the end of file
(new-line-at-end-of-file)
🔇 Additional comments (1)
src/pages/ProblemSolver.tsx (1)
11-13: Verify new dependency inclusion
safe-stable-stringifyis imported but there’s no guarantee it’s listed inpackage.json. Ensure the dependency is added so builds don’t fail.
8b49ef5 to
1c5e64a
Compare
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (10)
.github/workflows/dev-test.yml (2)
47-54: Combine redirects when writing .env (SC2129)Use a grouped redirect or here-doc for clarity and shellcheck compliance.
- name: Create test environment for API working-directory: ./code-executor-api run: | - echo "PORT=3001" > .env - echo "JUDGE0_API_URL=https://judge0-extra-ce.p.rapidapi.com" >> .env - echo "SUPABASE_URL=test-url" >> .env - echo "SUPABASE_SERVICE_ROLE_KEY=test-key" >> .env + { + printf "PORT=3001\n" + printf "JUDGE0_API_URL=https://judge0-extra-ce.p.rapidapi.com\n" + printf "SUPABASE_URL=test-url\n" + printf "SUPABASE_SERVICE_ROLE_KEY=test-key\n" + } > .env
13-13: Fix YAML lint issues: trailing spaces and final newlineRemove trailing spaces on these lines and add a newline at end of file to satisfy yamllint.
Also applies to: 63-63, 66-66, 70-70, 73-73, 76-76, 79-79, 81-81, 90-90, 97-97
CI_CD_README.md (1)
8-8: Use proper headings instead of bold (MD036)Convert emphasis used as headings to actual Markdown headings for lint compliance.
-**Comprehensive testing and deployment pipeline** +#### Comprehensive testing and deployment pipeline @@ -**Quick testing for development branches** +#### Quick testing for development branchesAlso applies to: 42-42
.github/workflows/ci.yml (7)
56-61: Silence SC2034 and improve readiness checkAvoid unused loop variable by using timeout+until; keeps intent and removes shellcheck warning.
- for i in {1..60}; do - if curl -fsS http://localhost:4173/ > /dev/null; then - break - fi - sleep 1 - done + timeout 60s bash -lc 'until curl -fsS http://localhost:4173/ >/dev/null; do sleep 1; done'
95-101: Combine .env writes to avoid SC2129 and improve clarityGroup redirects so we don't append multiple times and stay lint-clean.
- printf "PORT=3001\n" > .env - printf "JUDGE0_API_URL=https://judge0-extra-ce.p.rapidapi.com\n" >> .env - printf "SUPABASE_URL=%s\n" "${SUPABASE_URL:-https://example.supabase.co}" >> .env - printf "SUPABASE_SERVICE_ROLE_KEY=%s\n" "${SUPABASE_SERVICE_ROLE_KEY:-dummy-service-role-key}" >> .env + { + printf "PORT=3001\n" + printf "JUDGE0_API_URL=https://judge0-extra-ce.p.rapidapi.com\n" + printf "SUPABASE_URL=%s\n" "${SUPABASE_URL:-https://example.supabase.co}" + printf "SUPABASE_SERVICE_ROLE_KEY=%s\n" "${SUPABASE_SERVICE_ROLE_KEY:-dummy-service-role-key}" + } > .env
113-118: Replace for-loop with timeout+until (SC2034)Removes unused loop variable and improves readability.
- for i in {1..60}; do - if curl -fsS http://localhost:3001/health > /dev/null; then - break - fi - sleep 1 - done + timeout 60s bash -lc 'until curl -fsS http://localhost:3001/health >/dev/null; do sleep 1; done'
160-167: Combine .env writes in integration job (SC2129)Group printf calls under a single redirection.
- printf "PORT=3001\n" > .env - printf "JUDGE0_API_URL=https://judge0-extra-ce.p.rapidapi.com\n" >> .env - printf "SUPABASE_URL=%s\n" "${SUPABASE_URL:-https://example.supabase.co}" >> .env - printf "SUPABASE_SERVICE_ROLE_KEY=%s\n" "${SUPABASE_SERVICE_ROLE_KEY:-dummy-service-role-key}" >> .env + { + printf "PORT=3001\n" + printf "JUDGE0_API_URL=https://judge0-extra-ce.p.rapidapi.com\n" + printf "SUPABASE_URL=%s\n" "${SUPABASE_URL:-https://example.supabase.co}" + printf "SUPABASE_SERVICE_ROLE_KEY=%s\n" "${SUPABASE_SERVICE_ROLE_KEY:-dummy-service-role-key}" + } > .env
190-196: Use timeout+until to wait for API (SC2034)Eliminates unused counter variable and keeps behavior.
- for i in {1..60}; do - if curl -fsS http://localhost:3001/health > /dev/null; then - break - fi - sleep 1 - done + timeout 60s bash -lc 'until curl -fsS http://localhost:3001/health >/dev/null; do sleep 1; done'
199-205: Use timeout+until to wait for frontend (SC2034)Same rationale as above.
- for i in {1..60}; do - if curl -fsS http://localhost:4173/ > /dev/null; then - break - fi - sleep 1 - done + timeout 60s bash -lc 'until curl -fsS http://localhost:4173/ >/dev/null; do sleep 1; done'
85-85: Standardize Node to 20.x across jobsUse 20.x to get latest patches on LTS and ensure consistency.
- node-version: '20' + node-version: '20.x'Also applies to: 150-150, 260-260
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
bun.lockbis excluded by!**/bun.lockb
📒 Files selected for processing (25)
.eslintrc.overrides.js(1 hunks).github/workflows/ci.yml(1 hunks).github/workflows/dev-test.yml(1 hunks)CI_CD_README.md(1 hunks)code-executor-api/server.js(3 hunks)eslint.config.js(1 hunks)package.json(2 hunks)scripts/dev-start.sh(1 hunks)src/components/AIChat.tsx(3 hunks)src/components/Notes.tsx(1 hunks)src/components/ui/command.tsx(1 hunks)src/components/ui/textarea.tsx(1 hunks)src/data/pythonSolutions.ts(1 hunks)src/hooks/useChatSession.ts(2 hunks)src/hooks/useProblems.ts(1 hunks)src/hooks/useSubmissions.ts(1 hunks)src/pages/ProblemSolver.tsx(9 hunks)src/services/userAttempts.ts(2 hunks)supabase/functions/ai-chat/index.ts(4 hunks)tailwind.config.ts(1 hunks)test-connection.js(0 hunks)test-dynamic-problems.js(0 hunks)test-judge0.js(0 hunks)test-leetcode-style.js(0 hunks)test-supabase-integration.js(0 hunks)
💤 Files with no reviewable changes (5)
- test-leetcode-style.js
- test-judge0.js
- test-dynamic-problems.js
- test-connection.js
- test-supabase-integration.js
✅ Files skipped from review due to trivial changes (2)
- src/hooks/useProblems.ts
- package.json
🚧 Files skipped from review as they are similar to previous changes (15)
- tailwind.config.ts
- src/components/ui/textarea.tsx
- .eslintrc.overrides.js
- src/services/userAttempts.ts
- eslint.config.js
- src/components/Notes.tsx
- src/components/ui/command.tsx
- scripts/dev-start.sh
- src/hooks/useChatSession.ts
- src/hooks/useSubmissions.ts
- code-executor-api/server.js
- src/components/AIChat.tsx
- src/data/pythonSolutions.ts
- supabase/functions/ai-chat/index.ts
- src/pages/ProblemSolver.tsx
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/ci.yml
44-44: shellcheck reported issue in this script: SC2034:warning:12:1: i appears unused. Verify use (or export if used externally)
(shellcheck)
95-95: shellcheck reported issue in this script: SC2129:style:3:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects
(shellcheck)
104-104: shellcheck reported issue in this script: SC2034:warning:9:1: i appears unused. Verify use (or export if used externally)
(shellcheck)
161-161: shellcheck reported issue in this script: SC2129:style:3:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects
(shellcheck)
172-172: shellcheck reported issue in this script: SC2034:warning:27:1: i appears unused. Verify use (or export if used externally)
(shellcheck)
263-263: shellcheck reported issue in this script: SC2015:info:1:26: Note that A && B || C is not if-then-else. C may run when A is true
(shellcheck)
.github/workflows/dev-test.yml
29-29: the runner of "actions/cache@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
49-49: shellcheck reported issue in this script: SC2129:style:2:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects
(shellcheck)
🪛 YAMLlint (1.37.1)
.github/workflows/dev-test.yml
[error] 13-13: trailing spaces
(trailing-spaces)
[error] 63-63: trailing spaces
(trailing-spaces)
[error] 66-66: trailing spaces
(trailing-spaces)
[error] 70-70: trailing spaces
(trailing-spaces)
[error] 73-73: trailing spaces
(trailing-spaces)
[error] 76-76: trailing spaces
(trailing-spaces)
[error] 79-79: trailing spaces
(trailing-spaces)
[error] 81-81: trailing spaces
(trailing-spaces)
[error] 90-90: trailing spaces
(trailing-spaces)
[error] 97-97: no new line character at the end of file
(new-line-at-end-of-file)
🪛 markdownlint-cli2 (0.17.2)
CI_CD_README.md
8-8: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
42-42: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
1c5e64a to
78734a5
Compare
There was a problem hiding this comment.
Actionable comments posted: 4
🔭 Outside diff range comments (1)
src/pages/ProblemSolver.tsx (1)
75-81: Keyboard handler re-registers on every render; memoize toggles and stabilize effecttoggleLeft/Bottom/RightPanel are recreated each render, so the keydown effect re-attaches every render. Memoize toggles with useCallback using functional updates and make the effect run once.
- const toggleLeftPanel = () => { - const newValue = !showLeftPanel; - setShowLeftPanel(newValue); - localStorage.setItem('showLeftPanel', JSON.stringify(newValue)); - }; + const toggleLeftPanel = useCallback(() => { + setShowLeftPanel(prev => { + const newValue = !prev; + localStorage.setItem('showLeftPanel', JSON.stringify(newValue)); + return newValue; + }); + }, []); - const toggleBottomPanel = () => { - const newValue = !showBottomPanel; - setShowBottomPanel(newValue); - localStorage.setItem('showBottomPanel', JSON.stringify(newValue)); - }; + const toggleBottomPanel = useCallback(() => { + setShowBottomPanel(prev => { + const newValue = !prev; + localStorage.setItem('showBottomPanel', JSON.stringify(newValue)); + return newValue; + }); + }, []); - const toggleRightPanel = () => { - const newValue = !showRightPanel; - setShowRightPanel(newValue); - localStorage.setItem('showRightPanel', JSON.stringify(newValue)); - }; + const toggleRightPanel = useCallback(() => { + setShowRightPanel(prev => { + const newValue = !prev; + localStorage.setItem('showRightPanel', JSON.stringify(newValue)); + return newValue; + }); + }, []); - }, [toggleLeftPanel, toggleBottomPanel, toggleRightPanel]); + }, []); // toggles are stable due to useCallbackAlso add missing imports:
-import { useState, useEffect, useRef } from 'react'; +import { useState, useEffect, useRef, useCallback, useMemo } from 'react';Also applies to: 108-119, 120-151
♻️ Duplicate comments (3)
.github/workflows/dev-test.yml (2)
23-27: Use Node 20.x and enable npm cache for API installAlign to active LTS and cache npm installs for speed and determinism.
- name: Setup Node.js for API uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '20.x' + cache: 'npm' + cache-dependency-path: 'code-executor-api/package-lock.json'
37-40: Prefer reproducible installs with npm cinpm ci is faster and respects the lockfile.
- name: Install API dependencies working-directory: ./code-executor-api - run: npm install + run: npm ci.github/workflows/ci.yml (1)
262-264: Don’t mask install failures (SC2015) in audit stepSeparate install from audit; only ignore audit exit code.
- - name: Audit frontend dependencies - run: bun install --production && bun audit || true + - name: Audit frontend dependencies + run: | + set -euo pipefail + bun install --production + bun audit || true
🧹 Nitpick comments (14)
.github/workflows/dev-test.yml (2)
47-54: Consolidate .env writes to satisfy shellcheck SC2129 and improve readabilityUse a heredoc to avoid multiple redirections.
- name: Create test environment for API working-directory: ./code-executor-api run: | - echo "PORT=3001" > .env - echo "JUDGE0_API_URL=https://judge0-extra-ce.p.rapidapi.com" >> .env - echo "SUPABASE_URL=https://example.supabase.co" >> .env - echo "SUPABASE_SERVICE_ROLE_KEY=dummy-service-role-key" >> .env + cat > .env <<'EOF' + PORT=3001 + JUDGE0_API_URL=https://judge0-extra-ce.p.rapidapi.com + SUPABASE_URL=https://example.supabase.co + SUPABASE_SERVICE_ROLE_KEY=dummy-service-role-key + EOF
13-13: YAML lint fixes: trailing spaces and EOF newlineRemove trailing spaces (Line 13, Line 105) and add a newline at EOF (Line 112) to satisfy yamllint.
Also applies to: 105-105, 112-112
CI_CD_README.md (3)
8-8: Use proper headings instead of bold text (MD036)Convert emphasized lines to headings for markdownlint compliance.
-**Comprehensive testing and deployment pipeline** +#### Comprehensive testing and deployment pipeline @@ -**Quick testing for development branches** +#### Quick testing for development branchesAlso applies to: 42-42
21-26: Doc inconsistency: Node.js version is 20 in workflows, not 18Update the doc to match the workflows.
-2. **test-api** - Tests the Node.js API server - - Uses Node.js 18 +2. **test-api** - Tests the Node.js API server + - Uses Node.js 20
126-131: Replace placeholder badge URLs before mergingUse the actual org/repo to avoid broken badges.
.github/workflows/ci.yml (4)
93-101: Consolidate .env writes (SC2129) with heredocShellcheck flags multiple >> redirects; use a heredoc.
- name: Create API environment file working-directory: ./code-executor-api run: | - set -euo pipefail - printf "PORT=3001\n" > .env - printf "JUDGE0_API_URL=https://judge0-extra-ce.p.rapidapi.com\n" >> .env - printf "SUPABASE_URL=%s\n" "${SUPABASE_URL:-https://example.supabase.co}" >> .env - printf "SUPABASE_SERVICE_ROLE_KEY=%s\n" "${SUPABASE_SERVICE_ROLE_KEY:-dummy-service-role-key}" >> .env + set -euo pipefail + cat > .env <<EOF + PORT=3001 + JUDGE0_API_URL=https://judge0-extra-ce.p.rapidapi.com + SUPABASE_URL=${SUPABASE_URL:-https://example.supabase.co} + SUPABASE_SERVICE_ROLE_KEY=${SUPABASE_SERVICE_ROLE_KEY:-dummy-service-role-key} + EOF
159-167: Deduplicate .env creation approach (SC2129) in integration jobMirror the heredoc pattern for consistency.
- name: Create API environment file working-directory: ./code-executor-api run: | - set -euo pipefail - printf "PORT=3001\n" > .env - printf "JUDGE0_API_URL=https://judge0-extra-ce.p.rapidapi.com\n" >> .env - printf "SUPABASE_URL=%s\n" "${SUPABASE_URL:-https://example.supabase.co}" >> .env - printf "SUPABASE_SERVICE_ROLE_KEY=%s\n" "${SUPABASE_SERVICE_ROLE_KEY:-dummy-service-role-key}" >> .env + set -euo pipefail + cat > .env <<EOF + PORT=3001 + JUDGE0_API_URL=https://judge0-extra-ce.p.rapidapi.com + SUPABASE_URL=${SUPABASE_URL:-https://example.supabase.co} + SUPABASE_SERVICE_ROLE_KEY=${SUPABASE_SERVICE_ROLE_KEY:-dummy-service-role-key} + EOF
85-86: Prefer node-version: '20.x' to track latest patchMinor: use 20.x for consistency with semver patterns in setup-node.
- node-version: '20' + node-version: '20.x'Also applies to: 150-151, 260-261
43-69: Optional: replace for-loops with timeout+until to avoid SC2034 (“i appears unused”)Current loops are fine; switch to timeout+until for cleaner lint.
Example:
- for i in {1..60}; do - if curl -fsS http://localhost:4173/ > /dev/null; then - break - fi - sleep 1 - done + timeout 60s bash -lc 'until curl -fsS http://localhost:4173/ >/dev/null; do sleep 1; done'Also applies to: 112-121, 189-206
src/pages/ProblemSolver.tsx (5)
591-601: Clipboard: add error handling and await the writeText promisenavigator.clipboard.writeText returns a Promise and can fail (permissions, insecure context). Handle rejection and show a toast accordingly.
- <Button + <Button variant="outline" size="sm" - onClick={() => { - navigator.clipboard.writeText(solution.code); - toast.success('Code copied to clipboard!'); - }} + onClick={async () => { + try { + await navigator.clipboard.writeText(solution.code); + toast.success('Code copied to clipboard!'); + } catch { + toast.error('Failed to copy to clipboard'); + } + }} >- <Button + <Button variant="ghost" size="sm" - onClick={() => { - navigator.clipboard.writeText(submission.code); - toast.success('Code copied to clipboard!'); - }} + onClick={async () => { + try { + await navigator.clipboard.writeText(submission.code); + toast.success('Code copied to clipboard!'); + } catch { + toast.error('Failed to copy to clipboard'); + } + }} >Also applies to: 695-705
862-865: Consistent formatting: pretty-print test input with toCompactJsonRender input using the same compact JSON helper for consistency across expected/actual/input.
- <pre className="text-sm font-mono text-gray-900 dark:text-gray-100 whitespace-pre overflow-x-auto"> -{result.input} - </pre> + <pre className="text-sm font-mono text-gray-900 dark:text-gray-100 whitespace-pre overflow-x-auto"> +{toCompactJson(result.input)} + </pre>
374-410: Remove unused function renderValueThis helper is no longer referenced (replaced by toCompactJson). Keeping it around risks drift and triggers unused warnings in strict setups.
- const renderValue = (value: any): string => { - if (value === null || value === undefined) return 'null'; - if (typeof value === 'number' || typeof value === 'boolean') return String(value); - - // Handle arrays and objects directly for pretty printing - if (Array.isArray(value)) { - try { - return JSON.stringify(value, null, 2); - } catch { - return String(value); - } - } - - if (typeof value === 'object') { - try { - return JSON.stringify(value, null, 2); - } catch { - return String(value); - } - } - - if (typeof value === 'string') { - // Try to pretty-print if it's JSON-like - const trimmed = value.trim(); - if ((trimmed.startsWith('{') && trimmed.endsWith('}')) || (trimmed.startsWith('[') && trimmed.endsWith(']'))){ - try { - const parsed = JSON.parse(trimmed); - return JSON.stringify(parsed, null, 2); - } catch { - return value; - } - } - return value; - } - - return String(value); - };
412-471: Remove unused function toHumanReadable (or document intended usage)Currently unused and sizable; remove to reduce surface area or add a clear TODO with a consumer soon.
- // Human-friendly formatter (not strict JSON): - // - Strings are shown without quotes - // - Arrays render as [ a, b ] or multi-line for nested arrays - // - Objects render as { key: value } - const toHumanReadable = (value: any, indent = 0): string => { - const pad = (n: number) => ' '.repeat(n); - // If value is a JSON-like string, parse then format recursively - if (typeof value === 'string') { - const trimmed = value.trim(); - const looksJson = - (trimmed.startsWith('{') && trimmed.endsWith('}')) || - (trimmed.startsWith('[') && trimmed.endsWith(']')) || - (trimmed.startsWith('"') && trimmed.endsWith('"')) || - (trimmed === 'null' || trimmed === 'true' || trimmed === 'false'); - if (looksJson) { - try { - const parsed = JSON.parse(trimmed); - return toHumanReadable(parsed, indent); - } catch { - // fall through to scalar formatting - } - } - } - const needsQuotes = (s: string): boolean => { - return s === '' || /[\s,[\]{}:]/.test(s); - }; - const formatScalar = (v: any): string => { - if (v === null || v === undefined) return 'null'; - const t = typeof v; - if (t === 'number' || t === 'boolean') return String(v); - if (t === 'string') return needsQuotes(v) ? `"${v}"` : v; - return String(v); - }; - if (Array.isArray(value)) { - if (value.length === 0) return '[]'; - const complex = value.some((el) => Array.isArray(el) || (el && typeof el === 'object')); - if (complex) { - const inner = value - .map((el) => `${pad(indent + 2)}${toHumanReadable(el, indent + 2)}`) - .join(',\n'); - return `[\n${inner}\n${pad(indent)}]`; - } - const inner = value.map((el) => formatScalar(el)).join(', '); - return `[ ${inner} ]`; - } - if (value && typeof value === 'object') { - const keys = Object.keys(value).sort(); - if (keys.length === 0) return '{}'; - const lines = keys.map((k) => `${pad(indent + 2)}${k}: ${toHumanReadable((value as any)[k], indent + 2)}`); - return `{\n${lines.join('\n')}\n${pad(indent)}}`; - } - return formatScalar(value); - };
577-648: Component size: extract Solution and Submissions panelsThese two panels are large and self-contained (syntax highlighting, copy actions, lists). Extracting into <SolutionsTab .../> and <SubmissionsTab .../> will reduce cognitive load in ProblemSolver and improve testability.
Happy to provide a quick refactor scaffold if you want it in this PR.
Also applies to: 650-749
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
bun.lockbis excluded by!**/bun.lockb
📒 Files selected for processing (25)
.eslintrc.overrides.js(1 hunks).github/workflows/ci.yml(1 hunks).github/workflows/dev-test.yml(1 hunks)CI_CD_README.md(1 hunks)code-executor-api/server.js(3 hunks)eslint.config.js(1 hunks)package.json(2 hunks)scripts/dev-start.sh(1 hunks)src/components/AIChat.tsx(3 hunks)src/components/Notes.tsx(1 hunks)src/components/ui/command.tsx(1 hunks)src/components/ui/textarea.tsx(1 hunks)src/data/pythonSolutions.ts(1 hunks)src/hooks/useChatSession.ts(2 hunks)src/hooks/useProblems.ts(1 hunks)src/hooks/useSubmissions.ts(1 hunks)src/pages/ProblemSolver.tsx(9 hunks)src/services/userAttempts.ts(2 hunks)supabase/functions/ai-chat/index.ts(4 hunks)tailwind.config.ts(1 hunks)test-connection.js(0 hunks)test-dynamic-problems.js(0 hunks)test-judge0.js(0 hunks)test-leetcode-style.js(0 hunks)test-supabase-integration.js(0 hunks)
💤 Files with no reviewable changes (5)
- test-judge0.js
- test-connection.js
- test-leetcode-style.js
- test-supabase-integration.js
- test-dynamic-problems.js
✅ Files skipped from review due to trivial changes (1)
- package.json
🚧 Files skipped from review as they are similar to previous changes (15)
- src/components/ui/command.tsx
- src/components/Notes.tsx
- src/components/ui/textarea.tsx
- src/hooks/useProblems.ts
- tailwind.config.ts
- src/hooks/useSubmissions.ts
- eslint.config.js
- code-executor-api/server.js
- .eslintrc.overrides.js
- src/hooks/useChatSession.ts
- src/services/userAttempts.ts
- src/data/pythonSolutions.ts
- src/components/AIChat.tsx
- scripts/dev-start.sh
- supabase/functions/ai-chat/index.ts
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/dev-test.yml
49-49: shellcheck reported issue in this script: SC2129:style:2:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects
(shellcheck)
57-57: shellcheck reported issue in this script: SC2034:warning:29:1: i appears unused. Verify use (or export if used externally)
(shellcheck)
.github/workflows/ci.yml
44-44: shellcheck reported issue in this script: SC2034:warning:12:1: i appears unused. Verify use (or export if used externally)
(shellcheck)
95-95: shellcheck reported issue in this script: SC2129:style:3:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects
(shellcheck)
104-104: shellcheck reported issue in this script: SC2034:warning:9:1: i appears unused. Verify use (or export if used externally)
(shellcheck)
161-161: shellcheck reported issue in this script: SC2129:style:3:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects
(shellcheck)
172-172: shellcheck reported issue in this script: SC2034:warning:27:1: i appears unused. Verify use (or export if used externally)
(shellcheck)
263-263: shellcheck reported issue in this script: SC2015:info:1:26: Note that A && B || C is not if-then-else. C may run when A is true
(shellcheck)
🪛 YAMLlint (1.37.1)
.github/workflows/dev-test.yml
[error] 13-13: trailing spaces
(trailing-spaces)
[error] 105-105: trailing spaces
(trailing-spaces)
[error] 112-112: no new line character at the end of file
(new-line-at-end-of-file)
🪛 markdownlint-cli2 (0.17.2)
CI_CD_README.md
8-8: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
42-42: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
🔇 Additional comments (2)
src/pages/ProblemSolver.tsx (2)
871-882: LGTM: expected/actual switched to compact JSONUsing toCompactJson here provides consistent, robust rendering with circular protection.
9-13: Dependencies confirmed in package.jsonBoth
react-syntax-highlighter(line 52) andsafe-stable-stringify(line 55) are declared underdependenciesin the rootpackage.json. No further action required.
… results feat: add dev environment setup with CI/CD workflows and code solutions chore: clean up debug logs, fix code analysis logic, and pin bun version to 1.1.3 fix: improve TypeScript types and use GitHub secrets for CI - Add proper TypeScript interfaces for ReactMarkdown components - Fix React hook dependencies in ProblemSolver component - Add type-safe Monaco editor interface - Use GitHub secrets instead of hardcoded credentials in CI workflow chore: update CI workflow and improve dev-start script - Upgrade actions/cache from v3 to v4 in CI workflow - Enhance health check logic for frontend and API services with retries - Update Node.js version from 18 to 20 in CI workflow - Refactor environment file creation to use printf for better readability - Improve cleanup handling in dev-start script for background processes - Ensure proper signal handling for cleanup on exit fix: remove gituh actions
78734a5 to
bedd4c1
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (8)
CI_CD_README.md (8)
8-8: Use a proper heading instead of bold (markdownlint MD036).
Switch emphasis to a heading for consistency and to satisfy markdownlint.-**Comprehensive testing and deployment pipeline** +#### Comprehensive testing and deployment pipeline
42-42: Use a proper heading instead of bold (markdownlint MD036).
Same issue as above for the dev workflow section.-**Quick testing for development branches** +#### Quick testing for development branches
27-31: Avoid integration test race conditions; wait for services.
Explicitly wait for health endpoints before running e2e checks to reduce flakiness.Example:
npx wait-on -t 60000 http-get://localhost:3001/health http-get://localhost:5173 # then run integration checks
37-40: Tighten security audits and surface results.
Augment audits for signal and CI reliability.
- Use:
npm audit --omit=dev --audit-level=high --json- Consider OSV-Scanner:
npx @ossf/osv-scanner -r .- Enable Dependabot alerts/security updates and fail CI on high/critical.
44-47: Prevent duplicate runs on main between CI and dev-test.
Current triggers include main for both workflows; scope dev-test to non-main to reduce noise.YAML tweak:
on: push: - branches: [main, develop] + branches: [develop] pull_request: - branches: [main, develop] + branches: [develop] # or keep triggers and gate: jobs: dev: if: github.ref != 'refs/heads/main'Also consider:
concurrency: group: dev-tests-${{ github.ref }} cancel-in-progress: true
65-72: Document making dev script executable and Windows note.
Avoid setup friction by clarifying execution bits and WSL usage.Add:
chmod +x scripts/dev-start.sh # Commit executable bit: git update-index --chmod=+x scripts/dev-start.shWindows: run via WSL or provide a cross-platform npm script alternative.
128-131: Badge URLs: pin branch and replace placeholders.
Improve accuracy and avoid ambiguous badges.- - + +
153-165: Make debug commands fail fast and reflect dev mode.
Use strict flags and dev script to mirror CI behavior.-npm start -curl http://localhost:3001/health +npm run dev & +sleep 2 +curl -fS http://localhost:3001/healthOr use wait-on for robustness:
npx wait-on -t 60000 http-get://localhost:3001/health
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
bun.lockbis excluded by!**/bun.lockb
📒 Files selected for processing (23)
.eslintrc.overrides.js(1 hunks)CI_CD_README.md(1 hunks)code-executor-api/server.js(3 hunks)eslint.config.js(1 hunks)package.json(2 hunks)scripts/dev-start.sh(1 hunks)src/components/AIChat.tsx(3 hunks)src/components/Notes.tsx(1 hunks)src/components/ui/command.tsx(1 hunks)src/components/ui/textarea.tsx(1 hunks)src/data/pythonSolutions.ts(1 hunks)src/hooks/useChatSession.ts(2 hunks)src/hooks/useProblems.ts(1 hunks)src/hooks/useSubmissions.ts(1 hunks)src/pages/ProblemSolver.tsx(9 hunks)src/services/userAttempts.ts(2 hunks)supabase/functions/ai-chat/index.ts(4 hunks)tailwind.config.ts(1 hunks)test-connection.js(0 hunks)test-dynamic-problems.js(0 hunks)test-judge0.js(0 hunks)test-leetcode-style.js(0 hunks)test-supabase-integration.js(0 hunks)
💤 Files with no reviewable changes (5)
- test-judge0.js
- test-leetcode-style.js
- test-connection.js
- test-dynamic-problems.js
- test-supabase-integration.js
✅ Files skipped from review due to trivial changes (2)
- package.json
- scripts/dev-start.sh
🚧 Files skipped from review as they are similar to previous changes (15)
- src/hooks/useProblems.ts
- tailwind.config.ts
- src/components/Notes.tsx
- .eslintrc.overrides.js
- src/components/ui/command.tsx
- src/components/ui/textarea.tsx
- eslint.config.js
- code-executor-api/server.js
- src/data/pythonSolutions.ts
- src/services/userAttempts.ts
- src/hooks/useChatSession.ts
- src/hooks/useSubmissions.ts
- src/components/AIChat.tsx
- supabase/functions/ai-chat/index.ts
- src/pages/ProblemSolver.tsx
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
CI_CD_README.md
8-8: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
42-42: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
… code in ProblemSolver component - Replace inline function with useMemo for deduplicating submissions - Remove unnecessary debug scroll area effect - Simplify JSON stringification logic
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Chores
Tests
Documentation
Style