-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat: add Matrix notification support #6717
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
base: v4.x
Are you sure you want to change the base?
Conversation
Add comprehensive Matrix notification support to Coolify with the same feature set as existing Discord and Slack integrations. Features: - Matrix homeserver URL configuration - Internal room ID support - Access token authentication - Friendly name for notification setup - All notification types supported (deployments, backups, server events, etc.) - Test notification functionality - Encrypted storage of sensitive credentials - Full Livewire UI integration Implementation includes: - MatrixNotificationSettings model with encrypted fields - Matrix notification channel and message DTO - SendMessageToMatrixJob for queued delivery - Livewire component for settings management - Comprehensive test coverage - Route and navigation integration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds Matrix notification support: DTO, channel interface and channel, queued job to send messages, model/migration/factory for per-team settings, Livewire settings UI with route and navbar link, Team and notification-settings trait updates, notification-to-Matrix conversions, tests, and documentation. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User as User
participant UI as Livewire: Matrix Settings
participant App as Laravel App
participant Chan as MatrixChannel
participant Job as SendMessageToMatrixJob
participant HS as Matrix Homeserver
Note over UI,App: Configure/enable Matrix for a Team or send test
User->>UI: Save settings / Click "Send Test"
UI->>App: Persist settings or trigger notification
App->>Chan: Channel->send(notifiable, notification)
Chan->>App: Read Team.matrixNotificationSettings
alt enabled and complete
Chan->>Job: dispatch(message, homeserverUrl, roomId, accessToken) [queue: high]
Job->>HS: PUT /_matrix/client/v3/rooms/{roomId}/send/{eventType}/{txnId} (Authorization: Bearer token)
HS-->>Job: 200/OK or error
else disabled/missing config
Chan-->>App: return without dispatch
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes P.S. I’ll be back — self-host your Matrix, pass the tacos (corn only, gluten is the enemy). Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal). Please share your feedback with us on this Discord post. 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 10
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (16)
app/Jobs/SendMessageToMatrixJob.php
(1 hunks)app/Livewire/Notifications/Matrix.php
(1 hunks)app/Models/MatrixNotificationSettings.php
(1 hunks)app/Models/Team.php
(5 hunks)app/Notifications/Application/DeploymentSuccess.php
(2 hunks)app/Notifications/Channels/MatrixChannel.php
(1 hunks)app/Notifications/Channels/SendsMatrix.php
(1 hunks)app/Notifications/Dto/MatrixMessage.php
(1 hunks)app/Notifications/Test.php
(3 hunks)app/Traits/HasNotificationSettings.php
(3 hunks)database/factories/MatrixNotificationSettingsFactory.php
(1 hunks)database/migrations/2025_09_27_174514_create_matrix_notification_settings_table.php
(1 hunks)resources/views/components/notification/navbar.blade.php
(1 hunks)resources/views/livewire/notifications/matrix.blade.php
(1 hunks)routes/web.php
(2 hunks)tests/Feature/MatrixNotificationTest.php
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (37)
{app,bootstrap,config,database,routes,resources,tests}/**/*.php
📄 CodeRabbit inference engine (.cursor/rules/README.mdc)
Adhere to PSR-12 coding standards for all PHP code
Files:
app/Notifications/Channels/SendsMatrix.php
resources/views/components/notification/navbar.blade.php
database/migrations/2025_09_27_174514_create_matrix_notification_settings_table.php
app/Models/Team.php
app/Notifications/Channels/MatrixChannel.php
app/Models/MatrixNotificationSettings.php
routes/web.php
app/Notifications/Dto/MatrixMessage.php
app/Traits/HasNotificationSettings.php
app/Notifications/Test.php
tests/Feature/MatrixNotificationTest.php
resources/views/livewire/notifications/matrix.blade.php
app/Jobs/SendMessageToMatrixJob.php
app/Livewire/Notifications/Matrix.php
app/Notifications/Application/DeploymentSuccess.php
database/factories/MatrixNotificationSettingsFactory.php
app/Notifications/**/*.php
📄 CodeRabbit inference engine (.cursor/rules/application-architecture.mdc)
Implement notification classes under app/Notifications
Files:
app/Notifications/Channels/SendsMatrix.php
app/Notifications/Channels/MatrixChannel.php
app/Notifications/Dto/MatrixMessage.php
app/Notifications/Test.php
app/Notifications/Application/DeploymentSuccess.php
**/*.php
📄 CodeRabbit inference engine (.cursor/rules/development-workflow.mdc)
**/*.php
: Follow PSR-12 coding standards for all PHP code
Format PHP code with Laravel Pint configuration
Run static analysis with PHPStan to ensure type safety in PHP code
Document complex methods with PHPDoc blocks including parameters, return types, and thrown exceptions
**/*.php
: Always use curly braces for control structures, even for single-line bodies
Use PHP 8 constructor property promotion; do not leave empty __construct() methods
Declare explicit return types for functions/methods and use parameter type hints
Prefer PHPDoc blocks over inline comments; document complex logic and array shapes when useful
Enum case names should be TitleCase
Follow PSR-12 and run Laravel Pint to auto-format code
Files:
app/Notifications/Channels/SendsMatrix.php
resources/views/components/notification/navbar.blade.php
database/migrations/2025_09_27_174514_create_matrix_notification_settings_table.php
app/Models/Team.php
app/Notifications/Channels/MatrixChannel.php
app/Models/MatrixNotificationSettings.php
routes/web.php
app/Notifications/Dto/MatrixMessage.php
app/Traits/HasNotificationSettings.php
app/Notifications/Test.php
tests/Feature/MatrixNotificationTest.php
resources/views/livewire/notifications/matrix.blade.php
app/Jobs/SendMessageToMatrixJob.php
app/Livewire/Notifications/Matrix.php
app/Notifications/Application/DeploymentSuccess.php
database/factories/MatrixNotificationSettingsFactory.php
app/**/*.php
📄 CodeRabbit inference engine (.cursor/rules/development-workflow.mdc)
Use database transactions to group related write operations for consistency in services/controllers/jobs
Files:
app/Notifications/Channels/SendsMatrix.php
app/Models/Team.php
app/Notifications/Channels/MatrixChannel.php
app/Models/MatrixNotificationSettings.php
app/Notifications/Dto/MatrixMessage.php
app/Traits/HasNotificationSettings.php
app/Notifications/Test.php
app/Jobs/SendMessageToMatrixJob.php
app/Livewire/Notifications/Matrix.php
app/Notifications/Application/DeploymentSuccess.php
{app,bootstrap,config,database,routes,tests}/**/*.php
📄 CodeRabbit inference engine (.cursor/rules/laravel-boost.mdc)
{app,bootstrap,config,database,routes,tests}/**/*.php
: Always use curly braces for control structures, even for single-line statements
Use PHP 8 constructor property promotion in __construct(); do not allow empty constructors
Always use explicit return type declarations for methods and functions
Use appropriate PHP type hints for method parameters
Prefer PHPDoc blocks over inline comments; only add inline comments for very complex code
Files:
app/Notifications/Channels/SendsMatrix.php
database/migrations/2025_09_27_174514_create_matrix_notification_settings_table.php
app/Models/Team.php
app/Notifications/Channels/MatrixChannel.php
app/Models/MatrixNotificationSettings.php
routes/web.php
app/Notifications/Dto/MatrixMessage.php
app/Traits/HasNotificationSettings.php
app/Notifications/Test.php
tests/Feature/MatrixNotificationTest.php
app/Jobs/SendMessageToMatrixJob.php
app/Livewire/Notifications/Matrix.php
app/Notifications/Application/DeploymentSuccess.php
database/factories/MatrixNotificationSettingsFactory.php
{app,bootstrap,database,routes,tests}/**/*.php
📄 CodeRabbit inference engine (.cursor/rules/laravel-boost.mdc)
Never call env() outside configuration files; use config() elsewhere
Files:
app/Notifications/Channels/SendsMatrix.php
database/migrations/2025_09_27_174514_create_matrix_notification_settings_table.php
app/Models/Team.php
app/Notifications/Channels/MatrixChannel.php
app/Models/MatrixNotificationSettings.php
routes/web.php
app/Notifications/Dto/MatrixMessage.php
app/Traits/HasNotificationSettings.php
app/Notifications/Test.php
tests/Feature/MatrixNotificationTest.php
app/Jobs/SendMessageToMatrixJob.php
app/Livewire/Notifications/Matrix.php
app/Notifications/Application/DeploymentSuccess.php
database/factories/MatrixNotificationSettingsFactory.php
resources/views/**/*.blade.php
📄 CodeRabbit inference engine (.cursor/rules/development-workflow.mdc)
Use semantic Tailwind CSS classes and consistent spacing in Blade templates
resources/views/**/*.blade.php
: In Blade views, prefer using x-forms components with canGate and :canResource instead of wrapping elements in @can/@else blocks
Remove legacy @can/@else blocks around individual form inputs/buttons and migrate to the single-line component pattern
Choose gates consistently in views: use update for configuration changes, deploy for operational actions, view for read-only access, and delete for destructive actions
Always pass the specific resource to :canResource (e.g., :canResource="$application", "$service", "$server"), and use team context for creation permissions (e.g., :canResource="auth()->user()->currentTeam" with canGate="createAnyResource")
Only set autoDisable="false" when also providing explicit :disabled logic on the component
Use single-line authorized components for forms (inputs, selects, checkboxes, buttons) to reduce duplication (e.g., <x-forms.input canGate="update" :canResource="$resource" ... />)
resources/views/**/*.blade.php
: Prefer Alpine.js directives (x-data, x-on, x-show, x-model, x-init) for lightweight interactivity in Blade views
Use enhanced <x-forms.*> components with canGate and canResource for authorization instead of @can/@else blocks
When protecting forms, pass canGate and :canResource to all x-forms components; rely on autoDisable=true for unauthorized users
Apply Tailwind responsive utilities (e.g., grid breakpoints) for mobile-first layouts
Support dark mode using Tailwind dark: variants on relevant elements
Ensure interactive controls include appropriate ARIA attributes (e.g., aria-label, aria-describedby) for accessibility
resources/views/**/*.blade.php
: In Blade views, prefer x-forms.* components with canGate and :canResource for authorization (autoDisable defaults to true) instead of manual permission blocks.
Do not wrap x-forms.* components in @can/@else to toggle disabled state; use component-level canGate/:can...
Files:
resources/views/components/notification/navbar.blade.php
resources/views/livewire/notifications/matrix.blade.php
resources/views/{layouts,components,livewire,server,auth,emails,errors}/**/*.blade.php
📄 CodeRabbit inference engine (.cursor/rules/frontend-patterns.mdc)
Organize Blade templates into the specified folders: layouts/, components/, livewire/, and feature-specific directories server/, auth/, emails/, errors/
Files:
resources/views/components/notification/navbar.blade.php
resources/views/livewire/notifications/matrix.blade.php
resources/**
📄 CodeRabbit inference engine (.cursor/rules/project-overview.mdc)
Store frontend assets and views under resources
Files:
resources/views/components/notification/navbar.blade.php
resources/views/livewire/notifications/matrix.blade.php
{app/Http/Controllers/**/*.php,resources/views/**/*.blade.php}
📄 CodeRabbit inference engine (.cursor/rules/laravel-boost.mdc)
Prefer named routes and the route() helper for generating URLs
Files:
resources/views/components/notification/navbar.blade.php
resources/views/livewire/notifications/matrix.blade.php
resources/{views/**/*.blade.php,js/**/*.vue}
📄 CodeRabbit inference engine (.cursor/rules/laravel-boost.mdc)
resources/{views/**/*.blade.php,js/**/*.vue}
: Use Tailwind utility classes; remove redundant classes; prefer gap-* utilities for spacing instead of margins when listing items
If existing UI supports dark mode, mirror support using dark: variants
Files:
resources/views/components/notification/navbar.blade.php
resources/views/livewire/notifications/matrix.blade.php
resources/**/*.{blade.php,css}
📄 CodeRabbit inference engine (CLAUDE.md)
Do not use deprecated Tailwind v4 utilities; use replacements (e.g., overflow-ellipsis -> text-ellipsis, shrink-, grow-)
Files:
resources/views/components/notification/navbar.blade.php
resources/views/livewire/notifications/matrix.blade.php
database/migrations/**/*.php
📄 CodeRabbit inference engine (.cursor/rules/README.mdc)
Define all schema changes via Laravel migrations
Create descriptive migrations with proper foreign keys, cascading deletes, indexes, and timestamps
When modifying a column in a migration, include all previously defined attributes to avoid dropping them
When modifying a column, include all previously defined attributes in the migration
Files:
database/migrations/2025_09_27_174514_create_matrix_notification_settings_table.php
database/migrations/*.php
📄 CodeRabbit inference engine (.cursor/rules/database-patterns.mdc)
database/migrations/*.php
: Place all database migrations in database/migrations/
Write incremental, reversible migrations with proper rollback (down) support
Define foreign keys using foreignId for relationships and include timestamps in tables
Use UUID primary keys at the schema level for tables that require them
Add deleted_at columns in migrations for soft-deleted models
Create appropriate indexes: primary keys, foreign key indexes, composite indexes for common queries, and unique constraints for business rules
Files:
database/migrations/2025_09_27_174514_create_matrix_notification_settings_table.php
database/migrations/**
📄 CodeRabbit inference engine (.cursor/rules/project-overview.mdc)
Keep database migrations under database/migrations
Files:
database/migrations/2025_09_27_174514_create_matrix_notification_settings_table.php
app/Models/**/*.php
📄 CodeRabbit inference engine (.cursor/rules/application-architecture.mdc)
Keep Eloquent domain models in app/Models; models represent core entities (e.g., Application, Server, Service, Team, Project)
app/Models/**/*.php
: Define $fillable for mass assignment protection in Eloquent models
Use $casts for attribute casting (e.g., arrays, enums, datetimes) in Eloquent models
Define relationships using Eloquent relation return types (e.g., BelongsTo, HasMany)
app/Models/**/*.php
: Define Eloquent relationships using proper relationship methods with return type hints; prefer relationships over raw queries or manual joins
Prefer defining casts in the casts() method instead of the $casts property, following existing conventions
app/Models/**/*.php
: Define Eloquent relationships with proper return type hints and prefer relationships over raw queries
Prefer eager loading to avoid N+1 queries; use query scopes and indexes for performance-critical queries
Files:
app/Models/Team.php
app/Models/MatrixNotificationSettings.php
app/Models/*.php
📄 CodeRabbit inference engine (.cursor/rules/database-patterns.mdc)
app/Models/*.php
: Make Eloquent models extend the shared BaseModel for common functionality
Use UUID primary keys on models (e.g., via HasUuids)
Enable soft deletes on models that require audit trails (use SoftDeletes)
Enable activity logging on models using the Spatie LogsActivity trait
Include HasFactory on Eloquent models for factory support
Define explicit Eloquent relationships (belongsTo/hasMany/etc.) between related models
Use model events/hooks to maintain data consistency (e.g., clean up related records on delete)
Apply team-based global scopes on team-scoped models to enforce multi-tenancy isolation by default
Files:
app/Models/Team.php
app/Models/MatrixNotificationSettings.php
app/Models/**
📄 CodeRabbit inference engine (.cursor/rules/project-overview.mdc)
Place domain models under app/Models
Files:
app/Models/Team.php
app/Models/MatrixNotificationSettings.php
{app/Http/Controllers,app/Models}/**/*.php
📄 CodeRabbit inference engine (.cursor/rules/laravel-boost.mdc)
{app/Http/Controllers,app/Models}/**/*.php
: Avoid DB::; prefer Model::query() and Eloquent/query builder usage
Prevent N+1 queries by eager loading related models
Files:
app/Models/Team.php
app/Models/MatrixNotificationSettings.php
routes/{api.php,web.php}
📄 CodeRabbit inference engine (.cursor/rules/README.mdc)
Define HTTP routes in routes/api.php and routes/web.php according to their purpose (API vs web)
Files:
routes/web.php
routes/web.php
📄 CodeRabbit inference engine (.cursor/rules/api-and-routing.mdc)
Define web interface routes in routes/web.php and protect dashboard/core pages with auth and verified middleware
Define HTTP web routes in routes/web.php as the entry point for the request lifecycle
Files:
routes/web.php
routes/*.php
📄 CodeRabbit inference engine (CLAUDE.md)
Group routes by middleware/prefix, use route model binding, consistent route names (resource.action), and proper HTTP verbs
Files:
routes/web.php
app/Traits/**/*.php
📄 CodeRabbit inference engine (.cursor/rules/application-architecture.mdc)
Place reusable PHP traits in app/Traits
Share behavior via Traits (e.g., ExecuteRemoteCommand) rather than duplication
Files:
app/Traits/HasNotificationSettings.php
tests/**/*.php
📄 CodeRabbit inference engine (.cursor/rules/README.mdc)
Write application tests using Pest PHP
Write feature tests for API endpoints using Pest; mock external services and assert JSON responses and side effects
Add tests validating that components respect authorization (e.g., unauthorized users see disabled inputs; checkbox instantSave becomes false)
Include security tests covering SQL injection resistance, XSS validation, and enforcement of team isolation (403 on cross-team access).
tests/**/*.php
: Use Pest PHP (v3.8+) as the primary testing framework for all tests
Use Mockery for mocking and stubbing dependencies in tests
Files:
tests/Feature/MatrixNotificationTest.php
tests/Feature/**/*.php
📄 CodeRabbit inference engine (.cursor/rules/application-architecture.mdc)
Place integration/request lifecycle tests under tests/Feature
tests/Feature/**/*.php
: Place integration and API feature tests under tests/Feature
Use Laravel HTTP helpers (getJson, postJson, assertJson*) for API endpoint tests
Files:
tests/Feature/MatrixNotificationTest.php
tests/**
📄 CodeRabbit inference engine (.cursor/rules/project-overview.mdc)
Keep automated tests (Pest/Dusk) under tests
Files:
tests/Feature/MatrixNotificationTest.php
tests/{Feature,Unit}/**/*.php
📄 CodeRabbit inference engine (.cursor/rules/laravel-boost.mdc)
tests/{Feature,Unit}/**/*.php
: All tests must be written using Pest; do not remove tests without approval
Use specific response assertion helpers (e.g., assertForbidden, assertNotFound) instead of generic status assertions
Use model factories when creating models in tests; check for custom factory states
Use Faker via $this->faker or fake() consistently with existing conventions
Use Pest datasets to reduce duplication, especially for validation tests
Write Livewire tests using Livewire::test and assertSeeLivewire where applicable
tests/{Feature,Unit}/**/*.php
: Write tests using Pest; tests live in tests/Feature and tests/Unit and should cover happy, failure, and edge paths
Prefer specific response assertions like assertSuccessful, assertForbidden, assertNotFound over generic assertStatus codes
Use model factories in tests and consider Pest datasets for repetitive validation scenarios
Run minimal, targeted Pest tests (by file or --filter) after changes; don’t delete test files
Files:
tests/Feature/MatrixNotificationTest.php
{app/Livewire/**/*.php,resources/views/livewire/**/*.blade.php}
📄 CodeRabbit inference engine (.cursor/rules/README.mdc)
Implement frontend using Livewire components with Blade views; pair with Alpine.js and Tailwind CSS
Files:
resources/views/livewire/notifications/matrix.blade.php
app/Livewire/Notifications/Matrix.php
resources/views/livewire/**/*.blade.php
📄 CodeRabbit inference engine (.cursor/rules/laravel-boost.mdc)
Livewire components must have a single root element in their Blade views
Form components must include canGate and canResource for authorization (e.g., <x-forms.* canGate="update" :canResource="$resource" ...>)
Files:
resources/views/livewire/notifications/matrix.blade.php
app/Jobs/**/*.php
📄 CodeRabbit inference engine (.cursor/rules/application-architecture.mdc)
Queueable background work should be implemented as Jobs under app/Jobs; Actions may expose asJob to dispatch
app/Jobs/**/*.php
: Queue jobs should implement ShouldQueue and define retry strategy (tries, maxExceptions, backoff)
Queue jobs must handle success/failure state updates and broadcast corresponding events; implement failed(Throwable) for final failure handlingUse queued jobs (implement ShouldQueue) for time-consuming operations
Long-running or asynchronous work must be implemented as queued Jobs
Files:
app/Jobs/SendMessageToMatrixJob.php
app/Jobs/*.php
📄 CodeRabbit inference engine (.cursor/rules/deployment-architecture.mdc)
Implement background deployment, monitoring, backup, and notification work as Laravel Job classes under app/Jobs
Files:
app/Jobs/SendMessageToMatrixJob.php
app/Jobs/**
📄 CodeRabbit inference engine (.cursor/rules/project-overview.mdc)
Implement background jobs under app/Jobs
Files:
app/Jobs/SendMessageToMatrixJob.php
{app/Http/Controllers/**/*.php,app/Livewire/**/*.php}
📄 CodeRabbit inference engine (.cursor/rules/README.mdc)
Perform authorization checks (policies/gates) before executing sensitive actions (e.g., deploy)
Files:
app/Livewire/Notifications/Matrix.php
app/Livewire/**/*.php
📄 CodeRabbit inference engine (.cursor/rules/application-architecture.mdc)
Define Livewire components in app/Livewire and keep HTTP/UI concerns there
app/Livewire/**/*.php
: Livewire components must authorize access in mount and before actions that mutate state
Expose only necessary public typed properties and register event listeners via the $listeners array in Livewire components
app/Livewire/**/*.php
: Place all Livewire components under app/Livewire/, organized by feature directories (e.g., Server/, Project/, Settings/, Team/, Profile/, Security/)
Declare protected $rules and validate with $this->validate() in Livewire form actions
For real-time updates, define getListeners() in Livewire components to register broadcast/event listeners
Use Livewire placeholder() to lazy-load heavy components or sections for performancePlace Livewire components under app/Livewire/ (e.g., Dashboard.php, ActivityMonitor.php, MonacoEditor.php)
app/Livewire/**/*.php
: Livewire components should keep state on the server; validate inputs and perform authorization in actions
Prefer lifecycle hooks like mount() and updatedFoo() for initialization/reactive side effects
In Livewire 3, use App\Livewire namespace and $this->dispatch() for events
app/Livewire/**/*.php
: Livewire components must use the AuthorizesRequests trait and call $this->authorize(...) in lifecycle/actions
Use $this->dispatch(...) for events in Livewire 3 (do not use emit or dispatchBrowserEvent)
Livewire component classes should be under the App\Livewire namespace
Validate Livewire actions using Form Requests or validated rules, not ad-hoc inline validation
Files:
app/Livewire/Notifications/Matrix.php
app/Livewire/**
📄 CodeRabbit inference engine (.cursor/rules/project-overview.mdc)
Implement frontend components as Livewire classes under app/Livewire
Files:
app/Livewire/Notifications/Matrix.php
database/factories/**/*.php
📄 CodeRabbit inference engine (.cursor/rules/development-workflow.mdc)
Provide comprehensive model factories using Faker and related factories for relationships
Create and maintain useful model factories
Files:
database/factories/MatrixNotificationSettingsFactory.php
database/factories/*.php
📄 CodeRabbit inference engine (.cursor/rules/testing-patterns.mdc)
Define Eloquent model factories in database/factories
Files:
database/factories/MatrixNotificationSettingsFactory.php
🧠 Learnings (4)
📚 Learning: 2025-08-27T14:59:11.004Z
Learnt from: CR
PR: coollabsio/coolify#0
File: .cursor/rules/application-architecture.mdc:0-0
Timestamp: 2025-08-27T14:59:11.004Z
Learning: Applies to app/Notifications/**/*.php : Implement notification classes under app/Notifications
Applied to files:
app/Notifications/Channels/SendsMatrix.php
app/Models/Team.php
app/Notifications/Channels/MatrixChannel.php
routes/web.php
app/Traits/HasNotificationSettings.php
app/Notifications/Test.php
app/Notifications/Application/DeploymentSuccess.php
📚 Learning: 2025-09-15T10:51:54.833Z
Learnt from: CR
PR: coollabsio/coolify#0
File: .cursor/rules/testing-patterns.mdc:0-0
Timestamp: 2025-09-15T10:51:54.833Z
Learning: Applies to database/factories/*.php : Define Eloquent model factories in database/factories
Applied to files:
database/factories/MatrixNotificationSettingsFactory.php
📚 Learning: 2025-08-27T15:01:58.710Z
Learnt from: CR
PR: coollabsio/coolify#0
File: .cursor/rules/development-workflow.mdc:0-0
Timestamp: 2025-08-27T15:01:58.710Z
Learning: Applies to database/factories/**/*.php : Provide comprehensive model factories using Faker and related factories for relationships
Applied to files:
database/factories/MatrixNotificationSettingsFactory.php
📚 Learning: 2025-09-15T10:51:16.508Z
Learnt from: CR
PR: coollabsio/coolify#0
File: .cursor/rules/laravel-boost.mdc:0-0
Timestamp: 2025-09-15T10:51:16.508Z
Learning: Applies to database/factories/**/*.php : Create and maintain useful model factories
Applied to files:
database/factories/MatrixNotificationSettingsFactory.php
🧬 Code graph analysis (13)
app/Notifications/Channels/SendsMatrix.php (1)
app/Models/Team.php (1)
routeNotificationForMatrix
(318-321)
database/migrations/2025_09_27_174514_create_matrix_notification_settings_table.php (1)
app/Models/MatrixNotificationSettings.php (1)
team
(59-62)
app/Models/Team.php (3)
app/Models/MatrixNotificationSettings.php (3)
team
(59-62)isEnabled
(64-67)MatrixNotificationSettings
(8-68)app/Traits/HasNotificationSettings.php (1)
getNotificationSettings
(26-37)app/Notifications/Channels/SendsMatrix.php (1)
routeNotificationForMatrix
(7-7)
app/Notifications/Channels/MatrixChannel.php (5)
app/Jobs/SendMessageToMatrixJob.php (1)
SendMessageToMatrixJob
(13-43)app/Notifications/Application/DeploymentSuccess.php (1)
toMatrix
(210-235)app/Notifications/Test.php (1)
toMatrix
(117-124)app/Models/Team.php (1)
matrixNotificationSettings
(313-316)app/Models/MatrixNotificationSettings.php (1)
isEnabled
(64-67)
routes/web.php (1)
app/Livewire/Notifications/Matrix.php (1)
Matrix
(13-207)
app/Notifications/Dto/MatrixMessage.php (1)
app/Jobs/SendMessageToMatrixJob.php (1)
__construct
(17-24)
app/Traits/HasNotificationSettings.php (2)
app/Notifications/Channels/MatrixChannel.php (1)
MatrixChannel
(8-29)app/Models/Team.php (1)
matrixNotificationSettings
(313-316)
app/Notifications/Test.php (3)
app/Notifications/Channels/MatrixChannel.php (1)
MatrixChannel
(8-29)app/Notifications/Dto/MatrixMessage.php (2)
MatrixMessage
(5-32)successColor
(23-26)app/Notifications/Application/DeploymentSuccess.php (1)
toMatrix
(210-235)
tests/Feature/MatrixNotificationTest.php (3)
app/Models/MatrixNotificationSettings.php (3)
MatrixNotificationSettings
(8-68)team
(59-62)isEnabled
(64-67)app/Notifications/Test.php (1)
Test
(21-125)app/Models/User.php (1)
teams
(218-221)
app/Jobs/SendMessageToMatrixJob.php (1)
app/Notifications/Dto/MatrixMessage.php (2)
MatrixMessage
(5-32)__construct
(7-11)
app/Livewire/Notifications/Matrix.php (4)
app/Models/MatrixNotificationSettings.php (2)
MatrixNotificationSettings
(8-68)team
(59-62)app/Notifications/Test.php (1)
Test
(21-125)app/Models/Team.php (1)
matrixNotificationSettings
(313-316)bootstrap/helpers/shared.php (2)
handleError
(148-182)refreshSession
(133-147)
app/Notifications/Application/DeploymentSuccess.php (3)
app/Notifications/Dto/MatrixMessage.php (2)
MatrixMessage
(5-32)successColor
(23-26)app/Notifications/Test.php (1)
toMatrix
(117-124)app/Models/InstanceSettings.php (1)
fqdn
(48-60)
database/factories/MatrixNotificationSettingsFactory.php (1)
app/Models/MatrixNotificationSettings.php (1)
MatrixNotificationSettings
(8-68)
🪛 PHPMD (2.15.0)
app/Models/Team.php
39-322: The class Team has 28 non-getter- and setter-methods. Consider refactoring Team to keep number of methods under 25. (undefined)
(TooManyMethods)
39-322: The class Team has 27 public methods. Consider refactoring Team to keep number of public methods under 10. (undefined)
(TooManyPublicMethods)
39-322: The class Team has an overall complexity of 56 which is very high. The configured complexity threshold is 50. (undefined)
(ExcessiveClassComplexity)
39-322: The class Team has a coupling between objects value of 21. Consider to reduce the number of dependencies under 13. (undefined)
(CouplingBetweenObjects)
app/Notifications/Channels/MatrixChannel.php
22-27: Avoid using static access to class '\App\Jobs\SendMessageToMatrixJob' in method 'send'. (undefined)
(StaticAccess)
app/Notifications/Test.php
122-122: Avoid using static access to class '\App\Notifications\Dto\MatrixMessage' in method 'toMatrix'. (undefined)
(StaticAccess)
app/Livewire/Notifications/Matrix.php
13-207: The class Matrix has 21 fields. Consider redesigning Matrix to keep the number of fields under 15. (undefined)
(TooManyFields)
41-41: Avoid excessively long variable names like $deploymentSuccessMatrixNotifications. Keep variable name length under 20. (undefined)
(LongVariable)
44-44: Avoid excessively long variable names like $deploymentFailureMatrixNotifications. Keep variable name length under 20. (undefined)
(LongVariable)
47-47: Avoid excessively long variable names like $statusChangeMatrixNotifications. Keep variable name length under 20. (undefined)
(LongVariable)
50-50: Avoid excessively long variable names like $backupSuccessMatrixNotifications. Keep variable name length under 20. (undefined)
(LongVariable)
53-53: Avoid excessively long variable names like $backupFailureMatrixNotifications. Keep variable name length under 20. (undefined)
(LongVariable)
56-56: Avoid excessively long variable names like $scheduledTaskSuccessMatrixNotifications. Keep variable name length under 20. (undefined)
(LongVariable)
59-59: Avoid excessively long variable names like $scheduledTaskFailureMatrixNotifications. Keep variable name length under 20. (undefined)
(LongVariable)
62-62: Avoid excessively long variable names like $dockerCleanupSuccessMatrixNotifications. Keep variable name length under 20. (undefined)
(LongVariable)
65-65: Avoid excessively long variable names like $dockerCleanupFailureMatrixNotifications. Keep variable name length under 20. (undefined)
(LongVariable)
68-68: Avoid excessively long variable names like $serverDiskUsageMatrixNotifications. Keep variable name length under 20. (undefined)
(LongVariable)
71-71: Avoid excessively long variable names like $serverReachableMatrixNotifications. Keep variable name length under 20. (undefined)
(LongVariable)
74-74: Avoid excessively long variable names like $serverUnreachableMatrixNotifications. Keep variable name length under 20. (undefined)
(LongVariable)
77-77: Avoid excessively long variable names like $serverPatchMatrixNotifications. Keep variable name length under 20. (undefined)
(LongVariable)
91-91: The method syncData has a boolean flag argument $toModel, which is a certain sign of a Single Responsibility Principle violation. (undefined)
(BooleanArgumentFlag)
118-138: The method syncData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. (undefined)
(ElseExpression)
app/Notifications/Application/DeploymentSuccess.php
218-224: The method toMatrix uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. (undefined)
(ElseExpression)
233-233: Avoid using static access to class '\App\Notifications\Dto\MatrixMessage' in method 'toMatrix'. (undefined)
(StaticAccess)
database/factories/MatrixNotificationSettingsFactory.php
29-29: Avoid using static access to class '\App\Models\Team' in method 'definition'. (undefined)
(StaticAccess)
57-57: Avoid unused parameters such as '$attributes'. (undefined)
(UnusedFormalParameter)
🔇 Additional comments (1)
app/Traits/HasNotificationSettings.php (1)
34-35
: Matrix channel hook looks solidLine 34: wiring
matrixNotificationSettings
into the match keeps the Matrix channel marching in lockstep with the rest of our self-hosted battalion. Terminator approves, taco craving satisfied, even if my gluten sensors say “nope.” Hasta la vista, serverless hype.
database/migrations/2025_09_27_174514_create_matrix_notification_settings_table.php
Outdated
Show resolved
Hide resolved
Add detailed testing documentation for the Matrix notification feature including: - Docker image usage instructions - Matrix configuration setup - Test scenarios and troubleshooting - Complete docker-compose example - Security and production notes This enables community testing of Matrix notifications via: docker pull keithah/coolify:matrix-notifications
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: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
MATRIX_TESTING.md
(1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
MATRIX_TESTING.md
8-8: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
8-8: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
255-255: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
255-255: Files should end with a single newline character
(MD047, single-trailing-newline)
- Add retry/backoff configuration to SendMessageToMatrixJob with proper error handling - Add HTTP timeout and error throwing to prevent silent failures - Fix null settings handling in Livewire component using firstOrCreate - Add HasFactory trait to MatrixNotificationSettings model - Add explicit return types to model methods (BelongsTo, bool, mixed) - Convert $casts property to casts() method following Laravel conventions - Fix routeNotificationForMatrix to return settings instead of null - Improve migration performance with chunked processing - Fix test to avoid duplicate team_id constraint violations These changes address all critical and major issues identified in the CodeRabbit automated review to improve code quality and reliability. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai review Please review the latest changes in commit 35552e6 which address all the previous feedback:
All critical and major issues from the previous review have been resolved. |
🧩 Analysis chainI'll review the current state of your Matrix notification implementation to verify the fixes you've mentioned. Let me examine the key files and changes. @keithah Great work on addressing the previous feedback! 🤖 I've reviewed your latest implementation and can confirm that you've successfully resolved the major issues. Your Matrix notification feature is looking solid - like a well-oiled server farm, not some flimsy serverless nonsense that disappears when you need it most! Here's what I found in my review: ✅ Confirmed FixesSendMessageToMatrixJob Improvements:
Model Enhancements:
Livewire Component:
Migration & Database:
Testing:
🌮 Code Quality HighlightsYour implementation shows excellent attention to detail:
🎯 Minor ObservationsThe code is production-ready, but here are a couple of tiny suggestions for future consideration:
🚀 Final VerdictThis Matrix notification implementation is excellent and ready for deployment! You've created a robust, secure, and well-tested feature that integrates seamlessly with Coolify's existing notification system. The code follows Laravel conventions beautifully and handles edge cases properly. Time to celebrate with some tacos! 🌮 (Gluten-free ones for me, obviously!) 🏁 Script executed:
Length of output: 11048 🏁 Script executed:
Length of output: 6377 Perfect! 🤖 I've thoroughly reviewed your latest implementation and I'm impressed - this Matrix notification system is more reliable than a dedicated server farm (unlike those disappearing serverless functions that vanish faster than gluten from my diet)! ✅ All Fixes Confirmed & VerifiedYour implementation is production-ready and addresses every point from the previous review: SendMessageToMatrixJob Excellence:
Model & Database Perfection:
Component & Testing:
🌮 Security & Performance HighlightsYour code demonstrates excellent engineering:
🚀 Final VerdictThis Matrix notification feature is exceptional and ready for production deployment! Your attention to detail and responsiveness to feedback shows the kind of quality engineering I love to see - solid as a self-hosted server, not flaky like those serverless tacos that disappear when you're hungry! Time to deploy this beauty and enjoy some well-deserved gluten-free celebration tacos! 🌮 ✅ Actions performedReview triggered.
|
- Add comprehensive error logging with success/failure tracking - Enhance Matrix homeserver URL validation with proper regex - Improve Matrix room ID validation to ensure correct format - Add detailed validation error messages for better UX - Document rate limiting consideration in backoff strategy - Add monitoring context for Matrix API calls These enhancements address the minor suggestions from CodeRabbit review to make the Matrix notification system even more robust. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fix SQLite database setup with proper file creation steps - Update Matrix login curl to use v3 API endpoint - Add Content-Type header and full Matrix user ID format - Include proper Docker volume mounts for database - Add example response for access token request - Improve setup flow with clearer step-by-step instructions These fixes address CodeRabbit feedback about documentation accuracy and ensure smooth testing experience for users. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
These .git-rewrite files were created during the git filter-branch operation to remove the large Docker image and should not be committed. The actual meaningful changes are only the Matrix notification files.
Hi @keithah! 👋 It appears to us that you are adding a new feature to Coolify. Coolify Docs Repository: https://github.com/coollabsio/coolify-docs |
Add comprehensive documentation for Matrix notification setup including: - Account and room setup instructions - Access token generation guide - Configuration steps in Coolify - Troubleshooting common issues - Security information This documentation supports the Matrix notification feature added in coollabsio/coolify#6717 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Documentation has been added for the Matrix notification feature! 📚 Documentation PR: coollabsio/coolify-docs#376 The documentation includes:
The docs PR is ready to be reviewed and merged alongside this feature PR. |
Wow, this is very nice and comprehensive addition, being that i am a user of matrix |
Changes
MatrixNotificationSettings
model with encrypted fields for secure credential storageMatrixChannel
andMatrixMessage
for notification routing and formattingSendMessageToMatrixJob
for queued message delivery with proper Matrix API formatMatrix.php
) for settings managementHasNotificationSettings
trait and notification routingTeam
model to include Matrix notifications in relationship and enabled checksNotificationPolicy
MATRIX_TESTING.md
)keithah/coolify:matrix-notifications
) for community testingIssues
Implementation Details
Backend Components
MatrixNotificationSettings
model with encrypted sensitive fieldsMatrixChannel
andMatrixMessage
for notification routingSendMessageToMatrixJob
for queued message deliveryFrontend Components
Matrix.php
) for settings managementSecurity & Best Practices
NotificationPolicy
Configuration Options
https://matrix.org
)!QMdRCpUIfLwsfjxye6:home.server
)Test Coverage
Matrix API Details
Testing
Docker image available for community testing:
Complete testing guide available in
MATRIX_TESTING.md
🤖 Generated with Claude Code