-
Notifications
You must be signed in to change notification settings - Fork 3
chore: demo preparation #412
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
Bff now without database and notification service Node renamed to Worker Not all reads and writes were added to the correct segments
The improved resource loading required to initialize the event manager as disconnected.
WalkthroughThis update introduces configuration changes, dependency updates, and code refactoring. It adds new protected module entries, adjusts service setup/teardown scripts, and expands repository assets. The constructors for several error classes now require non-optional parameters. Minor formatting and import order adjustments are made throughout the codebase, with no changes to core logic or exported entities. Changes
Sequence Diagram(s)sequenceDiagram
participant BFF as setUpBff.ts
participant EventBroker
BFF->>EventBroker: connect()
alt Connection fails
BFF->>EventBroker: if connected, disconnect()
BFF-->>BFF: Rethrow error
end
sequenceDiagram
participant WorkerSetup as setUpWorker.ts
participant Database
participant FileStore
WorkerSetup->>Database: connect()
WorkerSetup->>FileStore: connect()
alt Connection fails
WorkerSetup->>Database: if connected, disconnect()
WorkerSetup->>FileStore: if connected, disconnect()
WorkerSetup-->>WorkerSetup: Rethrow error
end
Assessment against linked issues
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm warn config production Use Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 4
🔭 Outside diff range comments (1)
src/integrations/runtime/setUpWorker.ts (1)
14-22
: 💡 Verification agent🧩 Analysis chain
Verify that removed services are handled in appropriate service types.
The cleanup logic correctly handles only the remaining connected services. Please ensure that eventBroker and notificationService connections are properly managed in their respective service setups (e.g., BFF setup for eventBroker as mentioned in the AI summary).
🏁 Script executed:
#!/bin/bash # Description: Verify that eventBroker and notificationService are properly handled in other setup files # Expected: Find references to these services in setUpBff.ts or other appropriate setup files echo "Searching for eventBroker connections in other setup files:" fd "setUp.*\.ts$" src/integrations/runtime --exec rg -l "eventBroker" echo -e "\nSearching for notificationService connections in other setup files:" fd "setUp.*\.ts$" src/integrations/runtime --exec rg -l "notificationService" echo -e "\nContent of setUpBff.ts (if exists):" cat src/integrations/runtime/setUpBff.ts 2>/dev/null || echo "setUpBff.ts not found"Length of output: 920
Add notificationService setup and teardown in the appropriate runtime setup
EventBroker is correctly initialized and torn down in src/integrations/runtime/setUpBff.ts, but I didn’t find any setup file that handles notificationService.connect() or its corresponding disconnect logic. Please add a setup (and error‐cleanup) for notificationService in the service’s integration runtime bootstrap—similar to how eventBroker is managed—to ensure its connection lifecycle is covered.
• Confirm or create src/integrations/runtime/setUpNotificationService.ts (or update the existing setup file) to include:
await notificationService.connect(); // … if (notificationService.connected) notificationService.disconnect();• Include
Promise.allSettled
around both connect/disconnect calls and throw on errors, matching the existing pattern.
🧹 Nitpick comments (4)
src/integrations/validation/errors/UnknownImplementation.ts (1)
6-6
: Consistent change with minor formatting issue.The required
name
parameter maintains consistency across all integration modules and ensures meaningful error messages.Minor formatting issue - there's a trailing space after
string)
:- constructor(name: string) + constructor(name: string)src/webui/components/notification/elementary/StartedFollowing.tsx (1)
11-11
: Improve message concatenation for readability.
While the leading space fixes spacing, consider using a template literal to make the conditional fragment clearer and avoid accidental spacing issues:- const message = 'I started following you.' - + (isFollowing ? '' : ' Hit the Follow button to follow me back.'); + const message = `I started following you.${ + isFollowing ? '' : ' Hit the Follow button to follow me back.' + }`;src/integrations/runtime/setUpBff.ts (1)
6-8
: Consider simplifying the Promise.allSettled usage.Since you're only connecting to one service,
Promise.allSettled
might be unnecessary here. Consider using a directawait
call for cleaner code:- await Promise.allSettled([ - eventBroker.connect() - ]); + await eventBroker.connect();However, if you plan to add more connections in the future, the current approach provides a good foundation.
segments/notification.json (1)
4-6
: Consider alphabetical ordering for better maintainability.The new protected module entries are correctly configured. However, consider organizing the entries alphabetically for better maintainability:
{ "./domain/notification/create": { "default": { "access": "protected" } }, "./domain/notification/getById": { "default": { "access": "protected" } }, - "./domain/notification/getByPostId": { "default": { "access": "protected" } }, - "./domain/notification/getRecent": { "default": { "access": "protected" } }, - "./domain/notification/remove": { "default": { "access": "protected" } } + "./domain/notification/getByPostId": { "default": { "access": "protected" } }, + "./domain/notification/getRecent": { "default": { "access": "protected" } }, + "./domain/notification/remove": { "default": { "access": "protected" } } }The configuration is functionally correct as-is.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.json
is excluded by!**/package-lock.json
📒 Files selected for processing (76)
package.json
(2 hunks)segments/notification.json
(1 hunks)segments/reads.json
(1 hunks)segments/writes.json
(2 hunks)services/bff.json
(1 hunks)services/notification.json
(1 hunks)services/reads.json
(1 hunks)services/reads2.json
(1 hunks)services/repository.json
(1 hunks)services/standalone.json
(1 hunks)services/writes.json
(1 hunks)src/domain/comic/create/create.ts
(0 hunks)src/domain/comic/erase/erase.ts
(0 hunks)src/domain/common/validateRange/validateRange.ts
(1 hunks)src/domain/creator.metrics/getByCreator/getByCreator.ts
(0 hunks)src/domain/creator.metrics/updateFollowers/updateFollowers.ts
(1 hunks)src/domain/creator.metrics/updateFollowing/updateFollowing.ts
(1 hunks)src/domain/creator.metrics/updatePosts/updatePosts.ts
(1 hunks)src/domain/creator/cleanNickname/cleanNickname.ts
(0 hunks)src/domain/creator/create/create.ts
(0 hunks)src/domain/creator/register/publish.ts
(0 hunks)src/domain/creator/register/register.ts
(0 hunks)src/domain/creator/register/subscribe.ts
(0 hunks)src/domain/image/create/convertDataUrl.ts
(1 hunks)src/domain/image/validate/validate.ts
(0 hunks)src/domain/post.metrics/getByPost/getByPost.ts
(0 hunks)src/domain/post.metrics/updateRatings/updateRatings.ts
(1 hunks)src/domain/post.metrics/updateReactions/updateReactions.ts
(1 hunks)src/domain/post/aggregate/aggregate.ts
(0 hunks)src/domain/post/create/create.ts
(0 hunks)src/domain/post/create/publish.ts
(0 hunks)src/domain/post/create/subscribe.ts
(0 hunks)src/domain/post/createWithComic/createWithComic.ts
(0 hunks)src/domain/post/createWithComment/createWithComment.ts
(0 hunks)src/domain/post/getRecommended/getRecommended.ts
(1 hunks)src/domain/post/remove/publish.ts
(0 hunks)src/domain/post/remove/remove.ts
(0 hunks)src/domain/post/remove/subscribe.ts
(0 hunks)src/domain/rating/toggle/publish.ts
(0 hunks)src/domain/rating/toggle/subscribe.ts
(0 hunks)src/domain/rating/toggle/switchOff.ts
(0 hunks)src/domain/rating/toggle/switchOn.ts
(0 hunks)src/domain/relation/establish/establish.ts
(0 hunks)src/domain/relation/establish/publish.ts
(0 hunks)src/domain/relation/establish/subscribe.ts
(0 hunks)src/domain/relation/getFollowers/getFollowers.ts
(0 hunks)src/domain/relation/getFollowing/getFollowing.ts
(0 hunks)src/domain/relation/translateToRequester/translate.ts
(0 hunks)src/domain/relation/translateToRequester/translateToRequester.ts
(0 hunks)src/integrations/authentication/errors/UnknownImplementation.ts
(1 hunks)src/integrations/database/errors/UnknownImplementation.ts
(1 hunks)src/integrations/eventbroker/errors/UnknownImplementation.ts
(1 hunks)src/integrations/eventbroker/implementations/memory/Memory.ts
(1 hunks)src/integrations/filestore/errors/UnknownImplementation.ts
(1 hunks)src/integrations/http/errors/UnknownImplementation.ts
(1 hunks)src/integrations/logging/errors/UnknownImplementation.ts
(1 hunks)src/integrations/notification/errors/UnknownImplementation.ts
(1 hunks)src/integrations/runtime/setUpBff.ts
(1 hunks)src/integrations/runtime/setUpWorker.ts
(1 hunks)src/integrations/runtime/tearDownBff.ts
(1 hunks)src/integrations/validation/errors/UnknownImplementation.ts
(1 hunks)src/integrations/validation/errors/UnknownValidator.ts
(1 hunks)src/webui/components/application/Header.tsx
(1 hunks)src/webui/components/application/Identity.tsx
(0 hunks)src/webui/components/common/Form.tsx
(0 hunks)src/webui/components/common/OrderAndSearchRow.tsx
(0 hunks)src/webui/components/common/PullToRefresh.tsx
(0 hunks)src/webui/components/common/ScrollLoader.tsx
(0 hunks)src/webui/components/notification/elementary/StartedFollowing.tsx
(1 hunks)src/webui/components/post/DeleteButton.tsx
(1 hunks)src/webui/components/reaction/Engagement.tsx
(1 hunks)src/webui/components/relation/elementary/FollowRow.tsx
(1 hunks)src/webui/features/PostDetails.tsx
(0 hunks)src/webui/features/PostHighlight.tsx
(1 hunks)src/webui/features/PostReactions.tsx
(1 hunks)src/webui/features/Profile.tsx
(1 hunks)
💤 Files with no reviewable changes (36)
- src/domain/post/createWithComic/createWithComic.ts
- src/domain/relation/getFollowing/getFollowing.ts
- src/domain/comic/erase/erase.ts
- src/domain/post/createWithComment/createWithComment.ts
- src/domain/post/remove/publish.ts
- src/domain/post.metrics/getByPost/getByPost.ts
- src/domain/image/validate/validate.ts
- src/domain/creator/cleanNickname/cleanNickname.ts
- src/webui/features/PostDetails.tsx
- src/webui/components/application/Identity.tsx
- src/domain/creator/register/register.ts
- src/domain/relation/translateToRequester/translate.ts
- src/domain/rating/toggle/subscribe.ts
- src/domain/post/remove/remove.ts
- src/domain/creator/register/publish.ts
- src/domain/rating/toggle/publish.ts
- src/domain/creator/create/create.ts
- src/domain/comic/create/create.ts
- src/webui/components/common/Form.tsx
- src/domain/post/create/subscribe.ts
- src/webui/components/common/OrderAndSearchRow.tsx
- src/domain/relation/establish/subscribe.ts
- src/domain/post/aggregate/aggregate.ts
- src/domain/creator.metrics/getByCreator/getByCreator.ts
- src/domain/post/create/create.ts
- src/webui/components/common/ScrollLoader.tsx
- src/webui/components/common/PullToRefresh.tsx
- src/domain/post/create/publish.ts
- src/domain/relation/translateToRequester/translateToRequester.ts
- src/domain/post/remove/subscribe.ts
- src/domain/relation/establish/establish.ts
- src/domain/rating/toggle/switchOn.ts
- src/domain/relation/establish/publish.ts
- src/domain/relation/getFollowers/getFollowers.ts
- src/domain/rating/toggle/switchOff.ts
- src/domain/creator/register/subscribe.ts
🔇 Additional comments (39)
src/domain/image/create/convertDataUrl.ts (1)
2-3
: Align import order to project conventions
Moving the type-only import above the value import enhances readability and consistency with the repository’s import ordering guidelines. No functional changes introduced.src/webui/components/post/DeleteButton.tsx (1)
3-3
: Formatting tweak looks good
The added blank line after theClickArea
import improves readability and aligns with the project's import-spacing conventions.src/webui/components/application/Header.tsx (1)
8-8
: Import ordering consistency
TheLogoutButton
import has been correctly moved below theLogo
import, aligning relative imports alphabetically and maintaining logical grouping.src/webui/components/reaction/Engagement.tsx (1)
5-5
: Import grouping consistency. The added blank line cleanly separates the localCompactNumber
import from the internalIcon
import, aligning with the project’s convention of grouping related imports for better readability.src/domain/post/getRecommended/getRecommended.ts (1)
2-2
: Import formatting updated for consistency.
The added space after the comma in the named imports aligns with the project’s import style conventions and improves readability. No functional changes introduced.src/domain/common/validateRange/validateRange.ts (1)
6-6
: Consistent import ordering
TheRange
type import is now placed immediately after theInvalidRange
import, which aligns with the project's import-order conventions. No functional changes were introduced.src/webui/components/relation/elementary/FollowRow.tsx (1)
6-8
: Add blank line to separate parent and sibling imports.This blank line between the parent-level import (
EditButton
) and the same-directory import (FollowButton
) enhances readability by clearly grouping imports according to their relative paths, aligning with our import ordering conventions.src/webui/features/PostReactions.tsx (1)
10-10
: Consistent import ordering: MoveCreatePostReaction
above hooks.The import for
CreatePostReaction
was relocated above the hook imports to align with the project's import ordering guidelines. No functional impact.src/webui/features/Profile.tsx (1)
13-15
: Consistent import ordering: Group hooks after components.The hooks
useCreator
,useEditProfile
, anduseEstablishRelation
were moved below component imports to follow the established import grouping strategy. Functionality unchanged.src/webui/features/PostHighlight.tsx (1)
6-8
: Switch to absolute^/webui
import paths.Updated component and context imports to use the absolute
^/webui
alias for consistency and clarity. No changes to logic or behavior.src/integrations/validation/errors/UnknownValidator.ts (1)
6-6
:✅ Verification successful
Good change for type safety and consistency.
Making the
name
parameter required is a solid improvement that ensures the error message will always have a meaningful validator name. This aligns with the broader standardization of error constructors mentioned in the summary.However, please verify that all existing callers of
UnknownValidator
have been updated to provide the requiredname
parameter:
🏁 Script executed:
#!/bin/bash # Description: Find all instantiations of UnknownValidator to ensure they provide the required name parameter # Expected: All constructor calls should include a string argument ast-grep --pattern 'new UnknownValidator($$$)'Length of output: 155
All UnknownValidator instantiations include the required parameter
A repository-wide search confirms the sole usage at
- src/integrations/validation/implementations/zod/Zod.ts:73 →
throw new UnknownValidator(key);
Since every constructor call now provides a string argument, this breaking change is safely applied.
src/domain/post.metrics/updateRatings/updateRatings.ts (1)
4-4
: Consistent import formatting applied.Removed the extra blank line to consolidate the three
import
statements into a continuous block. This is purely stylistic and aligns with the project’s import-order conventions.src/domain/post.metrics/updateReactions/updateReactions.ts (1)
4-4
: Consistent import formatting applied.The extraneous blank line between imports was removed for a tighter, more uniform import section. No changes to logic or functionality.
src/domain/creator.metrics/updatePosts/updatePosts.ts (1)
4-4
: Consistent import formatting applied.Eliminated the blank line separating
CountOperation
andupdate
imports. This formatting tweak improves readability without affecting behavior.src/domain/creator.metrics/updateFollowing/updateFollowing.ts (1)
4-4
: Consistent import formatting applied.Moved
update
import to follow the type import directly, removing the extra blank line for consistency across domain modules.package.json (2)
42-42
: Bumpjitar
dependency to ^0.9.2.Updated the core
jitar
package from ^0.9.0 to ^0.9.2 to leverage the latest bug fixes and improvements. Ensure all service configurations remain compatible with this version.
54-54
: Bump@jitar/plugin-vite
devDependency to ^0.9.2.Aligned the Vite plugin version with the core
jitar
bump. Confirm that the plugin’s new version works as expected in the build pipeline.segments/reads.json (1)
25-25
: LGTM! New access control entry follows established patterns.The new protected access entry for the rating toggle getData operation is consistent with the existing access control structure and naming conventions.
services/repository.json (1)
6-6
: LGTM! PWA assets properly added to repository configuration.The addition of service worker files (
registerSW.js
,sw.js
,workbox-*.js
) and web app manifest (manifest.webmanifest
) extends the repository's asset serving capabilities appropriately for Progressive Web App functionality.src/integrations/database/errors/UnknownImplementation.ts (1)
6-6
:✅ Verification successful
Breaking change: Verify all existing usage is updated.
Making the
name
parameter required improves error reporting by ensuring the error message always includes the specific unknown implementation name. However, this is a breaking change.Please verify that all existing instantiations of
UnknownImplementation
in the database integration have been updated to provide the requiredname
parameter:
🏁 Script executed:
#!/bin/bash # Description: Search for UnknownImplementation usage in database integration to ensure required parameter is provided # Search for UnknownImplementation instantiations rg -A 3 "new UnknownImplementation" --type ts # Search for any remaining optional parameter usage patterns ast-grep --pattern 'new UnknownImplementation()'Length of output: 2259
All
UnknownImplementation
Instantiations Updated – No Further Action NeededA search for
new UnknownImplementation
across all integration modules confirms that each instantiation now provides the requiredname
argument. No calls without arguments were found.Checked locations:
- src/integrations/filestore/implementation.ts
- src/integrations/database/implementation.ts
- src/integrations/http/implementation.ts
- src/integrations/authentication/implementation.ts
- src/integrations/validation/implementation.ts
- src/integrations/logging/implementation.ts
- src/integrations/notification/implementation.ts
- src/integrations/eventbroker/implementation.ts
All usages reflect the updated constructor signature; this breaking change has been fully addressed.
src/integrations/notification/errors/UnknownImplementation.ts (1)
6-6
:✅ Verification successful
Breaking change: Verify consistency across notification integration usage.
Excellent consistency with the database integration's
UnknownImplementation
class. Making thename
parameter required ensures comprehensive error reporting. However, this breaking change needs verification.Please verify that all existing instantiations of
UnknownImplementation
in the notification integration provide the requiredname
parameter:
🏁 Script executed:
#!/bin/bash # Description: Search for UnknownImplementation usage in notification integration # Search for UnknownImplementation instantiations in notification context rg -A 3 "new UnknownImplementation" src/integrations/notification/ --type ts # Verify consistency across all integration modules rg -A 3 "new UnknownImplementation" src/integrations/ --type tsLength of output: 2583
All
UnknownImplementation
Instantiations VerifiedEvery
new UnknownImplementation(…)
call in the following integration modules passes the requiredname
argument:
- src/integrations/authentication/implementation.ts
- src/integrations/database/implementation.ts
- src/integrations/eventbroker/implementation.ts
- src/integrations/filestore/implementation.ts
- src/integrations/http/implementation.ts
- src/integrations/logging/implementation.ts
- src/integrations/notification/implementation.ts
- src/integrations/validation/implementation.ts
No missing or parameterless instantiations found—this breaking change is safe to merge.
src/integrations/http/errors/UnknownImplementation.ts (1)
6-6
:✅ Verification successful
Good improvement to error handling, but verify for breaking changes.
Making the
name
parameter required is a logical improvement since the error message template on line 8 uses${name}
. This prevents undefined values from appearing in error messages.However, since this is a breaking change, please verify that all existing usages of this constructor provide the
name
parameter:
🏁 Script executed:
#!/bin/bash # Description: Check for UnknownImplementation constructor usage in http integration # Expected: All usages should have a name parameter provided # Search for instantiations of UnknownImplementation in http context rg -A 3 -B 1 "new UnknownImplementation\(" --type tsLength of output: 2594
No breaking change detected in
UnknownImplementation
constructor usageAll 8 instances of
new UnknownImplementation(...)
across the integration modules (HTTP, Validation, Filestore, Notification, Logging, Authentication, Database, EventBroker) pass theimplementationName
argument. Making thename
parameter required is safe—no existing code will break.src/integrations/filestore/errors/UnknownImplementation.ts (1)
6-6
: Consistent improvement to error handling.This change aligns with the http integration module and ensures the file system implementation name is always provided in error messages. The logic is sound since line 8 uses
${name}
in the error message template.src/integrations/authentication/errors/UnknownImplementation.ts (1)
6-6
: Consistent with the pattern across integration modules.The required
name
parameter ensures meaningful error messages for unknown authentication implementations. This maintains consistency with the changes in other integration modules.src/integrations/logging/errors/UnknownImplementation.ts (1)
6-6
:✅ Verification successful
LGTM! Constructor parameter change improves API consistency.
Making the
name
parameter required is a good practice that ensures meaningful error messages and aligns with similar changes across other integration error modules.Verify that all existing instantiations of this class have been updated to provide the required parameter:
🏁 Script executed:
#!/bin/bash # Description: Find all instantiations of UnknownImplementation to verify they provide the required parameter ast-grep --pattern 'new UnknownImplementation($$$)'Length of output: 896
All instantiations updated – change is safe to merge.
A search found eight call sites in
src/integrations/*/implementation.ts
, all passingimplementationName
tonew UnknownImplementation(...)
. There are no missing callers, so this breaking change is fully applied.src/domain/creator.metrics/updateFollowers/updateFollowers.ts (1)
4-4
: LGTM! Import formatting improvement.Consolidating imports by removing the unnecessary blank line improves code consistency.
src/integrations/eventbroker/implementations/memory/Memory.ts (1)
11-11
:❓ Verification inconclusive
LGTM! More logical initial connection state.
Changing the initial connection state from
true
tofalse
is more intuitive - connections should start as disconnected until explicitly established. This aligns well with the new setup/teardown scripts that manage connections explicitly.Verify that existing code doesn't rely on the initial
true
state:
🏁 Script executed:
#!/bin/bash # Description: Check for code that might depend on the initial connection state being true # Look for usage patterns that might assume initial connection rg -A 3 -B 3 "Memory.*connected|new Memory" --type tsLength of output: 1568
🏁 Script executed:
#!/bin/bash # Retrieve the Memory implementation to inspect connection logic rg -n "class Memory" -A50 -B0 src/integrations/eventbroker/implementations/memory/Memory.ts # Show the declaration and usage of #connected within the file rg -n "#connected" -A10 -B5 src/integrations/eventbroker/implementations/memory/Memory.tsLength of output: 2232
🏁 Script executed:
#!/bin/bash # Search for external usage of the `connected` property across the codebase rg -n "\.connected\b" --type tsLength of output: 1629
🏁 Script executed:
#!/bin/bash # Inspect runtime setup and teardown scripts for connection flow echo "=== setUpWorker.ts ===" rg -n "async function setUpWorker" -A20 -B0 src/integrations/runtime/setUpWorker.ts echo -e "\n=== tearDownWorker.ts ===" rg -n "async function tearDownWorker" -A20 -B0 src/integrations/runtime/tearDownWorker.ts echo -e "\n=== setUpBff.ts ===" rg -n "async function setUpBff" -A20 -B0 src/integrations/runtime/setUpBff.ts echo -e "\n=== tearDownBff.ts ===" rg -n "async function tearDownBff" -A20 -B0 src/integrations/runtime/tearDownBff.ts echo -e "\n=== EventBroker.ts ===" rg -n "export default class EventBroker" -A20 -B0 src/integrations/eventbroker/EventBroker.tsLength of output: 1180
🏁 Script executed:
#!/bin/bash # Search for explicit connect calls in runtime setup scripts echo "=== Runtime connect usage ===" rg -n "await .*connect\(" -A3 -B1 src/integrations/runtime # Inspect Database integration wrapper for connection delegation echo -e "\n=== Database.ts ===" rg -n "export default class Database" -A20 -B0 src/integrations/database/Database.tsLength of output: 998
LGTM: Default to disconnected is the right move
Initializing
#connected
asfalse
ensures connections are only live after an explicitconnect()
call, which matches our explicit setup/teardown flows. I’ve verified that no existing code implicitly relied onconnected === true
for normal operation—every disconnect is guarded by a.connected
check, andconnect()
is always invoked before use.Please double-check that all runtime startup scripts explicitly call
eventBroker.connect()
(e.g. insetUpWorker.ts
andsetUpBff.ts
) so that teardown and health-check logic sees the correctconnected
state.services/reads.json (1)
4-4
:✅ Verification successful
LGTM! Service runtime environment update.
The transition from Node-based to Worker-based setup/teardown scripts aligns with the broader runtime environment changes across multiple services for demo preparation.
Verify that the new Worker-based scripts exist and are functional:
Also applies to: 7-7
🏁 Script executed:
#!/bin/bash # Description: Verify the existence of the new Worker-based scripts # Check if the new setup and teardown scripts exist echo "Checking for setUpWorker script:" fd "setUpWorker" --type f echo "Checking for tearDownWorker script:" fd "tearDownWorker" --type f # Verify these scripts are properly implemented echo "Examining setUpWorker implementation:" cat src/integrations/runtime/setUpWorker.ts 2>/dev/null || echo "setUpWorker.ts not found" echo "Examining tearDownWorker implementation:" cat src/integrations/runtime/tearDownWorker.ts 2>/dev/null || echo "tearDownWorker.ts not found"Length of output: 1618
Worker-based setup/teardown scripts verified and approved
The new Worker-based scripts exist and contain the expected implementations:
- src/integrations/runtime/setUpWorker.ts
• Connects todatabase
andfileStore
with proper error handling- src/integrations/runtime/tearDownWorker.ts
• Disconnectsdatabase
,eventBroker
,fileStore
, andnotificationService
No further changes required.
services/writes.json (2)
7-7
:✅ Verification successful
Standardize lifecycle script to Worker.
Replaced the Node‐based teardown withtearDownWorker
to align with other services’ cleanup routines.Please verify that the
tearDownWorker
script exists underintegrations/runtime
:
🏁 Script executed:
#!/bin/bash fd 'tearDownWorker' -e ts -e jsLength of output: 74
Verified:
tearDownWorker.ts
existsThe
tearDownWorker
script was found at:
- src/integrations/runtime/tearDownWorker.ts
Cleanup routine is now aligned with other services. Approving these changes.
4-4
:✅ Verification successful
Standardize lifecycle script to Worker.
Replaced the Node‐based setup withsetUpWorker
to align with other services’ initialization routines.Please verify that the
setUpWorker
script exists underintegrations/runtime
:
🏁 Script executed:
#!/bin/bash fd 'setUpWorker' -e ts -e jsLength of output: 68
Verified:
setUpWorker
script exists
ThesetUpWorker
file was found atsrc/integrations/runtime/setUpWorker.ts
, aligning with the standardized Worker lifecycle initialization.
Approval granted.services/standalone.json (2)
4-4
:✅ Verification successful
Standardize standalone setup script to Worker.
ReplacedsetUpNode
withsetUpWorker
to match the new service‐initialization convention.Verify the script exists under
integrations/runtime
:
🏁 Script executed:
#!/bin/bash fd 'setUpWorker' -e ts -e jsLength of output: 68
Standardize standalone setup script to Worker
ReplacedsetUpNode
withsetUpWorker
inservices/standalone.json
to align with the new service-initialization convention.
Confirmed thatsrc/integrations/runtime/setUpWorker.ts
exists.
9-9
:✅ Verification successful
Standardize standalone teardown script to Worker.
ReplacedtearDownNode
withtearDownWorker
to match the new service‐cleanup convention.Verify the script exists under
integrations/runtime
:
🏁 Script executed:
#!/bin/bash fd 'tearDownWorker' -e ts -e jsLength of output: 74
Verified: tearDownWorker script exists
ThetearDownWorker
file is present atsrc/integrations/runtime/tearDownWorker.ts
, so the reference inservices/standalone.json
is valid.services/bff.json (2)
7-7
:✅ Verification successful
Use BFF‐specific teardown script.
Updated fromtearDownNode
totearDownBff
for proper BFF cleanup.Please confirm the
tearDownBff
script is present:
🏁 Script executed:
#!/bin/bash fd 'tearDownBff' -e ts -e jsLength of output: 68
Confirmed tearDownBff script presence
Found thetearDownBff
file at:
- src/integrations/runtime/tearDownBff.ts
No further changes needed.
4-4
:✅ Verification successful
Use BFF‐specific setup script.
Updated fromsetUpNode
tosetUpBff
to leverage the new BFF runtime integration.Please confirm the
setUpBff
script is present:
🏁 Script executed:
#!/bin/bash fd 'setUpBff' -e ts -e jsLength of output: 62
Confirmed:
setUpBff
script is present
ThesetUpBff
file was found atsrc/integrations/runtime/setUpBff.ts
, so updatingservices/bff.json
to use it is valid.services/reads2.json (1)
4-4
: LGTM! Configuration update aligns with architectural refactor.The update from Node-based to Worker-based setup/teardown scripts is consistent with the broader architectural changes mentioned in the PR objectives. The health checks remain appropriate for a worker service focusing on database and fileStore operations.
Also applies to: 7-7
src/integrations/eventbroker/errors/UnknownImplementation.ts (1)
6-6
: LGTM! Improved error handling consistency.Making the
name
parameter required ensures that error messages always include the specific implementation name, which improves debugging and error clarity. This change aligns with the standardization of error handling patterns across integration modules.src/integrations/runtime/setUpWorker.ts (1)
7-10
: LGTM! Proper separation of worker concerns.The removal of eventBroker and notificationService connections is appropriate for a worker setup that should focus on data operations. The Promise.allSettled array now correctly includes only database and fileStore connections.
src/integrations/runtime/tearDownBff.ts (1)
2-8
: LGTM! Well-structured teardown logic.The teardown implementation follows best practices:
- Conditional check prevents unnecessary disconnection attempts
Promise.allSettled
ensures graceful completion even if disconnection fails- Clean resource management approach
src/integrations/runtime/setUpBff.ts (1)
10-19
: Excellent error handling with proper cleanup.The catch block properly handles connection failures by:
- Checking if the eventBroker is connected before attempting disconnection
- Using
Promise.allSettled
for graceful cleanup- Rethrowing the original error after cleanup
This ensures no resource leaks occur during connection failures.
"./domain/post/update": { "default": { "access": "protected" } }, | ||
|
||
"./domain/post.metrics/create/insertData": { "default": { "access": "protected" } }, | ||
"./domain/post.metrics/update": { "default": { "access": "protected" } }, |
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.
💡 Verification agent
🧩 Analysis chain
Add protected post metrics update operation.
The new entry for "./domain/post.metrics/update"
correctly marks the update operation as protected. Ensure the corresponding module exists and is exported under that path.
You can verify its presence with:
🏁 Script executed:
#!/bin/bash
rg -l '"update"' -g 'src/domain/post.metrics/*'
Length of output: 49
🏁 Script executed:
#!/bin/bash
# List all files under src/domain/post.metrics to verify existence of the module
echo "=== Files in src/domain/post.metrics ==="
find src/domain/post.metrics -maxdepth 1 -type f
# Search for any occurrence of the word 'update' (unquoted) in that directory
echo "=== Searching for 'update' keyword ==="
rg -n 'update' -g 'src/domain/post.metrics/*'
Length of output: 385
Missing post.metrics/update
module
The new entry in segments/writes.json
references ./domain/post.metrics/update
, but no corresponding file or export exists under src/domain/post.metrics
.
- There is no
update.ts
(or.js
) insrc/domain/post.metrics/
. - Ensure you add and export the
update
operation module atsrc/domain/post.metrics/update.ts
(or adjust the path in the JSON) before approving.
🤖 Prompt for AI Agents
In segments/writes.json at line 23, the entry for "./domain/post.metrics/update"
marks the update operation as protected but the corresponding module file
src/domain/post.metrics/update.ts (or .js) does not exist. To fix this, create
the update module file under src/domain/post.metrics/ with the appropriate
export, or if the module exists elsewhere, update the path in writes.json to
point to the correct location.
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.
The segmentation files also support index resolution. So implicitly ./domain/post.metrics/update
refers to ./domain/post.metrics/update/index.ts
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.
🧩 Analysis chain
@basmasking Thank you for the clarification! I understand now that the segmentation files support index resolution, so ./domain/post.metrics/update
implicitly refers to ./domain/post.metrics/update/index.ts
. Let me verify the existence of this index file.
🏁 Script executed:
#!/bin/bash
# Check if the update module exists as an index file
echo "=== Checking for src/domain/post.metrics/update/index.ts ==="
ls -la src/domain/post.metrics/update/ 2>/dev/null || echo "Directory does not exist"
# Also check for any index files in that directory
echo "=== Looking for index files ==="
find src/domain/post.metrics/update -name "index.*" 2>/dev/null || echo "No index files found or directory doesn't exist"
Length of output: 562
@basmasking Perfect! I can confirm that the src/domain/post.metrics/update/index.ts
file exists, along with the implementation in update.ts
. The segmentation configuration is correctly set up. Thank you for educating me about the index resolution feature - this clarification helps me better understand how the segmentation system works in your project.
The entry for "./domain/post.metrics/update"
in segments/writes.json
is properly configured!
/| /|
( :v: )
|(_)|
✏️ Learnings added
Learnt from: basmasking
PR: MaskingTechnology/comify#412
File: segments/writes.json:23-23
Timestamp: 2025-05-23T20:57:56.377Z
Learning: Segmentation files in the Comify project support index resolution. When a path like `./domain/post.metrics/update` is referenced in segment configuration files, it implicitly refers to `./domain/post.metrics/update/index.ts` (or similar extension).
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
"./domain/creator/update": { "default": { "access": "protected" } }, | ||
|
||
"./domain/creator.metrics/create/insertData": { "default": { "access": "protected" } }, | ||
"./domain/creator.metrics/update": { "default": { "access": "protected" } }, |
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.
💡 Verification agent
🧩 Analysis chain
Add protected creator metrics update operation.
The new entry for "./domain/creator.metrics/update"
correctly marks the update operation as protected. Ensure the corresponding module exists and is exported under that path.
You can verify its presence with:
🏁 Script executed:
#!/bin/bash
rg -l '"update"' -g 'src/domain/creator.metrics/*'
Length of output: 52
I’m not finding any module named update
under src/domain/creator.metrics
. Let’s list all files in that directory to confirm:
🏁 Script executed:
#!/bin/bash
# List all direct files under src/domain/creator.metrics
find src/domain/creator.metrics -maxdepth 1 -type f -printf "%f\n"
Length of output: 101
It looks like there’s no update
file in src/domain/creator.metrics
. Let’s check if any of the existing files export or mention an update operation:
🏁 Script executed:
#!/bin/bash
# Search for any 'update' mentions in creator.metrics files
rg -n "update" -g "src/domain/creator.metrics/*"
Length of output: 48
Missing update
module in creator.metrics
The new entry in segments/writes.json
references ./domain/creator.metrics/update
, but there’s no corresponding file under src/domain/creator.metrics/
. You’ll need to either:
• Add an update.ts
(or .js
) module exporting the update operation at src/domain/creator.metrics/update
• Or adjust the JSON path to point at an existing module (e.g. consolidate under index.ts
)
Please update the code or mapping so that the protected operation actually exists.
🤖 Prompt for AI Agents
In segments/writes.json at line 12, the entry references
"./domain/creator.metrics/update" which does not correspond to any existing
module under src/domain/creator.metrics/. To fix this, either create a new
update.ts (or .js) file exporting the update operation at
src/domain/creator.metrics/update, or modify the JSON path to point to an
existing module that exports the update operation, such as index.ts. Ensure the
path in the JSON matches an actual module exporting the update functionality.
"healthChecks": [ | ||
"./integrations/runtime/notificationHealthCheck", | ||
"./integrations/runtime/databaseHealthCheck" | ||
], |
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.
💡 Verification agent
🧩 Analysis chain
Questionable removal of notification health check.
Removing the notification health check from the notification service configuration seems counterintuitive. A notification service should typically monitor its own health to ensure it can properly handle notification operations.
🏁 Script executed:
#!/bin/bash
# Description: Check if notification health check exists and understand why it was removed
# Expected: Find notification health check implementation and other service configs for comparison
echo "Searching for notification health check implementation:"
fd "*[Nn]otification*[Hh]ealth*" --type f
echo -e "\nComparing health checks across service configurations:"
fd "*.json" services/ --exec sh -c 'echo "=== $1 ===" && jq ".healthChecks" "$1"' --
Length of output: 969
To correct the pattern errors and surface any missing health checks, let’s re-run with proper glob matching:
🏁 Script executed:
#!/bin/bash
set -e
echo "Searching for notification health check implementation:"
# Look for any file whose name includes “notification” and “health”
fd --glob '*notification*health*' --type f
echo -e "\nComparing healthChecks across all service configs:"
# For each JSON in services/, print its .healthChecks array
fd --glob '*.json' services/ --exec sh -c '
echo "=== $1 ==="
jq ".healthChecks" "$1"
' _ {} \;
Length of output: 1307
Add NotificationHealthCheck back into notification service
The notification.json
healthChecks array currently only includes the database check, but we have a notificationHealthCheck
implementation and see it used in standalone.json
. To ensure the notification service self-monitors, include it here:
• services/notification.json (lines 9–11):
- Insert
"./integrations/runtime/notificationHealthCheck",
before the database entry
Suggested diff:
"healthChecks": [
- "./integrations/runtime/databaseHealthCheck"
+ "./integrations/runtime/notificationHealthCheck",
+ "./integrations/runtime/databaseHealthCheck"
],
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"healthChecks": [ | |
"./integrations/runtime/notificationHealthCheck", | |
"./integrations/runtime/databaseHealthCheck" | |
], | |
"healthChecks": [ | |
"./integrations/runtime/notificationHealthCheck", | |
"./integrations/runtime/databaseHealthCheck" | |
], |
🤖 Prompt for AI Agents
In services/notification.json around lines 9 to 11, the notificationHealthCheck
was removed from the healthChecks array, which prevents the notification service
from monitoring its own health. To fix this, add the entry
"./integrations/runtime/notificationHealthCheck" before the existing
databaseHealthCheck entry in the healthChecks array to ensure the notification
service self-monitors properly.
"url": "http://127.0.0.1:4001", | ||
"setUp": [ | ||
"./integrations/runtime/setUpNode" | ||
"./integrations/runtime/setUpWorker" |
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.
💡 Verification agent
🧩 Analysis chain
Verify the setup script choice for notification service.
The notification service is configured to use setUpWorker
, but based on the setUpWorker.ts file review, this setup script doesn't establish notificationService connections. This seems contradictory for a service that should handle notifications.
Also applies to: 7-7
🏁 Script executed:
#!/bin/bash
# Description: Verify if notification service should use different setup script
# Expected: Check if there's a specific setup for notification services or if this is intentional
echo "Checking available setup scripts:"
fd "setUp.*\.ts$" src/integrations/runtime
echo -e "\nContent of tearDownWorker.ts:"
cat src/integrations/runtime/tearDownWorker.ts 2>/dev/null || echo "tearDownWorker.ts not found"
echo -e "\nSearching for notification-specific setup scripts:"
fd ".*[Nn]otification.*\.ts$" src/integrations/runtime
Length of output: 1244
🏁 Script executed:
#!/bin/bash
# Inspect setUpWorker.ts to see which services it connects
echo "== Content of setUpWorker.ts =="
cat src/integrations/runtime/setUpWorker.ts || echo "ERROR: setUpWorker.ts not found"
echo -e "\n== References to notificationService in setUpWorker.ts =="
grep -R "notificationService" -n src/integrations/runtime/setUpWorker.ts || echo "No notificationService.connect calls found"
Length of output: 881
🏁 Script executed:
#!/bin/bash
# Display notification service configuration for review
echo "== services/notification.json =="
cat services/notification.json
Length of output: 518
Fix notification service setup and health checks
The notification service is currently using setUpWorker
(which only connects database and file store) and has removed its notification health check—so it never actually wires up or verifies the notificationService
dependency.
Please update services/notification.json
accordingly:
- In the
setUp
array, use a script that connects the notificationService (for example, switch to./integrations/runtime/setUpGateway
if it includesnotificationService.connect()
, or extend/create asetUpNotification.ts
that does). - In the
healthChecks
array, re-add the notification health check:"healthChecks": [ - "./integrations/runtime/databaseHealthCheck" + "./integrations/runtime/databaseHealthCheck", + "./integrations/runtime/notificationHealthCheck" ]
🤖 Prompt for AI Agents
In services/notification.json at lines 4 and 7, the setup script setUpWorker
does not establish notificationService connections, and the notification health
check is missing. Replace setUpWorker in the setUp array with a script that
connects notificationService, such as setUpGateway or a new setUpNotification.ts
that includes notificationService.connect(). Also, re-add the notification
health check to the healthChecks array to ensure the service dependency is
verified.
services/standalone.json
Outdated
"tearDown": [ | ||
"./integrations/runtime/tearDownGateway", | ||
"./integrations/runtime/tearDownNode" | ||
"./integrations/runtime/tearDownWorker" |
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.
"./integrations/runtime/tearDownWorker" | |
"./integrations/runtime/tearDownWorker", | |
"./integrations/runtime/tearDownBff" |
|
Fixes #411
Changes proposed in this pull request:
@MaskingTechnology/comify
Summary by CodeRabbit
New Features
Bug Fixes
Chores
Refactor