Skip to content

Fix: respect backups_enabled flag in schedule runs and UI#156

Merged
David-Crty merged 1 commit intomainfrom
fix/respect-backups-enabled-flag
Mar 11, 2026
Merged

Fix: respect backups_enabled flag in schedule runs and UI#156
David-Crty merged 1 commit intomainfrom
fix/respect-backups-enabled-flag

Conversation

@David-Crty
Copy link
Owner

@David-Crty David-Crty commented Mar 11, 2026

Summary

  • Filter out servers with backups_enabled = false when manually running a schedule via runSchedule(), matching the existing behavior in RunScheduledBackups command
  • Filter disabled servers from backup schedule server counts and popover lists on the Configuration page
  • Show a "Disabled" badge in the backup column on the database servers index when backups are disabled

Test plan

  • Added test: running a schedule skips servers with backups disabled
  • All 715 existing tests pass
  • PHPStan clean

Summary by CodeRabbit

  • Bug Fixes

    • Backup scheduling now skips servers with backups disabled so jobs are only enqueued for enabled servers.
  • New Features

    • Database server view shows a "Disabled" badge when backups are not enabled.
    • Backup schedules list and actions now reflect updated backup counts for clearer in-use and delete behaviors.
  • Tests

    • Added a test to verify schedules skip servers with backups disabled.

@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

Warning

Rate limit exceeded

@David-Crty has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 55 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 265fbc8e-19a2-4a27-848e-3c204033c242

📥 Commits

Reviewing files that changed from the base of the PR and between 581fee1 and f52c6a1.

📒 Files selected for processing (4)
  • app/Livewire/Configuration/Index.php
  • resources/views/livewire/configuration/index.blade.php
  • resources/views/livewire/database-server/index.blade.php
  • tests/Feature/ConfigurationTest.php
📝 Walkthrough

Walkthrough

RunSchedule and backupSchedules now filter and eagerly load only backups whose database servers have backups_enabled = true; UI shows a Disabled badge for servers with backups disabled; a test was added to assert schedules skip disabled servers.

Changes

Cohort / File(s) Summary
Configuration Livewire
app/Livewire/Configuration/Index.php
runSchedule now loads a schedule, builds a filtered $backups collection limited to backups whose databaseServer.backups_enabled = true and iterates over it; backupSchedules() uses whereRelation('backups', ...) and eager-loads the filtered backups and their databaseServer; added use Illuminate\Database\Eloquent\Collection and changed the method return type to Collection.
Views — Database Server
resources/views/livewire/database-server/index.blade.php
Added conditional rendering: show a "Disabled" badge when backups_enabled is false; otherwise render existing backup details or dash fallback.
Views — Configuration Index
resources/views/livewire/configuration/index.blade.php
Switched UI checks from backups_count to total_backups_count for backup-related badges and in-use checks.
Tests
tests/Feature/ConfigurationTest.php
Added test that runSchedule skips servers with backups_enabled = false by asserting only enabled-server backups enqueue ProcessBackupJob.
Composer manifest
composer.json
Touched (manifest listing present in diff summary).

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
Loading

Note: colored rectangles not required for this simple flow.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 I hopped through schedules, sniffed each server by name,
Some said "no backups" — so I changed my game.
Now only the ready get the job's gentle thump,
I queue what’s allowed and give the rest a bump! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly summarizes the main objective of the changeset: respecting the backups_enabled flag in both schedule executions and the user interface.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/respect-backups-enabled-flag

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.54%. Comparing base (bdc1fc8) to head (f52c6a1).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@coderabbitai coderabbitai bot left a 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

🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between e756f1e and 5967627.

📒 Files selected for processing (3)
  • app/Livewire/Configuration/Index.php
  • resources/views/livewire/database-server/index.blade.php
  • tests/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 and Model::query() before suggesting raw database queries. Avoid using DB::. 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.php
  • app/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.php
  • app/Livewire/Configuration/Index.php
  • resources/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 use config('app.name') instead of env('APP_NAME').

Files:

  • tests/Feature/ConfigurationTest.php
  • app/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() or fake()->randomDigit() in tests. Follow existing conventions whether to use $this->faker or fake().

