-
Notifications
You must be signed in to change notification settings - Fork 0
v1.5.0 #292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Added EzyGo API Batch Fetcher to optimize concurrent API calls. - Implemented request deduplication using LRU cache with a 15-second TTL. - Introduced rate limiting to restrict concurrent requests to a maximum of 3. - Integrated a circuit breaker pattern to handle API failures gracefully. - Created health check endpoint to monitor rate limiter and circuit breaker status. - Developed comprehensive documentation for rate limiting and verification processes. - Ensured client-side hooks and server-side calls are protected against rate limiting.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces an EzyGo batching layer to reduce upstream load (dedupe + concurrency limiting) and adds a circuit breaker with monitoring, while also updating the dashboard to SSR-prefetch and hydrate client queries. It also includes a number of UI/CSS refactors, documentation additions, CI hardening (OSSF Scorecard), and a version bump to v1.5.0.
Changes:
- Add an in-memory request deduper + global concurrency limiter for EzyGo requests and integrate a circuit breaker.
- SSR-prefetch dashboard data and hydrate React Query hooks with
initialData; add/api/health/ezygostatus endpoint. - Update docs/config/CI for monitoring & security posture, plus assorted UI/CSS cleanups and release version updates.
Reviewed changes
Copilot reviewed 35 out of 36 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/ezygo-batch-fetcher.ts | New rate-limited + deduped EzyGo fetch utilities and dashboard batch fetch. |
| src/lib/csp.ts | CSP tweaks (style-src-attr notes; dev websocket allowances). |
| src/lib/circuit-breaker.ts | New circuit breaker implementation used by batch fetcher and proxy. |
| src/hooks/courses/courses.ts | Add React Query initialData support for SSR hydration. |
| src/hooks/courses/attendance.ts | Add React Query initialData support for SSR hydration. |
| src/components/user/login-form.tsx | Layout class adjustments. |
| src/components/ui/dropdown-menu.tsx | Tailwind/Radix data-attribute variant refactor. |
| src/components/ui/checkbox.tsx | Checkbox radius style tweak. |
| src/components/loading.tsx | Loading warning timing/message update; remove spinner CSS import. |
| src/components/legal/AcceptTermsForm.tsx | Gradient utility class update. |
| src/components/layout/private-navbar.tsx | Spacing/utility class updates and minor layout tweaks. |
| src/components/layout/footer.tsx | Utility class updates (supports variant, gradient class, divider width). |
| src/components/attendance/course-card.tsx | Style/class updates for card layout and progress stripes. |
| src/components/attendance/attendance-chart.tsx | Replace ResponsiveContainer with measured dimensions approach. |
| src/components/attendance/attendance-calendar.tsx | Spacing/utility class updates and minor layout tweaks. |
| src/components/attendance/AddAttendanceDialog.tsx | Popover/select sizing utility updates. |
| src/app/globals.css | Tailwind @apply and utility refactors for custom styles. |
| src/app/api/health/ezygo/route.ts | New health endpoint exposing limiter + circuit breaker status. |
| src/app/api/backend/[...path]/route.ts | Wrap proxy fetch in circuit breaker; map open-circuit to 503. |
| src/app/accept-terms/page.tsx | Gradient/background utility refactor. |
| src/app/(public)/layout.tsx | Add inert attribute feature-detected for hidden navbar. |
| src/app/(protected)/profile/ProfileClient.tsx | Gradient utility refactor and sizing tweaks. |
| src/app/(protected)/dashboard/page.tsx | SSR auth/token check + server-side dashboard prefetch + hydration. |
| src/app/(protected)/dashboard/DashboardClient.tsx | Accept initialData and pass it into hooks; minor styling updates. |
| public/api-docs/openapi.yaml | API docs version update (but currently mismatched to release). |
| package.json | Bump to 1.5.0; add dev HTTPS script; add lru-cache. |
| package-lock.json | Lockfile updates for new dependency/version bump. |
| next.config.ts | Serwist config tweaks for reload/cache-on-navigation. |
| docs/SECURITY.md | Removed security implementation guide. |
| docs/EZYGO_VERIFICATION.md | New verification/monitoring report for rate limiting & breaker. |
| docs/EZYGO_RATE_LIMITING.md | New architecture + tuning documentation for rate limiting approach. |
| docs/EDGE_CASES_TESTS.md | New edge-case checklist/scenario doc. |
| README.md | Badges/tooling updates; mention new batching/caching strategy. |
| Dockerfile | Verify service worker exists; adjust public/ asset copy behavior. |
| .github/workflows/scorecard.yml | Add scheduled/push OSSF Scorecard workflow. |
| .example.env | Bump exposed app version to 1.5.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot open a new pull request to apply changes based on the comments in this thread |
* Initial plan * Fix PR review issues: security, docs, error handling, and UI Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> * Add comprehensive unit tests for circuit breaker and rate limiter Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 37 out of 38 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot open a new pull request to apply changes based on the comments in this thread |
…lation (#294) * Initial plan * Fix PR review feedback: cache normalization, TTL behavior, circuit breaker error handling, CSS import, test isolation Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> * Address code review feedback: fix return type consistency and improve documentation Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> * Address PR review feedback: add tests, fix error handling, narrow 4xx scope, evict failed promises Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> * Address code review feedback: refine cache eviction and improve documentation Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 37 out of 38 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot open a new pull request to apply changes based on the comments in this thread |
…ocs (#295) * Initial plan * Address PR review comments: hydration, syntax, cleanup, docs Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> * Remove redundant clearTimeout call Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> * Fix ldrs CSS import path for Turbopack compatibility Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> * Update src/app/(protected)/dashboard/DashboardClient.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> Co-authored-by: Devanarayanan <fusion@devakesu.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 37 out of 38 changed files in this pull request and generated 12 comments.
Comments suppressed due to low confidence (1)
src/components/attendance/attendance-calendar.tsx:597
- Widths like
w-32.5/w-22.5and heights likemax-h-70aren’t default Tailwind tokens, so the Select triggers/menus may not size correctly. Use supported tokens or arbitrary values (e.g.w-[130px],max-h-[280px]).
<SelectTrigger className="w-32.5 h-9 bg-background/60 border-border/60 text-sm capitalize custom-dropdown" aria-label="Filter attendance by status">
<SelectValue>{filter === "all" ? "All" : filter.charAt(0).toUpperCase() + filter.slice(1)}</SelectValue>
</SelectTrigger>
<SelectContent className="bg-background/90 border-border/60 backdrop-blur-md custom-dropdown max-h-70">
<SelectItem value="all">All</SelectItem>
<SelectItem value="present">Present</SelectItem>
<SelectItem value="absent">Absent</SelectItem>
<SelectItem value="dutyLeave">Duty Leave</SelectItem>
<SelectItem value="otherLeave">Other Leave</SelectItem>
</SelectContent>
</Select>
<Select value={currentDate.month!.toString()} onValueChange={handleMonthChange}>
<SelectTrigger className="w-32.5 h-9 bg-background/60 border-border/60 text-sm capitalize custom-dropdown" aria-label="Select month">
<SelectValue>{monthNames[currentDate.month!]}</SelectValue>
</SelectTrigger>
<SelectContent className="bg-background/90 border-border/60 backdrop-blur-md custom-dropdown max-h-70">
{monthNames.map((month, index) => (
<SelectItem key={month} value={index.toString()} className={currentDate.month === index ? "bg-white/5 mt-0.5" : "capitalize"}>
{month}
</SelectItem>
))}
</SelectContent>
</Select>
<Select value={currentDate.year!.toString()} onValueChange={handleYearChange}>
<SelectTrigger className="w-22.5 h-9 bg-background/60 border-border/60 text-sm custom-dropdown" aria-label="Select year">
<SelectValue>{currentDate.year}</SelectValue>
</SelectTrigger>
<SelectContent className="bg-background/90 border-border/60 max-h-70 backdrop-blur-md custom-dropdown">
{yearOptions.map((year) => (
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot open a new pull request to apply changes based on the comments in this thread |
…solation (#320) * Initial plan * Changes before error encountered Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> * Fix test isolation by resetting circuit breaker state before each Rate Limiting test Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> * Improve timeout test mock robustness with signal validation and early abort handling Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 42 out of 44 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot open a new pull request to apply changes based on the comments in this thread |
…ircuit breaker tests (#321) * Initial plan * Fix AbortSignal.timeout() compatibility and circuit breaker mock isolation Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 42 out of 44 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot open a new pull request to apply changes based on the comments in this thread |
* Initial plan * Fix resource leaks: cancel reader on size limit, clear timeout on fetch completion, improve AbortSignal.timeout detection Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> * Address review feedback: fix docstring, await reader.cancel(), add timer cleanup tests Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> * Fix comment: remove mention of logging that isn't implemented Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 42 out of 44 changed files in this pull request and generated 10 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot open a new pull request to apply changes based on the comments in this thread |
* Initial plan * Fix invalid Tailwind CSS class names Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> * Remove trailing whitespace from AcceptTermsForm.tsx Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 40 out of 43 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* Initial plan * Fix attendance hook unit tests for initialData support - Add beforeEach/afterEach hooks to prevent test state pollution - Disable background refetch settings in test QueryClient - Increase timeout for error state test to 3000ms - All 5 attendance tests now passing - No regressions in other tests (399 tests passing) Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> * Remove redundant afterEach hook The beforeEach already clears mocks, so afterEach is unnecessary Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: devakesu <61821107+devakesu@users.noreply.github.com>
Implement EzyGo API Batch Fetcher with Rate Limiting and Circuit Breaker