Fix: respect backups_enabled flag in schedule runs and UI#156
Fix: respect backups_enabled flag in schedule runs and UI#156David-Crty merged 1 commit intomainfrom
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughRunSchedule and backupSchedules now filter and eagerly load only backups whose database servers have Changes
Sequence Diagram(s)sequenceDiagram
participant UI as Livewire Component\n(Configuration\Index)
participant DB as Database (BackupSchedule, Backup, DatabaseServer)
participant Queue as Job Queue\n(ProcessBackupJob)
UI->>DB: findOrFail(scheduleId)
DB-->>UI: BackupSchedule with relations
UI->>DB: whereRelation(backups, database_server.backups_enabled = true) + load backups with databaseServer
DB-->>UI: Filtered backups collection
loop per backup in filtered backups
UI->>Queue: dispatch ProcessBackupJob(backup)
Queue-->>UI: job enqueued
end
Note: colored rectangles not required for this simple flow. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #156 +/- ##
============================================
+ Coverage 91.53% 91.54% +0.01%
Complexity 1720 1720
============================================
Files 158 158
Lines 6353 6364 +11
============================================
+ Hits 5815 5826 +11
Misses 538 538 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/Livewire/Configuration/Index.php`:
- Around line 333-338: The delete check uses the raw withCount('backups') while
the UI and loaded backups use filtered queries that exclude servers with
backups_enabled = false (see BackupSchedule::withCount([...]) and ->with([...
'backups.databaseServer'])), causing schedules attached only to disabled servers
to appear deletable but still block deletion; update the deletion eligibility
logic to use the same filtered backup count (i.e., count backups with
whereRelation('databaseServer', 'backups_enabled', true) or otherwise mirror the
same query used in the withCount/with calls on BackupSchedule) so UI and delete
semantics match (alternatively, explicitly surface disabled-server attachments
in the UI if you prefer to keep raw counts).
In `@tests/Feature/ConfigurationTest.php`:
- Around line 467-480: The test currently only asserts the number of
ProcessBackupJob pushes; change it to assert the job was pushed for the enabled
server and not for the disabled one: after calling
Index::runSchedule($schedule->id), use
Queue::assertPushed(ProcessBackupJob::class, fn($job) => /* job references
$enabledServer by id or model */) to check the pushed job targets $enabledServer
(e.g., comparing $job->backup->server_id or $job->server->id to
$enabledServer->id), and add Queue::assertNotPushed(ProcessBackupJob::class,
fn($job) => /* job references $disabledServer */) to ensure no job was queued
for $disabledServer; keep references to ProcessBackupJob, $enabledServer,
$disabledServer, runSchedule and Index to locate the code.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d9d740ba-233f-46f6-aa53-3e0ab7e34fb3
📒 Files selected for processing (3)
app/Livewire/Configuration/Index.phpresources/views/livewire/database-server/index.blade.phptests/Feature/ConfigurationTest.php
📜 Review details
⏰ 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: build-app-image
- GitHub Check: ci
🧰 Additional context used
📓 Path-based instructions (11)
**/{app,tests}/**/*.php
📄 CodeRabbit inference engine (CLAUDE.md)
**/{app,tests}/**/*.php: Use Eloquent models andModel::query()before suggesting raw database queries. Avoid usingDB::. Generate code that leverages Laravel's ORM capabilities.
Never append to static properties in services/classes, as they accumulate in memory across requests (Octane issue).
Files:
tests/Feature/ConfigurationTest.phpapp/Livewire/Configuration/Index.php
**/*.php
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.php: Use constructor property promotion in__construct()with PHP 8+ syntax (e.g.,public function __construct(public GitHub $github) { }). Do not allow empty constructors with zero parameters unless private.
Always use explicit return type declarations for methods and functions. Use appropriate PHP type hints for method parameters.
Use curly braces for control structures, even for single-line bodies.
Prefer PHPDoc blocks over inline comments. Never use comments within code itself unless logic is exceptionally complex.
Add useful array shape type definitions in PHPDoc blocks when appropriate.
Files:
tests/Feature/ConfigurationTest.phpapp/Livewire/Configuration/Index.phpresources/views/livewire/database-server/index.blade.php
**/{app,routes,tests}/**/*.php
📄 CodeRabbit inference engine (CLAUDE.md)
Never use
env()function directly outside of config files. Always useconfig('app.name')instead ofenv('APP_NAME').
Files:
tests/Feature/ConfigurationTest.phpapp/Livewire/Configuration/Index.php
**/{tests,database/factories}/**/*.php
📄 CodeRabbit inference engine (CLAUDE.md)
Use factories for creating models in tests. Check if the factory has custom states before manually setting up the model.
Files:
tests/Feature/ConfigurationTest.php
**/tests/**/*.php
📄 CodeRabbit inference engine (CLAUDE.md)
Use faker methods such as
$this->faker->word()orfake()->randomDigit()in tests. Follow existing conventions whether to use$this->fakerorfake().
Files:
tests/Feature/ConfigurationTest.php
**/*.{php,js,ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Use descriptive names for variables and methods (e.g.,
isRegisteredForDiscounts, notdiscount()).
Files:
tests/Feature/ConfigurationTest.phpapp/Livewire/Configuration/Index.phpresources/views/livewire/database-server/index.blade.php
**/Livewire/**/*.php
📄 CodeRabbit inference engine (CLAUDE.md)
**/Livewire/**/*.php: Use#[Validate]attributes or Form objects for validation in Livewire components. Form objects encapsulate validation logic.
Use class-based Livewire components for all interactive pages and modal interactions. Public properties are automatically bound to views. Usewire:modelfor two-way binding.
Files:
app/Livewire/Configuration/Index.php
**/{app,routes}/**/*.php
📄 CodeRabbit inference engine (CLAUDE.md)
Use Laravel's built-in authentication and authorization features (gates, policies, Sanctum, etc.).
Files:
app/Livewire/Configuration/Index.php
**/{app,resources/views}/**/*.{php,blade.php}
📄 CodeRabbit inference engine (CLAUDE.md)
When generating links to other pages, prefer named routes and the
route()function.
Files:
app/Livewire/Configuration/Index.phpresources/views/livewire/database-server/index.blade.php
{lang/**/*.json,**/{app,resources/views}/**/*.{php,blade.php}}
📄 CodeRabbit inference engine (CLAUDE.md)
Translations use Laravel's JSON translation files with the
__('...')helper. Translations live inlang/{locale}.json. Use typographic apostrophes ('U+2019) instead of ASCII apostrophes in translation values to avoid HTML encoding artifacts.
Files:
app/Livewire/Configuration/Index.phpresources/views/livewire/database-server/index.blade.php
**/*.blade.php
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.blade.php: All Mary UI components use thex-prefix (e.g.,<x-button>,<x-input>). Use Heroicons for icons withicon="o-{name}"for outline icons andicon="s-{name}"for solid icons.
In Mary UI, use:optionsprop for selects with array format[['id' => 'value', 'name' => 'Label']]. Useclass="alert-success",class="alert-error"for alerts.
In Blade component attributes, use:attrbinding (dynamic syntax) instead of{{ }}interpolation when passing translated strings. The{{ }}syntax double-encodes special characters.
Files:
resources/views/livewire/database-server/index.blade.php
🧠 Learnings (7)
📚 Learning: 2026-03-02T13:13:34.079Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 132
File: tests/Unit/Services/Backup/DTO/BackupConfigTest.php:34-45
Timestamp: 2026-03-02T13:13:34.079Z
Learning: In tests/Unit/Services/Backup/DTO/BackupConfigTest.php and similar DTO symmetry tests, prioritize asserting execution-critical fields (database connection, compression, paths) over display-only metadata (volume.name, volume.config, database.serverName) that don't affect backup execution.
Applied to files:
tests/Feature/ConfigurationTest.phpapp/Livewire/Configuration/Index.phpresources/views/livewire/database-server/index.blade.php
📚 Learning: 2026-02-25T10:48:46.954Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 132
File: app/Services/Agent/AgentJobPayloadBuilder.php:63-76
Timestamp: 2026-02-25T10:48:46.954Z
Learning: In app/Services/Agent/AgentJobPayloadBuilder.php and similar service classes, prefer fail-fast error handling over defensive null-safe operators when upstream callers (e.g., TriggerBackupAction, RunScheduledBackups) guarantee certain relationships exist. For example, in resolveBackupPath(), $server->backup is intentionally accessed without the null-safe operator because backup existence is enforced at call sites; using the null-safe operator would hide bugs that violate this invariant.
Applied to files:
tests/Feature/ConfigurationTest.phpapp/Livewire/Configuration/Index.php
📚 Learning: 2026-02-13T11:05:37.072Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 105
File: tests/Feature/Services/Backup/Databases/SqliteDatabaseTest.php:8-11
Timestamp: 2026-02-13T11:05:37.072Z
Learning: Adopt a global afterEach hook in tests/Pest.php (or equivalent Pest bootstrap) to clean up temporary directories created during tests. Specifically handle temp dirs named with the prefixes sqlite-db-test-*, backup-task-test-*, restore-task-test-*, and volume-test-*, so individual test files don’t need their own cleanup logic. This applies to all PHP test files under the tests directory.
Applied to files:
tests/Feature/ConfigurationTest.php
📚 Learning: 2026-02-25T10:48:17.811Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 132
File: app/Console/Commands/RecoverAgentLeasesCommand.php:44-48
Timestamp: 2026-02-25T10:48:17.811Z
Learning: When reviewing PHP code, especially with foreign keys that use cascadeOnDelete and are non-nullable, assume child relations exist at runtime (the database will delete children when the parent is deleted). Do not rely on null-safe operators for these relations, as PHPStan already models them as non-null. This guideline applies broadly to PHP files that define models with foreign keys using cascade delete; verify there are no unnecessary null checks or optional chaining on such relations.
Applied to files:
tests/Feature/ConfigurationTest.phpapp/Livewire/Configuration/Index.phpresources/views/livewire/database-server/index.blade.php
📚 Learning: 2026-02-18T09:45:52.485Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 116
File: app/Livewire/DatabaseServer/ConnectionStatus.php:18-18
Timestamp: 2026-02-18T09:45:52.485Z
Learning: In Livewire components, Eloquent model properties (e.g., public DatabaseServer $server) are automatically locked by the framework to prevent client-side ID tampering. The #[Locked] attribute is only needed for scalar properties (int, string, bool, etc.) that require protection from client-side mutation. Apply this guidance to all Livewire PHP components; use #[Locked] only on primitive properties that you want to shield from client manipulation, and rely on automatic locking for Eloquent model properties.
Applied to files:
app/Livewire/Configuration/Index.php
📚 Learning: 2026-01-30T22:27:46.107Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 61
File: resources/views/livewire/volume/connectors/s3-config.blade.php:1-13
Timestamp: 2026-01-30T22:27:46.107Z
Learning: In Blade template files (any .blade.php) within the databasement project, allow using alert-info for informational content inside <x-alert> components. The guideline that permits alert-success and alert-error does not exclude using alert-info for informational purposes. Apply this consistently to all Blade components that render alerts; ensure semantic usage and accessibility.
Applied to files:
resources/views/livewire/database-server/index.blade.php
📚 Learning: 2026-02-06T10:34:43.585Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 75
File: resources/views/livewire/backup-job/_filters.blade.php:36-40
Timestamp: 2026-02-06T10:34:43.585Z
Learning: In Blade template files, when creating compact inline filter controls, prefer using native <input type="checkbox"> elements with daisyUI classes (e.g., checkbox checkbox-warning checkbox-xs) over the Mary UI <x-checkbox> component. The <x-checkbox> component adds wrapper markup (e.g., <div><fieldset><label> with gap-3) that can break tight inline flex layouts. Use the native input approach for compact inline controls, but reserve <x-checkbox> for form fields that require labels, hints, and errors.
Applied to files:
resources/views/livewire/database-server/index.blade.php
🔇 Additional comments (2)
resources/views/livewire/database-server/index.blade.php (1)
126-131: LGTM — the disabled state is now explicit.This makes the backup column distinguish “disabled” from “not configured,” which matches the new filtering semantics elsewhere in the PR.
app/Livewire/Configuration/Index.php (1)
295-305: LGTM — the schedule run now filters disabled servers at the query boundary.Loading only enabled backups here keeps
runSchedule()consistent with the command path and avoids handingTriggerBackupActionservers that should be skipped.
5967627 to
581fee1
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
tests/Feature/ConfigurationTest.php (1)
467-480:⚠️ Potential issue | 🟡 MinorAssert which server was queued, not just the queue size.
Line 480 still passes if the single queued
ProcessBackupJobhappens to target the disabled server. Tighten this to assert a push for$enabledServerand no push for$disabledServer.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Feature/ConfigurationTest.php` around lines 467 - 480, The test currently only asserts the number of queued ProcessBackupJob jobs; change it to assert that a ProcessBackupJob was pushed for $enabledServer and not pushed for $disabledServer by using Queue::assertPushed(ProcessBackupJob::class, function($job) use ($enabledServer) { ... }) to check the job's target server id matches $enabledServer->id (or its backup id) and add Queue::assertNotPushed(ProcessBackupJob::class, function($job) use ($disabledServer) { ... }) to ensure no job targets $disabledServer; update the assertions after the Livewire->call('runSchedule', $schedule->id) invocation and keep the ProcessBackupJob class and $enabledServer/$disabledServer variables as the references.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@tests/Feature/ConfigurationTest.php`:
- Around line 467-480: The test currently only asserts the number of queued
ProcessBackupJob jobs; change it to assert that a ProcessBackupJob was pushed
for $enabledServer and not pushed for $disabledServer by using
Queue::assertPushed(ProcessBackupJob::class, function($job) use ($enabledServer)
{ ... }) to check the job's target server id matches $enabledServer->id (or its
backup id) and add Queue::assertNotPushed(ProcessBackupJob::class,
function($job) use ($disabledServer) { ... }) to ensure no job targets
$disabledServer; update the assertions after the Livewire->call('runSchedule',
$schedule->id) invocation and keep the ProcessBackupJob class and
$enabledServer/$disabledServer variables as the references.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3b1b9c96-7127-489b-bbac-69979db7bd3c
📒 Files selected for processing (4)
app/Livewire/Configuration/Index.phpresources/views/livewire/configuration/index.blade.phpresources/views/livewire/database-server/index.blade.phptests/Feature/ConfigurationTest.php
🚧 Files skipped from review as they are similar to previous changes (1)
- resources/views/livewire/database-server/index.blade.php
📜 Review details
⏰ 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: build-app-image
- GitHub Check: ci
🧰 Additional context used
📓 Path-based instructions (11)
**/*.blade.php
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.blade.php: All Mary UI components use thex-prefix (e.g.,<x-button>,<x-input>). Use Heroicons for icons withicon="o-{name}"for outline icons andicon="s-{name}"for solid icons.
In Mary UI, use:optionsprop for selects with array format[['id' => 'value', 'name' => 'Label']]. Useclass="alert-success",class="alert-error"for alerts.
In Blade component attributes, use:attrbinding (dynamic syntax) instead of{{ }}interpolation when passing translated strings. The{{ }}syntax double-encodes special characters.
Files:
resources/views/livewire/configuration/index.blade.php
**/*.php
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.php: Use constructor property promotion in__construct()with PHP 8+ syntax (e.g.,public function __construct(public GitHub $github) { }). Do not allow empty constructors with zero parameters unless private.
Always use explicit return type declarations for methods and functions. Use appropriate PHP type hints for method parameters.
Use curly braces for control structures, even for single-line bodies.
Prefer PHPDoc blocks over inline comments. Never use comments within code itself unless logic is exceptionally complex.
Add useful array shape type definitions in PHPDoc blocks when appropriate.
Files:
resources/views/livewire/configuration/index.blade.phpapp/Livewire/Configuration/Index.phptests/Feature/ConfigurationTest.php
**/{app,resources/views}/**/*.{php,blade.php}
📄 CodeRabbit inference engine (CLAUDE.md)
When generating links to other pages, prefer named routes and the
route()function.
Files:
resources/views/livewire/configuration/index.blade.phpapp/Livewire/Configuration/Index.php
{lang/**/*.json,**/{app,resources/views}/**/*.{php,blade.php}}
📄 CodeRabbit inference engine (CLAUDE.md)
Translations use Laravel's JSON translation files with the
__('...')helper. Translations live inlang/{locale}.json. Use typographic apostrophes ('U+2019) instead of ASCII apostrophes in translation values to avoid HTML encoding artifacts.
Files:
resources/views/livewire/configuration/index.blade.phpapp/Livewire/Configuration/Index.php
**/*.{php,js,ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Use descriptive names for variables and methods (e.g.,
isRegisteredForDiscounts, notdiscount()).
Files:
resources/views/livewire/configuration/index.blade.phpapp/Livewire/Configuration/Index.phptests/Feature/ConfigurationTest.php
**/Livewire/**/*.php
📄 CodeRabbit inference engine (CLAUDE.md)
**/Livewire/**/*.php: Use#[Validate]attributes or Form objects for validation in Livewire components. Form objects encapsulate validation logic.
Use class-based Livewire components for all interactive pages and modal interactions. Public properties are automatically bound to views. Usewire:modelfor two-way binding.
Files:
app/Livewire/Configuration/Index.php
**/{app,tests}/**/*.php
📄 CodeRabbit inference engine (CLAUDE.md)
**/{app,tests}/**/*.php: Use Eloquent models andModel::query()before suggesting raw database queries. Avoid usingDB::. Generate code that leverages Laravel's ORM capabilities.
Never append to static properties in services/classes, as they accumulate in memory across requests (Octane issue).
Files:
app/Livewire/Configuration/Index.phptests/Feature/ConfigurationTest.php
**/{app,routes}/**/*.php
📄 CodeRabbit inference engine (CLAUDE.md)
Use Laravel's built-in authentication and authorization features (gates, policies, Sanctum, etc.).
Files:
app/Livewire/Configuration/Index.php
**/{app,routes,tests}/**/*.php
📄 CodeRabbit inference engine (CLAUDE.md)
Never use
env()function directly outside of config files. Always useconfig('app.name')instead ofenv('APP_NAME').
Files:
app/Livewire/Configuration/Index.phptests/Feature/ConfigurationTest.php
**/{tests,database/factories}/**/*.php
📄 CodeRabbit inference engine (CLAUDE.md)
Use factories for creating models in tests. Check if the factory has custom states before manually setting up the model.
Files:
tests/Feature/ConfigurationTest.php
**/tests/**/*.php
📄 CodeRabbit inference engine (CLAUDE.md)
Use faker methods such as
$this->faker->word()orfake()->randomDigit()in tests. Follow existing conventions whether to use$this->fakerorfake().
Files:
tests/Feature/ConfigurationTest.php
🧠 Learnings (7)
📚 Learning: 2026-01-30T22:27:46.107Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 61
File: resources/views/livewire/volume/connectors/s3-config.blade.php:1-13
Timestamp: 2026-01-30T22:27:46.107Z
Learning: In Blade template files (any .blade.php) within the databasement project, allow using alert-info for informational content inside <x-alert> components. The guideline that permits alert-success and alert-error does not exclude using alert-info for informational purposes. Apply this consistently to all Blade components that render alerts; ensure semantic usage and accessibility.
Applied to files:
resources/views/livewire/configuration/index.blade.php
📚 Learning: 2026-02-06T10:34:43.585Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 75
File: resources/views/livewire/backup-job/_filters.blade.php:36-40
Timestamp: 2026-02-06T10:34:43.585Z
Learning: In Blade template files, when creating compact inline filter controls, prefer using native <input type="checkbox"> elements with daisyUI classes (e.g., checkbox checkbox-warning checkbox-xs) over the Mary UI <x-checkbox> component. The <x-checkbox> component adds wrapper markup (e.g., <div><fieldset><label> with gap-3) that can break tight inline flex layouts. Use the native input approach for compact inline controls, but reserve <x-checkbox> for form fields that require labels, hints, and errors.
Applied to files:
resources/views/livewire/configuration/index.blade.php
📚 Learning: 2026-02-25T10:48:17.811Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 132
File: app/Console/Commands/RecoverAgentLeasesCommand.php:44-48
Timestamp: 2026-02-25T10:48:17.811Z
Learning: When reviewing PHP code, especially with foreign keys that use cascadeOnDelete and are non-nullable, assume child relations exist at runtime (the database will delete children when the parent is deleted). Do not rely on null-safe operators for these relations, as PHPStan already models them as non-null. This guideline applies broadly to PHP files that define models with foreign keys using cascade delete; verify there are no unnecessary null checks or optional chaining on such relations.
Applied to files:
resources/views/livewire/configuration/index.blade.phpapp/Livewire/Configuration/Index.phptests/Feature/ConfigurationTest.php
📚 Learning: 2026-03-02T13:13:34.079Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 132
File: tests/Unit/Services/Backup/DTO/BackupConfigTest.php:34-45
Timestamp: 2026-03-02T13:13:34.079Z
Learning: In tests/Unit/Services/Backup/DTO/BackupConfigTest.php and similar DTO symmetry tests, prioritize asserting execution-critical fields (database connection, compression, paths) over display-only metadata (volume.name, volume.config, database.serverName) that don't affect backup execution.
Applied to files:
app/Livewire/Configuration/Index.phptests/Feature/ConfigurationTest.php
📚 Learning: 2026-02-25T10:48:46.954Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 132
File: app/Services/Agent/AgentJobPayloadBuilder.php:63-76
Timestamp: 2026-02-25T10:48:46.954Z
Learning: In app/Services/Agent/AgentJobPayloadBuilder.php and similar service classes, prefer fail-fast error handling over defensive null-safe operators when upstream callers (e.g., TriggerBackupAction, RunScheduledBackups) guarantee certain relationships exist. For example, in resolveBackupPath(), $server->backup is intentionally accessed without the null-safe operator because backup existence is enforced at call sites; using the null-safe operator would hide bugs that violate this invariant.
Applied to files:
app/Livewire/Configuration/Index.phptests/Feature/ConfigurationTest.php
📚 Learning: 2026-02-18T09:45:52.485Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 116
File: app/Livewire/DatabaseServer/ConnectionStatus.php:18-18
Timestamp: 2026-02-18T09:45:52.485Z
Learning: In Livewire components, Eloquent model properties (e.g., public DatabaseServer $server) are automatically locked by the framework to prevent client-side ID tampering. The #[Locked] attribute is only needed for scalar properties (int, string, bool, etc.) that require protection from client-side mutation. Apply this guidance to all Livewire PHP components; use #[Locked] only on primitive properties that you want to shield from client manipulation, and rely on automatic locking for Eloquent model properties.
Applied to files:
app/Livewire/Configuration/Index.php
📚 Learning: 2026-02-13T11:05:37.072Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 105
File: tests/Feature/Services/Backup/Databases/SqliteDatabaseTest.php:8-11
Timestamp: 2026-02-13T11:05:37.072Z
Learning: Adopt a global afterEach hook in tests/Pest.php (or equivalent Pest bootstrap) to clean up temporary directories created during tests. Specifically handle temp dirs named with the prefixes sqlite-db-test-*, backup-task-test-*, restore-task-test-*, and volume-test-*, so individual test files don’t need their own cleanup logic. This applies to all PHP test files under the tests directory.
Applied to files:
tests/Feature/ConfigurationTest.php
🔇 Additional comments (3)
app/Livewire/Configuration/Index.php (2)
296-301: Enabled-only filtering inrunSchedule()looks good.This matches the scheduled-run semantics and keeps the
databaseServer.backup.volumepath eager-loaded instead of lazily resolving it inside the loop.Also applies to: 306-306
329-342: Good split between filtered and total backup counts.Keeping
backups_countfiltered while also exposingtotal_backups_countgives the view enough data to hide disabled servers without making attached schedules look deletable.resources/views/livewire/configuration/index.blade.php (1)
85-93: Usingtotal_backups_countfor delete gating is the right move.That keeps disabled assignments from appearing deletable while still letting the visible server badge stay scoped to enabled backups.
- Filter out servers with backups_enabled=false when manually running a schedule via runSchedule(), matching RunScheduledBackups command - Filter disabled servers from backup schedule server counts and popover lists on the Configuration page - Use separate total_backups_count (unfiltered) for delete eligibility so schedules attached to disabled servers still block deletion - Show a "Disabled" badge in the backup column on the database servers index when backups are disabled
581fee1 to
f52c6a1
Compare
Summary
backups_enabled = falsewhen manually running a schedule viarunSchedule(), matching the existing behavior inRunScheduledBackupscommandTest plan
Summary by CodeRabbit
Bug Fixes
New Features
Tests