Files:

  • tests/Feature/ConfigurationTest.php
**/*.{php,js,ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use descriptive names for variables and methods (e.g., isRegisteredForDiscounts, not discount()).

Files:

  • tests/Feature/ConfigurationTest.php
  • app/Livewire/Configuration/Index.php
  • resources/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. Use wire:model for 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.php
  • resources/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 in lang/{locale}.json. Use typographic apostrophes (' U+2019) instead of ASCII apostrophes in translation values to avoid HTML encoding artifacts.

Files:

  • app/Livewire/Configuration/Index.php
  • resources/views/livewire/database-server/index.blade.php
**/*.blade.php

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.blade.php: All Mary UI components use the x- prefix (e.g., <x-button>, <x-input>). Use Heroicons for icons with icon="o-{name}" for outline icons and icon="s-{name}" for solid icons.
In Mary UI, use :options prop for selects with array format [['id' => 'value', 'name' => 'Label']]. Use class="alert-success", class="alert-error" for alerts.
In Blade component attributes, use :attr binding (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.php
  • app/Livewire/Configuration/Index.php
  • resources/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.php
  • 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
📚 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.php
  • app/Livewire/Configuration/Index.php
  • resources/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 handing TriggerBackupAction servers that should be skipped.

@David-Crty David-Crty force-pushed the fix/respect-backups-enabled-flag branch from 5967627 to 581fee1 Compare March 11, 2026 17:10
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
tests/Feature/ConfigurationTest.php (1)

467-480: ⚠️ Potential issue | 🟡 Minor

Assert which server was queued, not just the queue size.

Line 480 still passes if the single queued ProcessBackupJob happens to target the disabled server. Tighten this to assert a push for $enabledServer and 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

📥 Commits

Reviewing files that changed from the base of the PR and between 5967627 and 581fee1.

📒 Files selected for processing (4)
  • app/Livewire/Configuration/Index.php
  • resources/views/livewire/configuration/index.blade.php
  • resources/views/livewire/database-server/index.blade.php
  • tests/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 the x- prefix (e.g., <x-button>, <x-input>). Use Heroicons for icons with icon="o-{name}" for outline icons and icon="s-{name}" for solid icons.
In Mary UI, use :options prop for selects with array format [['id' => 'value', 'name' => 'Label']]. Use class="alert-success", class="alert-error" for alerts.
In Blade component attributes, use :attr binding (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.php
  • app/Livewire/Configuration/Index.php
  • tests/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.php
  • app/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 in lang/{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.php
  • app/Livewire/Configuration/Index.php
**/*.{php,js,ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use descriptive names for variables and methods (e.g., isRegisteredForDiscounts, not discount()).

Files:

  • resources/views/livewire/configuration/index.blade.php
  • app/Livewire/Configuration/Index.php
  • tests/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. Use wire:model for two-way binding.

Files:

  • app/Livewire/Configuration/Index.php
**/{app,tests}/**/*.php

📄 CodeRabbit inference engine (CLAUDE.md)

**/{app,tests}/**/*.php: Use Eloquent models and Model::query() before suggesting raw database queries. Avoid using DB::. 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.php
  • tests/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 use config('app.name') instead of env('APP_NAME').

Files:

  • app/Livewire/Configuration/Index.php
  • tests/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() or fake()->randomDigit() in tests. Follow existing conventions whether to use $this->faker or fake().

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.php
  • app/Livewire/Configuration/Index.php
  • tests/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.php
  • tests/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.php
  • tests/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 in runSchedule() looks good.

This matches the scheduled-run semantics and keeps the databaseServer.backup.volume path 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_count filtered while also exposing total_backups_count gives the view enough data to hide disabled servers without making attached schedules look deletable.

resources/views/livewire/configuration/index.blade.php (1)

85-93: Using total_backups_count for 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
@David-Crty David-Crty force-pushed the fix/respect-backups-enabled-flag branch from 581fee1 to f52c6a1 Compare March 11, 2026 17:22
@David-Crty David-Crty merged commit 2f3db8a into main Mar 11, 2026
6 of 7 checks passed
@David-Crty David-Crty deleted the fix/respect-backups-enabled-flag branch March 11, 2026 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant