Conversation
|
Cursor Agent can help with this pull request. Just |
Adds a script to time the build process and sets several API routes to dynamic. Co-authored-by: benyakoub.pro <benyakoub.pro@gmail.com>
Co-authored-by: benyakoub.pro <benyakoub.pro@gmail.com>
- Remove src/lib/pagination.test.ts (empty file) - Remove src/lib/validation-helpers.test.ts (empty file) - All tests now pass successfully
246b8c5 to
e61080a
Compare
This was referenced Jan 10, 2026
16 tasks
cursor bot
pushed a commit
that referenced
this pull request
Jan 10, 2026
Build error and timing This PR resolves build errors and introduces build performance monitoring. ## Changes - Fixed 'Dynamic server usage' build errors by adding `export const dynamic = 'force-dynamic'` to 5 API routes - Added build timing script (`scripts/time-build.js`) for performance monitoring - Removed empty test files causing test failures - Resolved merge conflicts with main branch ## Impact - ✅ Clean builds without errors or warnings - ✅ Build performance metrics available - ✅ All tests passing (98/98) - ✅ Improved developer experience ## Related - Closes #77 - Fix Next.js build errors: Dynamic server usage warnings - Closes #78 - Add build performance monitoring and timing - Related to PR #76 (Performance optimizations) - Related to PR #75 (Global search) - Milestone: v1.3 - Quality & Polish ## Technical Details - Files changed: 26 - Additions: +1,082 - Deletions: -712 - Commits: 4 PR #72
benmed00
added a commit
that referenced
this pull request
Jan 10, 2026
Global entity search implementation This PR implements global entity search and addresses critical platform priorities. ## Changes ### Global Entity Search - Unified search API across 11 entity types (species, missions, equipment, employees, documents, publications, users, expenses, budgets, water quality, air quality, climate data) - Real-time search UI component with debouncing and keyboard navigation - Integrated into main header for global access ### Testing Infrastructure - Added 98 unit and integration tests (password policy, 2FA, export utilities, API routes) - E2E tests with Playwright (auth, search, export flows) - Comprehensive test coverage for critical components ### Performance Optimizations - HTTP caching on `/api/air-quality` route - Standardized pagination utilities applied to documents and publications ### Security Enhancements - Rate limiting on all export endpoints (Excel, PDF, CSV) - Complete 2FA implementation with TOTP and backup codes - Password management API with policy enforcement ### Extended Export Functionality - New CSV export endpoint (`/api/export/csv`) - Updated export buttons component with CSV option - Support for water quality, air quality, and climate data exports ## Impact - ✅ Unified search experience across all entities - ✅ Comprehensive test coverage (98 tests) - ✅ Improved API performance with caching - ✅ Enhanced security with rate limiting and 2FA - ✅ Extended export capabilities (CSV support) ## Related - Closes #79 - Implement global entity search across all platform entities - Closes #80 - Add comprehensive testing infrastructure (unit, integration, E2E) - Related to PR #72 (Build error fixes - dynamic routes for search) - Related to PR #76 (Performance optimizations) - Milestone: v1.1 - Performance & User Experience ## Technical Details - Files changed: 58 - Additions: +5,909 - Deletions: -1,126 - Commits: 10 PR #75
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Build Error Resolution & Build Performance Monitoring
🎯 Overview
This PR addresses critical build errors that were preventing successful Next.js builds and introduces build performance monitoring to help identify optimization opportunities. The changes ensure production-ready builds while providing visibility into build performance metrics.
🔗 Linked Issues
🔗 Resolved Issues
This PR resolves the following issues:
Closes #77 - Fix Next.js build errors: Dynamic server usage warnings
Closes #78 - Add build performance monitoring and timing
🔍 Context
Problem Statement
getServerSession()Impact
✨ Changes Made
1. Build Error Resolution
Fixed "Dynamic server usage" errors by explicitly marking API routes as dynamic:
Added
export const dynamic = 'force-dynamic'to 5 API routes that usegetServerSession():src/app/api/equipment/maintenance/route.tssrc/app/api/notifications/preferences/route.tssrc/app/api/search/route.tssrc/app/api/species/observations/route.tssrc/app/api/species/with-locations/route.tsRationale: These routes inherently require dynamic server-side rendering due to authentication checks. Explicitly marking them prevents Next.js from attempting static optimization and eliminates build warnings/errors.
2. Build Performance Monitoring
Introduced build timing script (
scripts/time-build.js):package.jsonbuild scriptBenefits:
3. Code Quality Improvements
mainbranch🔗 Related Work
Related PRs
Milestone
Related Issues
Branch Hierarchy
main(latest)cursor/build-error-and-timing-85ee🧪 Testing
Test Coverage
Manual Testing
Build Process:
API Routes:
📊 Metrics & Impact
Before
After
🚀 Deployment Notes
Breaking Changes
Migration Steps
Rollback Plan
package.jsonbuild script tonext buildif neededexport const dynamic = 'force-dynamic'from routes (not recommended as it will reintroduce build errors)📝 Code Quality
Standards Met
Files Changed
Key Files
scripts/time-build.js- New build timing scriptpackage.json- Updated build script✅ Checklist
👥 Reviewers
@benmed00 - Please review for:
📚 Additional Notes
Technical Details
Why
force-dynamic?Next.js attempts to statically optimize API routes by default. However, routes using
getServerSession()require dynamic server-side execution because:Explicitly marking these routes as
force-dynamictells Next.js to skip static optimization, eliminating build warnings and ensuring correct runtime behavior.Build Timing Script
The script uses Node.js
child_process.spawn()to execute the Next.js build and measure duration. It provides:🔄 Future Improvements
Potential enhancements for future PRs:
🔗 Explicit Links & Metadata
Related PRs
Milestone
Branch Information
main(commit:01b3ac8)cursor/build-error-and-timing-85ee(commit:e61080a)Related Issues
This PR addresses build errors and performance monitoring needs. Related issues in the v1.3 milestone:
Type: 🐛 Bug Fix + ✨ Feature
Priority: High
Module: Core Infrastructure
Milestone: v1.3 - Quality & Polish
🔗 Explicit Links
Related PRs
Milestone
Branch Information
maincursor/build-error-and-timing-85eeRelated Issues
This PR addresses build errors and performance monitoring needs. Related issues may be found in the project board under the v1.3 milestone.
Type: 🐛 Bug Fix + ✨ Feature
Priority: High
Module: Core Infrastructure
Milestone: v1.3 - Quality & Polish