Repository navigation
Hotfix/v1.1.4 - #539
Hotfix/v1.1.4#539
Conversation
WalkthroughLogging and log-parsing behaviors updated: log provider now uses CloudWatch if AWS credentials exist or the runtime is detected as cloud; vector config normalizes level into Changes
Sequence Diagram(s)sequenceDiagram
participant Init as Logs.initialize()
participant Env as isCloudEnvironment()
participant AWS as AWS Credentials Check
participant Selector as Provider Selector
participant CW as CloudWatchProvider
participant LF as LocalFileProvider
Note over Init,Env: Logs initialization
Init->>AWS: check for AWS keys
Init->>Env: isCloudEnvironment()
alt AWS keys OR cloud env
Selector->>CW: initialize CloudWatchProvider
Note right of CW: runtime uses CloudWatch
else neither present
Selector->>LF: initialize LocalFileProvider
Note right of LF: fallback to file-based logs
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ 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: 0
🧹 Nitpick comments (2)
backend/src/core/logs/logs.ts (2)
22-23: Minor grammar improvement for comment clarity.Consider refining the comment for better readability:
- // Use CloudWatch if AWS credentials are available or if it's cloud environment since we provided the permissions in instance profile + // Use CloudWatch if AWS credentials are available or if running in a cloud environment with instance profile permissions // otherwise use file-based logging
24-25: Consider renaming variable to better reflect its purpose.The variable name
hasAwsCredentialsis misleading since it checks both explicit AWS credentials and cloud environment (instance profile). Consider a more descriptive name likeshouldUseCloudWatchorhasCloudWatchAccess.- const hasAwsCredentials = + const shouldUseCloudWatch = (process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY) || isCloudEnvironment(); - if (hasAwsCredentials) { + if (shouldUseCloudWatch) {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (3)
backend/src/core/logs/logs.ts(2 hunks)docker-init/logs/vector.yml(3 hunks)package.json(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx}: Use TypeScript for all code files
Use ES modules (import/export syntax)
Prefer descriptive, unabbreviated variable and function names
Implement proper error handling with try-catch blocks and logging where appropriate
Use single quotes for strings
Include semicolons at the end of statements
Use arrow functions for callbacks and inline functions
Prefer const over let; avoid var
Use template literals for string interpolation
Maintain 2-space indentation
Format code with the repository Prettier configuration
Variables, parameters, properties, and functions must use camelCase
Constants and enum members must use UPPER_CASE
Include JSDoc comments for complex functions
Files:
backend/src/core/logs/logs.ts
backend/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
backend/src/**/*.{ts,tsx}: Use async/await for asynchronous operations in the backend
Use Zod schemas for request/response validation
Return consistent API responses using utility functions
Validate all user inputs
Sanitize data before database operations
Use prepared statements for SQL queries
Implement proper caching strategies (server-side)
Files:
backend/src/core/logs/logs.ts
backend/src/{controllers,core}/**/*.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Implement proper database transaction handling
Files:
backend/src/core/logs/logs.ts
**/*.{tsx,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
React components and TypeScript types/interfaces must use PascalCase
Files:
backend/src/core/logs/logs.ts
**/[a-z][a-z0-9-]*.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Utility files should use kebab-case or camelCase (kebab-case validated here)
Files:
backend/src/core/logs/logs.ts
🧬 Code graph analysis (1)
backend/src/core/logs/logs.ts (1)
backend/src/utils/environment.ts (1)
isCloudEnvironment(9-11)
🔇 Additional comments (4)
package.json (1)
3-3: Verify version number matches release intent.The PR title indicates "Hotfix/v1.1.4", but the version is set to 1.1.6. Please confirm this is intentional and not a typo.
docker-init/logs/vector.yml (3)
84-84: Consider normalizing log level to uppercase for consistency.The InsForge logs set
metadata.leveldirectly fromreq.levelwithout uppercasing, while both Deno logs (line 131) and DB logs (line 146) applyupcase!(). If InsForge can emit mixed-case levels (e.g., "info", "INFO"), this could lead to inconsistent level values across log sources.Verify whether InsForge always emits uppercase log levels. If not, consider applying
upcase!()for consistency:- .metadata.level = req.level + .metadata.level = upcase!(req.level)
127-131: LGTM! Proper log level normalization for Deno logs.The regex parsing and uppercase conversion ensure consistent log level formatting across the system.
146-158: LGTM! Proper PostgreSQL log parsing and normalization.The implementation correctly:
- Normalizes log levels to uppercase
- Maps PostgreSQL-specific levels (STATEMENT, DETAIL) to INFO for better clarity
- Provides a sensible default level when parsing fails
Fermionic-Lyu
left a comment
There was a problem hiding this comment.
Can you provide an example of what the log structure currently look like, so I can parse it correctly in the frontend
| "": { | ||
| "name": "insforge", | ||
| "version": "1.1.2", | ||
| "version": "1.1.4", |
|
Oh should I change the frontend as well before publishing v1.1.6? |
|
@Fermionic-Lyu Now the level of all different sources has been saved on |
update log parsing using metadata.level
[Chore] Fix 2 misc issues
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
backend/src/api/routes/database.advance.ts(4 hunks)frontend/src/lib/routing/AppRoutes.tsx(2 hunks)frontend/src/lib/routing/RequireAuth.tsx(2 hunks)
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx}: Use TypeScript for all code files
Use ES modules (import/export syntax)
Prefer descriptive, unabbreviated variable and function names
Implement proper error handling with try-catch blocks and logging where appropriate
Use single quotes for strings
Include semicolons at the end of statements
Use arrow functions for callbacks and inline functions
Prefer const over let; avoid var
Use template literals for string interpolation
Maintain 2-space indentation
Format code with the repository Prettier configuration
Variables, parameters, properties, and functions must use camelCase
Constants and enum members must use UPPER_CASE
Include JSDoc comments for complex functions
Files:
backend/src/api/routes/database.advance.tsfrontend/src/lib/routing/AppRoutes.tsxfrontend/src/lib/routing/RequireAuth.tsx
backend/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
backend/src/**/*.{ts,tsx}: Use async/await for asynchronous operations in the backend
Use Zod schemas for request/response validation
Return consistent API responses using utility functions
Validate all user inputs
Sanitize data before database operations
Use prepared statements for SQL queries
Implement proper caching strategies (server-side)
Files:
backend/src/api/routes/database.advance.ts
backend/src/api/**/*.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
backend/src/api/**/*.ts: Implement authentication and error-handling middleware
Follow RESTful conventions for API endpoints
Implement rate limiting for API endpoints
Files:
backend/src/api/routes/database.advance.ts
**/*.{tsx,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
React components and TypeScript types/interfaces must use PascalCase
Files:
backend/src/api/routes/database.advance.tsfrontend/src/lib/routing/AppRoutes.tsxfrontend/src/lib/routing/RequireAuth.tsx
**/[a-z][a-z0-9-]*.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Utility files should use kebab-case or camelCase (kebab-case validated here)
Files:
backend/src/api/routes/database.advance.ts
frontend/src/**/*.{tsx,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
frontend/src/**/*.{tsx,ts}: Use functional React components with hooks exclusively
Use Radix UI primitives for accessibility
Optimize React component re-renders
Files:
frontend/src/lib/routing/AppRoutes.tsxfrontend/src/lib/routing/RequireAuth.tsx
frontend/src/**/*.tsx
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
frontend/src/**/*.tsx: Implement TypeScript interfaces/types for all component props
Follow component composition patterns; keep components focused and single-purpose
Implement proper loading and error states in UI
Use a consistent icon set from lucide-react
Files:
frontend/src/lib/routing/AppRoutes.tsxfrontend/src/lib/routing/RequireAuth.tsx
frontend/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
frontend/src/**/*.{ts,tsx}: Use TanStack Query for server state management
Use React Hook Form for form handling with Zod validation
Optimize bundle size with proper imports
Files:
frontend/src/lib/routing/AppRoutes.tsxfrontend/src/lib/routing/RequireAuth.tsx
frontend/src/**/[A-Z]*.tsx
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Component files must use PascalCase filenames (e.g., DataGrid.tsx)
Files:
frontend/src/lib/routing/AppRoutes.tsxfrontend/src/lib/routing/RequireAuth.tsx
🧠 Learnings (2)
📚 Learning: 2025-10-15T18:18:47.519Z
Learnt from: CR
PR: InsForge/InsForge#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-10-15T18:18:47.519Z
Learning: Applies to backend/src/{controllers,core}/**/*.ts : Implement proper database transaction handling
Applied to files:
backend/src/api/routes/database.advance.ts
📚 Learning: 2025-10-15T18:18:47.519Z
Learnt from: CR
PR: InsForge/InsForge#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-10-15T18:18:47.519Z
Learning: Applies to backend/src/api/**/*.ts : Implement authentication and error-handling middleware
Applied to files:
frontend/src/lib/routing/AppRoutes.tsx
🧬 Code graph analysis (2)
backend/src/api/routes/database.advance.ts (1)
backend/src/core/socket/socket.ts (1)
SocketService(23-385)
frontend/src/lib/routing/AppRoutes.tsx (1)
frontend/src/lib/routing/RequireAuth.tsx (1)
RequireAuth(11-27)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: CI Pre-merge Check
- GitHub Check: E2E Tests
🔇 Additional comments (3)
backend/src/api/routes/database.advance.ts (1)
15-16: LGTM - Clean socket service integration.The imports are appropriate for adding real-time update notifications to database operations.
frontend/src/lib/routing/AppRoutes.tsx (1)
27-27: LGTM - Improved routing clarity.Making the redirect destinations explicit improves code readability and separates routing concerns from authentication logic. The redirect paths correctly match the login routes defined on lines 22-23.
Also applies to: 49-49
frontend/src/lib/routing/RequireAuth.tsx (1)
8-8: LGTM - Clean separation of concerns.The refactor successfully externalizes redirect logic, making
RequireAuthmore reusable. The requiredredirectToprop ensures callers explicitly specify authentication flow destinations.Also applies to: 11-11, 23-23
| const socket = SocketService.getInstance(); | ||
| socket.broadcastToRoom('role:project_admin', ServerEvents.DATA_UPDATE, { | ||
| resource: DataUpdateResourceType.DATABASE_SCHEMA, | ||
| }); |
There was a problem hiding this comment.
Missing broadcast in bulk-upsert route.
The socket broadcasts correctly notify project_admin users of database changes in the raw SQL and import routes. However, the bulk-upsert route (lines 216-281) also modifies database content and should emit the same broadcast for consistency.
Add the broadcast after the audit log in the bulk-upsert route:
// Log audit
await auditService.log({
actor: req.user?.email || 'api-key',
action: 'BULK_UPSERT',
module: 'DATABASE',
details: {
table,
filename: req.file.originalname,
fileSize: req.file.size,
upsertKey: upsertKey || null,
rowsAffected: response.rowsAffected,
totalRecords: response.totalRecords,
},
ip_address: req.ip,
});
+ const socket = SocketService.getInstance();
+ socket.broadcastToRoom('role:project_admin', ServerEvents.DATA_UPDATE, {
+ resource: DataUpdateResourceType.DATABASE_SCHEMA,
+ });
+
res.json(response);Also applies to: 126-129, 333-336
🤖 Prompt for AI Agents
In backend/src/api/routes/database.advance.ts around lines 63-66 and
specifically for the bulk-upsert route at lines 216-281 (also apply same change
at 126-129 and 333-336): the socket broadcast notifying 'role:project_admin' of
DataUpdateResourceType.DATABASE_SCHEMA is missing for the bulk-upsert flow;
after the audit log is written in the bulk-upsert route, call the SocketService
singleton to broadcast ServerEvents.DATA_UPDATE with resource:
DataUpdateResourceType.DATABASE_SCHEMA to the 'role:project_admin' room
(matching the pattern used at lines 63-66) so project admins receive consistent
update notifications.
Summary
Hotfix: logs disappear on cloud.
How did you test this change?
Locally test with project dashboard.
Summary by CodeRabbit
Bug Fixes
New Features
Chores