refresh safety blocks panel on manual update#465
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe PR refreshes blocked events when the dashboard Refresh button is used or the live socket reconnects. It also upgrades Next.js-related frontend dependencies, updates TypeScript/Next environment settings, and reorders the CLI module export list. ChangesBlocked Events Dashboard Refresh
Next.js Upgrade and TypeScript Config
CLI Export Order
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/next-env.d.ts`:
- Line 3: Remove the dev-only typed routes import from next-env.d.ts and move
typed route inclusion to the standard Next.js type setup in tsconfig.json.
Update the frontend/tsconfig.json include patterns to cover .next/types/**/*.ts
so route types are picked up in all environments, and keep next-env.d.ts limited
to the usual Next.js ambient declarations.
In `@frontend/package.json`:
- Around line 32-33: The Jest test stack is on mixed major versions because
frontend/package.json pins jest and jest-environment-jsdom differently, while
the lockfile still resolves an older jsdom environment. Update the package.json
dependencies together so jest and jest-environment-jsdom stay on the same major
version, or remove the explicit jest-environment-jsdom dependency if Jest should
manage it, and make sure the lockfile is refreshed accordingly. Use the jest and
jest-environment-jsdom entries in package.json to locate the change.
In `@frontend/pages/index.tsx`:
- Around line 305-312: The callback passed to useLiveEventSocket in index.tsx is
being invoked for every incoming message, so refreshBlocked() is currently
running per event instead of only on reconnect/open. Remove the blocked-list
refresh from that message callback and wire it to a true reconnect/open path in
useLiveEventSocket (or an explicit reconnect handler) alongside refreshSummary()
and refreshSessions(), using the useLiveEventSocket hook and the live event
socket setup in index.tsx to place it correctly.
In `@frontend/tsconfig.json`:
- Line 19: The tsconfig JSX setting is using the wrong transform mode for this
Next.js app. Update the JSX option in frontend/tsconfig.json from the current
react-jsx setting to preserve, keeping the configuration aligned with Next.js 16
handling and leaving the rest of the TypeScript settings unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 12b4be29-2c04-45d7-bc53-68a4006a2c20
⛔ Files ignored due to path filters (1)
frontend/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
frontend/next-env.d.tsfrontend/package.jsonfrontend/pages/index.tsxfrontend/tsconfig.json
| @@ -1,5 +1,6 @@ | |||
| /// <reference types="next" /> | |||
| /// <reference types="next/image-types/global" /> | |||
| import "./.next/dev/types/routes.d.ts"; | |||
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
git ls-files 'frontend/next-env.d.ts' 'frontend/tsconfig.json' 'frontend/next.config.*' 'frontend/package.json'Repository: sreerevanth/AgentWatch
Length of output: 252
🏁 Script executed:
#!/bin/bash
set -euo pipefail
cat -n frontend/next-env.d.ts
printf '\n--- tsconfig ---\n'
cat -n frontend/tsconfig.json
printf '\n--- next config files ---\n'
for f in frontend/next.config.js frontend/next.config.mjs frontend/next.config.ts frontend/package.json; do
if [ -f "$f" ]; then
echo "### $f"
cat -n "$f"
echo
fi
doneRepository: sreerevanth/AgentWatch
Length of output: 3134
Remove the dev-only typed-routes import frontend/next-env.d.ts:3 should not import ./.next/dev/types/routes.d.ts; that path is environment-specific and can break non-dev type checks/builds. Add .next/types/**/*.ts to frontend/tsconfig.json instead so typed routes are included through the standard Next.js setup.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@frontend/next-env.d.ts` at line 3, Remove the dev-only typed routes import
from next-env.d.ts and move typed route inclusion to the standard Next.js type
setup in tsconfig.json. Update the frontend/tsconfig.json include patterns to
cover .next/types/**/*.ts so route types are picked up in all environments, and
keep next-env.d.ts limited to the usual Next.js ambient declarations.
| "jest": "^25.0.0", | ||
| "jest-environment-jsdom": "^29.7.0", |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "jest-environment-jsdom@29.7.0 peer deps:"
curl -s https://registry.npmjs.org/jest-environment-jsdom/29.7.0 | jq '.peerDependencies'
echo "Current declared versions from frontend/package.json:"
jq '.devDependencies | {jest, "jest-environment-jsdom"}' frontend/package.jsonRepository: sreerevanth/AgentWatch
Length of output: 343
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "frontend/package.json relevant deps:"
sed -n '24,40p' frontend/package.json
echo
echo "Any lockfile entries for jest-environment-jsdom:"
rg -n '"jest-environment-jsdom"|jest-environment-jsdom@' -S frontend/package-lock.json frontend/yarn.lock package-lock.json yarn.lock 2>/dev/null || true
echo
echo "Package metadata for jest-environment-jsdom@29.7.0:"
curl -s https://registry.npmjs.org/jest-environment-jsdom/29.7.0 | jq '{name, version, dependencies, peerDependencies, engines}'Repository: sreerevanth/AgentWatch
Length of output: 1288
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "frontend/package.json relevant deps:"
sed -n '24,40p' frontend/package.json
echo
echo "Any lockfile entries for jest-environment-jsdom:"
rg -n '"jest-environment-jsdom"|jest-environment-jsdom@' -S frontend/package-lock.json frontend/yarn.lock package-lock.json yarn.lock 2>/dev/null || true
echo
echo "Package metadata for jest-environment-jsdom@29.7.0:"
curl -s https://registry.npmjs.org/jest-environment-jsdom/29.7.0 | jq '{name, version, dependencies, peerDependencies, engines}'Repository: sreerevanth/AgentWatch
Length of output: 1288
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "frontend/package.json relevant deps:"
sed -n '24,40p' frontend/package.json
echo
echo "Any lockfile entries for jest-environment-jsdom:"
rg -n '"jest-environment-jsdom"|jest-environment-jsdom@' -S frontend/package-lock.json frontend/yarn.lock package-lock.json yarn.lock 2>/dev/null || true
echo
echo "Package metadata for jest-environment-jsdom@29.7.0:"
curl -s https://registry.npmjs.org/jest-environment-jsdom/29.7.0 | jq '{name, version, dependencies, peerDependencies, engines}'Repository: sreerevanth/AgentWatch
Length of output: 1288
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "frontend/package.json:"
sed -n '1,220p' frontend/package.json
echo
echo "Jest-related config/usages in frontend:"
rg -n 'jest|testEnvironment|jsdom' frontend -g '!frontend/package-lock.json' -g '!frontend/node_modules/**'Repository: sreerevanth/AgentWatch
Length of output: 1534
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "frontend/package.json:"
sed -n '1,220p' frontend/package.json
echo
echo "Jest-related config/usages in frontend:"
rg -n 'jest|testEnvironment|jsdom' frontend -g '!frontend/package-lock.json' -g '!frontend/node_modules/**'Repository: sreerevanth/AgentWatch
Length of output: 1534
Align the Jest/jsdom versions
frontend/package.json pins jest@25.0.0 and jest-environment-jsdom@29.7.0, while the lockfile still resolves jest-environment-jsdom@25.5.0. Update them together, or remove the explicit env dependency, so the test stack stays on one Jest major.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@frontend/package.json` around lines 32 - 33, The Jest test stack is on mixed
major versions because frontend/package.json pins jest and
jest-environment-jsdom differently, while the lockfile still resolves an older
jsdom environment. Update the package.json dependencies together so jest and
jest-environment-jsdom stay on the same major version, or remove the explicit
jest-environment-jsdom dependency if Jest should manage it, and make sure the
lockfile is refreshed accordingly. Use the jest and jest-environment-jsdom
entries in package.json to locate the change.
|
Hi! Thanks for the review. I'm a first-time contributor and I'm still learning how to handle these specific TypeScript and Jest configurations. Would you prefer I revert the version upgrades and focus this PR only on the Safety Blocks refresh, or could you point me to the right documentation to fix these environment issues? Thanks for your guidance! |
|
Hi! I've addressed the scope concerns and ensured the Safety Blocks refresh logic is working as expected. My PR is ready for human review. Thank you for your time |
🧪 PR Test Results
Python 3.12 · commit 15f8035 |
|
@hainsshaju1919-png check for the ci ill re- review after tht |
|
@sreerevanth, I have pushed the fixes for the import sorting in init.py and updated the jsx configuration in the tsconfig.json for the frontend as discussed. The CI workflow is currently "awaiting approval." Could you please approve the run and perform your re-review when you have a moment? |
|
I have solved it ...Could you please review the change? |
|
Is it okay now? |
Closes #461
Summary
This PR resolves the issue where the "Safety Blocks" panel did not refresh when the manual "Refresh" button was clicked.
Changes
Modified DashboardPage to include refreshBlocked (the SWR mutation function) in the manual refresh onClick handler.
Included refreshBlocked in the useLiveEventSocket reconnection callback to ensure safety data consistency after network recovery.
Motivation
Previously, the Safety Blocks panel relied solely on the automatic SWR interval, leading to stale data when users manually refreshed the rest of the dashboard. This fix ensures a consistent user experience by syncing the safety panel with other dashboard metrics.
Summary by CodeRabbit