Skip to content

Rename primary organization from "Main" to "Default"#282

Merged
David-Crty merged 1 commit into
mainfrom
refactor/rename-main-to-default-org
May 7, 2026
Merged

Rename primary organization from "Main" to "Default"#282
David-Crty merged 1 commit into
mainfrom
refactor/rename-main-to-default-org

Conversation

@David-Crty

@David-Crty David-Crty commented May 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Renames the primary organization concept from "Main" to "Default" across the entire codebase
  • is_main column → is_default, Organization::main()Organization::default(), factory state main()default()
  • "Default" better communicates the fallback/baseline role of the primary organization

Changed areas

  • Model & migrations: column rename, static helper, factory state
  • App code: policies, services, middleware, Livewire components, MCP tools
  • Tests: all references in Feature tests and Pest.php helper
  • Docs: organizations guide and SSO configuration

Test plan

  • All 954 tests pass
  • PHPStan clean
  • Lint clean

Summary by CodeRabbit

Release Notes

  • Refactor

    • Renamed "main organization" to "default organization" throughout the application for consistency and clarity. The default organization remains auto-created on first installation, cannot be edited or deleted, and serves as the fallback organization for API requests and OAuth user assignments.
  • Documentation

    • Updated multi-organization guides and SSO configuration documentation to reflect default organization terminology and behavior.

@coderabbitai

coderabbitai Bot commented May 7, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f26950c3-72ab-42c2-b767-04e57f2f69bf

📥 Commits

Reviewing files that changed from the base of the PR and between 95fb402 and 95876ee.

📒 Files selected for processing (30)
  • app/Actions/Fortify/CreateNewUser.php
  • app/Http/Middleware/DemoModeMiddleware.php
  • app/Http/Resources/OrganizationResource.php
  • app/Livewire/Configuration/Organization.php
  • app/Livewire/OrganizationSwitcher.php
  • app/Mcp/Tools/ListOrganizationsTool.php
  • app/Models/Organization.php
  • app/Policies/OrganizationPolicy.php
  • app/Services/CurrentOrganization.php
  • app/Services/OAuthService.php
  • database/factories/AgentFactory.php
  • database/factories/DatabaseServerFactory.php
  • database/factories/DatabaseServerSshConfigFactory.php
  • database/factories/OrganizationFactory.php
  • database/factories/UserFactory.php
  • database/factories/VolumeFactory.php
  • database/migrations/2026_05_07_000001_rename_main_to_default_organization.php
  • database/seeders/DatabaseSeeder.php
  • docs/docs/self-hosting/configuration/sso.md
  • docs/docs/user-guide/organizations.md
  • resources/views/livewire/configuration/organization.blade.php
  • tests/Feature/Api/OrganizationContextApiTest.php
  • tests/Feature/Auth/OAuthTest.php
  • tests/Feature/Auth/RegistrationTest.php
  • tests/Feature/Configuration/OrganizationTest.php
  • tests/Feature/Dashboard/SnapshotsCardTest.php
  • tests/Feature/DemoModeTest.php
  • tests/Feature/User/CreateTest.php
  • tests/Feature/User/EditTest.php
  • tests/Pest.php

📝 Walkthrough

Walkthrough

This PR comprehensively refactors organization terminology across the codebase, replacing all "main organization" references (is_main attribute and Organization::main() method) with "default organization" (is_default attribute and Organization::default() method). Changes span the data model, database schema migration, factories, services, authorization policies, API resources, UI components, database seeding, documentation, and test assertions.

Changes

Default Organization Terminology Refactoring

Layer / File(s) Summary
Model & Database Schema
app/Models/Organization.php, database/migrations/2026_05_07_000001_rename_main_to_default_organization.php
Organization model's is_main property, fillable attributes, Eloquent casts, and static main() accessor are all renamed to is_default and default(). Migration renames the database column and backfills organization names to "Default".
Factory Configuration
database/factories/OrganizationFactory.php, database/factories/AgentFactory.php, database/factories/DatabaseServerFactory.php, database/factories/DatabaseServerSshConfigFactory.php, database/factories/UserFactory.php, database/factories/VolumeFactory.php
Factories are updated to use is_default = false as the base definition and call Organization::factory()->default() for fallback organization assignments.
User Creation & Setup
app/Actions/Fortify/CreateNewUser.php
First user registration now ensures and attaches the new user to a default organization (created via Organization::firstOrCreate(['is_default' => true], ['name' => 'Default'])) with admin role.
Service Organization Resolution
app/Http/Middleware/DemoModeMiddleware.php, app/Services/CurrentOrganization.php, app/Services/OAuthService.php
Services now resolve to Organization::default() instead of Organization::main() for demo users, org-less super admins, and OAuth fallback scenarios.
Authorization Policies
app/Policies/OrganizationPolicy.php
Update and delete policy checks now block modifications to organizations where is_default is true, protecting the default organization from renaming or deletion.
API Resources & Tools
app/Http/Resources/OrganizationResource.php, app/Mcp/Tools/ListOrganizationsTool.php
API response structure now outputs is_default field instead of is_main. Tool labels append "Default organization" when is_default is true.
UI Components & Views
app/Livewire/Configuration/Organization.php, app/Livewire/OrganizationSwitcher.php, resources/views/livewire/configuration/organization.blade.php
Livewire components order organizations by is_default descending. Blade template uses is_default to conditionally hide edit/delete actions and display lock icon for the default organization.
Database Seeding
database/seeders/DatabaseSeeder.php
Seeder now creates a default organization and assigns the shared volume and all database servers (MySQL, PostgreSQL, SQLite, Redis, MongoDB) to the default organization.
Documentation
docs/docs/self-hosting/configuration/sso.md, docs/docs/user-guide/organizations.md
User documentation is updated to reflect that auto-created OAuth users and the first admin join the default organization by default, and that the default organization cannot be renamed or deleted.
Test Assertions & Utilities
tests/Pest.php, tests/Feature/Api/OrganizationContextApiTest.php, tests/Feature/Auth/OAuthTest.php, tests/Feature/Auth/RegistrationTest.php, tests/Feature/Configuration/OrganizationTest.php, tests/Feature/Dashboard/SnapshotsCardTest.php, tests/Feature/DemoModeTest.php, tests/Feature/User/CreateTest.php, tests/Feature/User/EditTest.php
Test utility setupOrgContext() now creates a "Default" organization with is_default=true. All test assertions across OAuth, registration, organization management, and user role verification are updated to use Organization::default().

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

The PR is a systematic refactoring with high consistency across the codebase. While the scope is large (many files and test assertions), the changes follow a predictable pattern—replacing is_main with is_default and main() with default()—reducing the cognitive load. The refactoring touches diverse layers (model, database, factories, services, policies, API, UI, seeding, docs, and tests), requiring review across multiple concerns. No functional behavior changes; this is purely a terminology update.

Possibly related PRs

  • David-Crty/databasement#275: Related multi-organization setup PR that introduced the initial main organization concept; this PR standardizes the terminology to "default organization" across the same codebases.

Poem

🐰 From Main to Default we hop along,
Renaming columns all day long,
Factories, tests, and policies too—
A consistent refactor through and through!
The default org shines so bright,
Protected and perfect, just right! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 73.91% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and concisely describes the primary change: renaming the main organization concept to 'Default' across the codebase, which aligns with the comprehensive refactoring shown in all modified files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/rename-main-to-default-org

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

codecov Bot commented May 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.62%. Comparing base (f22557a) to head (95876ee).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
app/Services/CurrentOrganization.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main     #282   +/-   ##
=========================================
  Coverage     91.62%   91.62%           
  Complexity     2328     2328           
=========================================
  Files           203      203           
  Lines          8278     8278           
=========================================
  Hits           7585     7585           
  Misses          693      693           

☔ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
app/Http/Middleware/DemoModeMiddleware.php (1)

51-54: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update stale PHPDoc terminology in ensureDemoUserExists().

The docblock still says “main org” (Line 53), but the method now attaches the demo user to the default org. Please align the comment to avoid drift.

Proposed patch
-     * Attaches to main org with demo role.
+     * Attaches to default org with demo role.
As per coding guidelines "Prefer PHPDoc blocks over inline comments. Only add inline comments for exceptionally complex logic."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/Http/Middleware/DemoModeMiddleware.php` around lines 51 - 54, Update the
PHPDoc for ensureDemoUserExists() to reflect current behavior: replace the
phrase “main org” with “default org” and ensure the docblock describes that the
demo user is attached to the default organization with the demo role; modify
only the docblock above the ensureDemoUserExists() method so it uses the updated
terminology and remains a proper PHPDoc block.
tests/Pest.php (1)

96-99: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Rename helper PHPDoc from “main” to “default” organization.

The helper now seeds is_default/Default, but the docblock still describes “main organization.” Please update it for consistency.

Proposed patch
- * Create the main organization and set it as the current org context.
+ * Create the default organization and set it as the current org context.
As per coding guidelines "Prefer PHPDoc blocks over inline comments. Only add inline comments for exceptionally complex logic."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/Pest.php` around lines 96 - 99, Update the PHPDoc above the helper that
creates the organization to call it the "default organization" instead of "main
organization" to match the seeded is_default/Default attribute; keep the rest of
the doc concise and retain the note that this ensures OrganizationScope and
CurrentOrganization work in tests so the docblock accurately reflects the
helper's behavior.
🧹 Nitpick comments (3)
app/Policies/OrganizationPolicy.php (1)

28-30: ⚡ Quick win

Update the update() docblock to “non-default orgs.”

The method behavior now uses is_default, so this wording should be aligned.

Proposed docblock tweak
-     * Super admins can rename non-main orgs.
+     * Super admins can rename non-default orgs.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/Policies/OrganizationPolicy.php` around lines 28 - 30, Update the
docblock for the OrganizationPolicy::update() method to say “non-default orgs”
instead of “non-main orgs” so the comment matches the implemented check using
is_default; locate the update() method's docblock in the OrganizationPolicy
class and replace the phrase accordingly to keep wording consistent with the
is_default logic.
app/Services/OAuthService.php (1)

133-135: ⚡ Quick win

Update stale “main org” wording in docblocks.

Behavior now resolves the default organization (Line 222), but these comments still describe “main org,” which is now outdated.

Proposed doc-only cleanup
-     * Updates role in the user's default org (main org or configured OIDC org).
+     * Updates role in the user's default org (configured org or fallback default org).
...
-     * Auto-attaches to the default org (main or OIDC-configured org).
+     * Auto-attaches to the default org (fallback or OIDC-configured org).
...
-     * Uses OAUTH_DEFAULT_ORGANIZATION_ID if set, otherwise main org.
+     * Uses OAUTH_DEFAULT_ORGANIZATION_ID if set, otherwise the default org.

Also applies to: 179-182, 207-210

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/Services/OAuthService.php` around lines 133 - 135, Update stale "main
org" wording in the docblocks in app/Services/OAuthService.php so they refer to
the resolved "default organization" terminology used by the code; find the
docblocks around the "Sync user role from OIDC claims." comment (and the other
blocks at the same section near the earlier mentions) and replace any
occurrences of "main org" with "default organization" (or similar consistent
phrasing) to match the behavior implemented in the default-organization
resolution done later in the method.
app/Actions/Fortify/CreateNewUser.php (1)

66-67: ⚡ Quick win

Line 66 comment still says “main org.”

Please rename it to “default org” to match the actual attach behavior and avoid future confusion.

Proposed comment fix
-        // Attach to main org as admin
+        // Attach to default org as admin
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/Actions/Fortify/CreateNewUser.php` around lines 66 - 67, Update the
misleading inline comment: in the CreateNewUser action, replace the comment
"main org" above the $user->organizations()->attach(...) call with "default org"
to reflect that the user is being attached to the default organization as admin
(reference: CreateNewUser::handle / the attach call using
UserRole::Admin->value).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/Mcp/Tools/ListOrganizationsTool.php`:
- Line 34: The new literal "Default organization" should be localized: update
the string concatenation in the return statement inside the
ListOrganizationsTool (the code that checks $org->is_default) to wrap that
phrase with the __('...') helper and ensure the key is added to the locale JSON
files; specifically modify the conditional that appends ' | Default
organization' so it uses __('Default organization') (preserving the surrounding
separator) and then add the translation entry to lang/{locale}.json.

In `@resources/views/livewire/configuration/organization.blade.php`:
- Line 30: Add the missing translation key "The default organization cannot be
edited or deleted." to both locale JSON files (es.json and fr.json): add the
Spanish value "La organización predeterminada no se puede editar ni eliminar."
and the French value "L'organisation par défaut ne peut pas être modifiée ou
supprimée." so the Blade template translation call resolves correctly.

---

Outside diff comments:
In `@app/Http/Middleware/DemoModeMiddleware.php`:
- Around line 51-54: Update the PHPDoc for ensureDemoUserExists() to reflect
current behavior: replace the phrase “main org” with “default org” and ensure
the docblock describes that the demo user is attached to the default
organization with the demo role; modify only the docblock above the
ensureDemoUserExists() method so it uses the updated terminology and remains a
proper PHPDoc block.

In `@tests/Pest.php`:
- Around line 96-99: Update the PHPDoc above the helper that creates the
organization to call it the "default organization" instead of "main
organization" to match the seeded is_default/Default attribute; keep the rest of
the doc concise and retain the note that this ensures OrganizationScope and
CurrentOrganization work in tests so the docblock accurately reflects the
helper's behavior.

---

Nitpick comments:
In `@app/Actions/Fortify/CreateNewUser.php`:
- Around line 66-67: Update the misleading inline comment: in the CreateNewUser
action, replace the comment "main org" above the
$user->organizations()->attach(...) call with "default org" to reflect that the
user is being attached to the default organization as admin (reference:
CreateNewUser::handle / the attach call using UserRole::Admin->value).

In `@app/Policies/OrganizationPolicy.php`:
- Around line 28-30: Update the docblock for the OrganizationPolicy::update()
method to say “non-default orgs” instead of “non-main orgs” so the comment
matches the implemented check using is_default; locate the update() method's
docblock in the OrganizationPolicy class and replace the phrase accordingly to
keep wording consistent with the is_default logic.

In `@app/Services/OAuthService.php`:
- Around line 133-135: Update stale "main org" wording in the docblocks in
app/Services/OAuthService.php so they refer to the resolved "default
organization" terminology used by the code; find the docblocks around the "Sync
user role from OIDC claims." comment (and the other blocks at the same section
near the earlier mentions) and replace any occurrences of "main org" with
"default organization" (or similar consistent phrasing) to match the behavior
implemented in the default-organization resolution done later in the method.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e0faeed5-9f4d-4b15-8806-cede5b96b990

📥 Commits

Reviewing files that changed from the base of the PR and between f22557a and 95fb402.

📒 Files selected for processing (31)
  • app/Actions/Fortify/CreateNewUser.php
  • app/Http/Middleware/DemoModeMiddleware.php
  • app/Http/Resources/OrganizationResource.php
  • app/Livewire/Configuration/Organization.php
  • app/Livewire/OrganizationSwitcher.php
  • app/Mcp/Tools/ListOrganizationsTool.php
  • app/Models/Organization.php
  • app/Policies/OrganizationPolicy.php
  • app/Services/CurrentOrganization.php
  • app/Services/OAuthService.php
  • database/factories/AgentFactory.php
  • database/factories/DatabaseServerFactory.php
  • database/factories/DatabaseServerSshConfigFactory.php
  • database/factories/OrganizationFactory.php
  • database/factories/UserFactory.php
  • database/factories/VolumeFactory.php
  • database/migrations/2026_05_05_000001_create_organizations_tables.php
  • database/migrations/2026_05_05_000002_backfill_organizations_data.php
  • database/seeders/DatabaseSeeder.php
  • docs/docs/self-hosting/configuration/sso.md
  • docs/docs/user-guide/organizations.md
  • resources/views/livewire/configuration/organization.blade.php
  • tests/Feature/Api/OrganizationContextApiTest.php
  • tests/Feature/Auth/OAuthTest.php
  • tests/Feature/Auth/RegistrationTest.php
  • tests/Feature/Configuration/OrganizationTest.php
  • tests/Feature/Dashboard/SnapshotsCardTest.php
  • tests/Feature/DemoModeTest.php
  • tests/Feature/User/CreateTest.php
  • tests/Feature/User/EditTest.php
  • tests/Pest.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). (1)
  • GitHub Check: ci
🧰 Additional context used
📓 Path-based instructions (7)
**/*.php

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.php: In PHP files, always use curly braces for control structures, even for single-line bodies.
Use PHP 8 constructor property promotion: public function __construct(public GitHub $github) { }. Do not leave empty zero-parameter __construct() methods unless the constructor is private.
Use explicit return type declarations and type hints for all method parameters in PHP: function isAccessible(User $user, ?string $path = null): bool
Prefer PHPDoc blocks over inline comments. Only add inline comments for exceptionally complex logic.
Use array shape type definitions in PHPDoc blocks for PHP.

Files:

  • app/Livewire/Configuration/Organization.php
  • tests/Feature/Auth/RegistrationTest.php
  • database/factories/UserFactory.php
  • database/factories/DatabaseServerSshConfigFactory.php
  • app/Http/Resources/OrganizationResource.php
  • app/Services/OAuthService.php
  • app/Mcp/Tools/ListOrganizationsTool.php
  • tests/Feature/DemoModeTest.php
  • database/factories/DatabaseServerFactory.php
  • app/Livewire/OrganizationSwitcher.php
  • database/factories/AgentFactory.php
  • resources/views/livewire/configuration/organization.blade.php
  • app/Http/Middleware/DemoModeMiddleware.php
  • app/Services/CurrentOrganization.php
  • database/migrations/2026_05_05_000001_create_organizations_tables.php
  • app/Policies/OrganizationPolicy.php
  • app/Actions/Fortify/CreateNewUser.php
  • database/factories/VolumeFactory.php
  • tests/Feature/User/CreateTest.php
  • database/factories/OrganizationFactory.php
  • tests/Feature/User/EditTest.php
  • tests/Pest.php
  • tests/Feature/Dashboard/SnapshotsCardTest.php
  • database/seeders/DatabaseSeeder.php
  • tests/Feature/Api/OrganizationContextApiTest.php
  • tests/Feature/Configuration/OrganizationTest.php
  • database/migrations/2026_05_05_000002_backfill_organizations_data.php
  • tests/Feature/Auth/OAuthTest.php
  • app/Models/Organization.php
app/Livewire/**/*.php

📄 CodeRabbit inference engine (CLAUDE.md)

app/Livewire/**/*.php: In Livewire components, use #[Validate] attributes or Form objects for validation. Call $this->validate() before processing data.
In Livewire components, use Session::flash() for one-time messages and show them via @if (session('success')) in Blade templates.
In Livewire components, return $this->redirect() with navigate: true for SPA-like navigation.
In Mary UI modals, add a boolean property to the component class and use wire:model in the Blade template.
Keep state server-side in Livewire components so the UI reflects it. Validate and authorize in actions as you would in HTTP requests.

Files:

  • app/Livewire/Configuration/Organization.php
  • app/Livewire/OrganizationSwitcher.php
**/*.{php,blade.php}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{php,blade.php}: Always use named routes and the route() function when generating links to other pages.
Translations should use __('...') helper function and be stored in JSON translation files in lang/{locale}.json. Keep technical terms like 'Backup', 'Restore', 'Snapshot(s)' in English across all locales.

Files:

  • app/Livewire/Configuration/Organization.php
  • tests/Feature/Auth/RegistrationTest.php
  • database/factories/UserFactory.php
  • database/factories/DatabaseServerSshConfigFactory.php
  • app/Http/Resources/OrganizationResource.php
  • app/Services/OAuthService.php
  • app/Mcp/Tools/ListOrganizationsTool.php
  • tests/Feature/DemoModeTest.php
  • database/factories/DatabaseServerFactory.php
  • app/Livewire/OrganizationSwitcher.php
  • database/factories/AgentFactory.php
  • resources/views/livewire/configuration/organization.blade.php
  • app/Http/Middleware/DemoModeMiddleware.php
  • app/Services/CurrentOrganization.php
  • database/migrations/2026_05_05_000001_create_organizations_tables.php
  • app/Policies/OrganizationPolicy.php
  • app/Actions/Fortify/CreateNewUser.php
  • database/factories/VolumeFactory.php
  • tests/Feature/User/CreateTest.php
  • database/factories/OrganizationFactory.php
  • tests/Feature/User/EditTest.php
  • tests/Pest.php
  • tests/Feature/Dashboard/SnapshotsCardTest.php
  • database/seeders/DatabaseSeeder.php
  • tests/Feature/Api/OrganizationContextApiTest.php
  • tests/Feature/Configuration/OrganizationTest.php
  • database/migrations/2026_05_05_000002_backfill_organizations_data.php
  • tests/Feature/Auth/OAuthTest.php
  • app/Models/Organization.php
tests/**/*.php

📄 CodeRabbit inference engine (CLAUDE.md)

tests/**/*.php: When creating models for tests, use factories. Check if the factory has custom states before manually setting up the model.
Use faker methods such as $this->faker->word() or fake()->randomDigit() when generating test data. Follow existing conventions on whether to use $this->faker or fake().
Create Pest tests using php artisan make:test --pest {name} without including the test suite directory. Use php artisan make:test --pest SomeFeatureTest instead of php artisan make:test --pest Feature/SomeFeatureTest.

Files:

  • tests/Feature/Auth/RegistrationTest.php
  • tests/Feature/DemoModeTest.php
  • tests/Feature/User/CreateTest.php
  • tests/Feature/User/EditTest.php
  • tests/Pest.php
  • tests/Feature/Dashboard/SnapshotsCardTest.php
  • tests/Feature/Api/OrganizationContextApiTest.php
  • tests/Feature/Configuration/OrganizationTest.php
  • tests/Feature/Auth/OAuthTest.php
**/*Resource.php

📄 CodeRabbit inference engine (CLAUDE.md)

For APIs, default to using Eloquent API Resources and API versioning unless existing API routes do not follow this pattern.

Files:

  • app/Http/Resources/OrganizationResource.php
resources/views/livewire/**/*.blade.php

📄 CodeRabbit inference engine (CLAUDE.md)

All Livewire component blade files should contain only view markup; all PHP logic must be in the component class.

Files:

  • resources/views/livewire/configuration/organization.blade.php
resources/views/**/*.blade.php

📄 CodeRabbit inference engine (CLAUDE.md)

resources/views/**/*.blade.php: All UI components in Mary UI should be prefixed with x- (e.g., <x-button>, <x-input>, <x-card>) and use Heroicons for icons (e.g., icon="o-user" for outline, icon="s-user" for solid).
In Mary UI select components, use the :options prop with array format [['id' => 'value', 'name' => 'Label']].
In Mary UI alerts, use class="alert-success", class="alert-error", etc. (not variant prop).
Use Alpine.js for client-side interactions in Livewire instead of JavaScript frameworks.
In Blade templates, use :attr binding (dynamic syntax) instead of {{ }} interpolation when passing translated strings to component attributes to avoid double-encoding special characters.

Files:

  • resources/views/livewire/configuration/organization.blade.php
🧠 Learnings (14)
📚 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/Organization.php
  • app/Livewire/OrganizationSwitcher.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:

  • app/Livewire/Configuration/Organization.php
  • tests/Feature/Auth/RegistrationTest.php
  • database/factories/UserFactory.php
  • database/factories/DatabaseServerSshConfigFactory.php
  • app/Http/Resources/OrganizationResource.php
  • app/Services/OAuthService.php
  • app/Mcp/Tools/ListOrganizationsTool.php
  • tests/Feature/DemoModeTest.php
  • database/factories/DatabaseServerFactory.php
  • app/Livewire/OrganizationSwitcher.php
  • database/factories/AgentFactory.php
  • resources/views/livewire/configuration/organization.blade.php
  • app/Http/Middleware/DemoModeMiddleware.php
  • app/Services/CurrentOrganization.php
  • database/migrations/2026_05_05_000001_create_organizations_tables.php
  • app/Policies/OrganizationPolicy.php
  • app/Actions/Fortify/CreateNewUser.php
  • database/factories/VolumeFactory.php
  • tests/Feature/User/CreateTest.php
  • database/factories/OrganizationFactory.php
  • tests/Feature/User/EditTest.php
  • tests/Pest.php
  • tests/Feature/Dashboard/SnapshotsCardTest.php
  • database/seeders/DatabaseSeeder.php
  • tests/Feature/Api/OrganizationContextApiTest.php
  • tests/Feature/Configuration/OrganizationTest.php
  • database/migrations/2026_05_05_000002_backfill_organizations_data.php
  • tests/Feature/Auth/OAuthTest.php
  • app/Models/Organization.php
📚 Learning: 2026-05-06T10:46:47.009Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 275
File: app/Models/User.php:188-216
Timestamp: 2026-05-06T10:46:47.009Z
Learning: In app/Models/User.php, the $cachedRoles cache is intentionally request-scoped to prevent N+1 queries during rendering. Pivot writes (attach() in app/Livewire/User/Create.php, updateExistingPivot() in app/Livewire/Forms/UserForm.php) are terminal within a request, and the cache is not read after a write in the same request. Do not flag missing cache invalidation after pivot writes as a bug; this design is intentional. When reviewing related changes in PHP files under app/, assume this cache pattern and do not raise invalidation issues for these flows.

Applied to files:

  • app/Livewire/Configuration/Organization.php
  • app/Http/Resources/OrganizationResource.php
  • app/Services/OAuthService.php
  • app/Mcp/Tools/ListOrganizationsTool.php
  • app/Livewire/OrganizationSwitcher.php
  • app/Http/Middleware/DemoModeMiddleware.php
  • app/Services/CurrentOrganization.php
  • app/Policies/OrganizationPolicy.php
  • app/Actions/Fortify/CreateNewUser.php
  • app/Models/Organization.php
📚 Learning: 2026-05-07T18:49:56.777Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 275
File: app/Services/Backup/SnapshotVerificationService.php:38-41
Timestamp: 2026-05-07T18:49:56.777Z
Learning: In Laravel code analyzed with Larastan/PHPStan, when you write Eloquent relationship/query callbacks such as those passed to `whereHas`, `whereRelation`, etc. (e.g., `function ($sq) use (...) { ... }`), leave the closure parameters untyped. Avoid adding explicit type hints like `Builder $sq` or `Builder<Model>`, because Larastan’s Laravel-specific stubs typically rely on its own inferred/generic types and explicit hints can cause PHPStan/Larastan generic type-mismatch errors. Larastan should consider these closures correctly without explicit parameter type annotations.

Applied to files:

  • app/Livewire/Configuration/Organization.php
  • app/Http/Resources/OrganizationResource.php
  • app/Services/OAuthService.php
  • app/Mcp/Tools/ListOrganizationsTool.php
  • app/Livewire/OrganizationSwitcher.php
  • app/Http/Middleware/DemoModeMiddleware.php
  • app/Services/CurrentOrganization.php
  • app/Policies/OrganizationPolicy.php
  • app/Actions/Fortify/CreateNewUser.php
  • app/Models/Organization.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/Auth/RegistrationTest.php
  • tests/Feature/DemoModeTest.php
  • tests/Feature/User/CreateTest.php
  • tests/Feature/User/EditTest.php
  • tests/Pest.php
  • tests/Feature/Dashboard/SnapshotsCardTest.php
  • tests/Feature/Api/OrganizationContextApiTest.php
  • tests/Feature/Configuration/OrganizationTest.php
  • tests/Feature/Auth/OAuthTest.php
📚 Learning: 2026-04-09T13:59:25.873Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 205
File: tests/Feature/ConfigurationTest.php:165-176
Timestamp: 2026-04-09T13:59:25.873Z
Learning: In this repository, `Notification::fake()` is already performed globally in the base test class (`tests/TestCase.php`) within `setUp()` before each test. When reviewing individual test files under `tests/`, do not flag missing `Notification::fake()` calls, since they are handled by the shared base test setup.

Applied to files:

  • tests/Feature/Auth/RegistrationTest.php
  • tests/Feature/DemoModeTest.php
  • tests/Feature/User/CreateTest.php
  • tests/Feature/User/EditTest.php
  • tests/Pest.php
  • tests/Feature/Dashboard/SnapshotsCardTest.php
  • tests/Feature/Api/OrganizationContextApiTest.php
  • tests/Feature/Configuration/OrganizationTest.php
  • tests/Feature/Auth/OAuthTest.php
📚 Learning: 2026-05-05T23:16:24.464Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 275
File: app/Services/CurrentOrganization.php:28-39
Timestamp: 2026-05-05T23:16:24.464Z
Learning: Enforce non-nullable return types for id(): string and model(): Organization in PHP service classes under app/Services. Ensure SetCurrentOrganization middleware always resolves an Organization in the web context before these methods are reached; do not reintroduce isResolved guards in callers. A null dereference due to a broken middleware chain is the intended failure signal, not silent null propagation. Document the contract in class docblocks and consider tests to verify the middleware guarantees.

Applied to files:

  • app/Services/OAuthService.php
  • app/Services/CurrentOrganization.php
📚 Learning: 2026-05-07T18:48:26.765Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 275
File: app/Mcp/Tools/ListOrganizationsTool.php:19-22
Timestamp: 2026-05-07T18:48:26.765Z
Learning: When reviewing MCP tools in app/Mcp/Tools/, do not require null guards for `$request->user()` or calls like `app(CurrentOrganization::class)` if the tool is only reachable via the MCP web transport (`Mcp::web()` in routes/ai.php) because that transport is protected by `auth:sanctum` and `SetCurrentOrganization` middleware, which guarantees an authenticated user and that `CurrentOrganization` is resolved before any tool `handle()` runs. Keep null-guard expectations for user/organization access only if the tool can be invoked outside that middleware-guaranteed web path (e.g., via STDIO/local transport).

Applied to files:

  • app/Mcp/Tools/ListOrganizationsTool.php
📚 Learning: 2026-02-01T11:14:33.775Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 64
File: docs/docs/self-hosting/configuration/application.md:186-189
Timestamp: 2026-02-01T11:14:33.775Z
Learning: In self-hosting documentation, prefer generic 'php artisan' command examples over Docker-specific commands to ensure guidance remains valid for users deploying via Docker, Kubernetes, native installations, or other methods. Apply this consistently across all files under docs/docs/self-hosting. If a Docker-specific command is necessary for illustration, provide a non-Docker alternative or clearly note the context and include an equivalent generic command.

Applied to files:

  • docs/docs/self-hosting/configuration/sso.md
📚 Learning: 2026-02-01T11:14:56.749Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 64
File: docs/docs/self-hosting/configuration/backup.md:141-144
Timestamp: 2026-02-01T11:14:56.749Z
Learning: In self-hosting documentation (docs/docs/self-hosting), prefer showing plain php artisan commands. Do not assume deployment environment. The Docker command (docker compose exec --user application -T app) is only relevant for local development and should not be included in deployment documentation.

Applied to files:

  • docs/docs/self-hosting/configuration/sso.md
📚 Learning: 2026-03-28T22:33:16.333Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 195
File: app/Notifications/CLAUDE.md:7-12
Timestamp: 2026-03-28T22:33:16.333Z
Learning: In this repository (David-Crty/databasement), do not flag fenced Markdown code blocks that omit a language identifier (i.e., MD040: missing language after ```). The project treats unlabeled fenced code blocks as plain text by default, so missing language tags are acceptable for Markdown files.

Applied to files:

  • docs/docs/self-hosting/configuration/sso.md
  • docs/docs/user-guide/organizations.md
📚 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/organization.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/organization.blade.php
📚 Learning: 2026-04-10T08:46:55.182Z
Learnt from: David-Crty
Repo: David-Crty/databasement PR: 205
File: database/migrations/2026_04_09_000001_add_notification_channels.php:143-156
Timestamp: 2026-04-10T08:46:55.182Z
Learning: In David-Crty/databasement, treat Laravel migrations as forward-only for production. For migrations in database/migrations/*.php, it is acceptable to delete or transform legacy data in the migration’s up() (e.g., removing app_configs rows) without restoring it in down(), even if down() cannot fully reverse the state. During code review, do not flag missing rollback restoration of migrated/deleted data as a production risk for this repo’s migrations.

Applied to files:

  • database/migrations/2026_05_05_000001_create_organizations_tables.php
  • database/migrations/2026_05_05_000002_backfill_organizations_data.php
🔇 Additional comments (16)
app/Services/CurrentOrganization.php (1)

118-123: LGTM — super-admin fallback correctly swapped to Organization::default().

app/Livewire/OrganizationSwitcher.php (1)

42-45: LGTM — both ordering clauses (is_default) are consistent with the model rename.

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

24-47: LGTMis_default guards are consistent in both the name-cell and the actions-cell scope.

tests/Feature/DemoModeTest.php (1)

216-247: LGTMOrganization::default() references in both assertions are correct and consistent with the PR-wide rename.

database/factories/UserFactory.php (1)

72-72: LGTMrescue() fallback correctly updated to Organization::factory()->default()->create().

database/factories/DatabaseServerSshConfigFactory.php (1)

28-28: LGTM — factory fallback correctly updated to ->default().

docs/docs/self-hosting/configuration/sso.md (1)

143-143: LGTM — documentation prose correctly updated to "default organization."

database/factories/AgentFactory.php (1)

22-22: LGTM — factory fallback correctly updated to ->default(), consistent with other factories in this PR.

tests/Feature/User/EditTest.php (1)

81-82: Assertions are aligned with the new default-organization semantics.

These updates look consistent and correct.

Also applies to: 110-111, 124-125

app/Http/Resources/OrganizationResource.php (1)

24-25: Resource field rename is correctly applied.

is_default exposure in the API resource looks good.

database/seeders/DatabaseSeeder.php (1)

20-24: Seeder migration to default organization is consistent.

All touched assignments correctly reference the default organization.

Also applies to: 47-48, 63-64, 74-75, 88-89, 99-100, 111-112

app/Services/OAuthService.php (1)

222-223: Fallback switch to Organization::default() looks correct.

No functional concerns in the changed return path.

database/factories/DatabaseServerFactory.php (1)

36-37: Factory fallback rename is consistent with the new org semantics.

This change looks good.

tests/Feature/User/CreateTest.php (1)

53-54: Role assertions correctly target the default organization now.

These updates are consistent and safe.

Also applies to: 103-104

app/Actions/Fortify/CreateNewUser.php (1)

51-55: Default-org creation and attachment flow looks correct.

No functional issues in the changed logic.

Also applies to: 67-68

app/Policies/OrganizationPolicy.php (1)

37-39: Policy checks are correctly migrated to is_default.

Authorization logic in the changed lines looks good.

Also applies to: 43-52

$role = $org->pivot->role ?? 'unknown';

return "- **{$org->name}** (ID: {$org->id}){$active}\n Role: {$role}".($org->is_main ? ' | Main organization' : '');
return "- **{$org->name}** (ID: {$org->id}){$active}\n Role: {$role}".($org->is_default ? ' | Default organization' : '');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Localize the new “Default organization” label.

Line 34 introduces a new user-facing literal. Please wrap it with __() to match the repo’s translation rule.

Proposed fix
-            return "- **{$org->name}** (ID: {$org->id}){$active}\n  Role: {$role}".($org->is_default ? ' | Default organization' : '');
+            return "- **{$org->name}** (ID: {$org->id}){$active}\n  Role: {$role}".($org->is_default ? ' | '.__('Default organization') : '');

As per coding guidelines: "Translations should use __('...') helper function and be stored in JSON translation files in lang/{locale}.json."

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return "- **{$org->name}** (ID: {$org->id}){$active}\n Role: {$role}".($org->is_default ? ' | Default organization' : '');
return "- **{$org->name}** (ID: {$org->id}){$active}\n Role: {$role}".($org->is_default ? ' | '.__('Default organization') : '');
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/Mcp/Tools/ListOrganizationsTool.php` at line 34, The new literal "Default
organization" should be localized: update the string concatenation in the return
statement inside the ListOrganizationsTool (the code that checks
$org->is_default) to wrap that phrase with the __('...') helper and ensure the
key is added to the locale JSON files; specifically modify the conditional that
appends ' | Default organization' so it uses __('Default organization')
(preserving the surrounding separator) and then add the translation entry to
lang/{locale}.json.

</x-slot:trigger>
<x-slot:content>
{{ __('The main organization cannot be edited or deleted.') }}
{{ __('The default organization cannot be edited or deleted.') }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check for any locale JSON files and whether old/new keys are present

echo "=== Locale JSON files ==="
fd --extension json . lang/

echo ""
echo "=== Old key occurrences (should be 0 after update) ==="
rg -rn "main organization cannot be edited" lang/ || echo "Not found"

echo ""
echo "=== New key occurrences (should match locale count) ==="
rg -rn "default organization cannot be edited" lang/ || echo "Not found"

Repository: David-Crty/databasement

Length of output: 252


🏁 Script executed:

cat -n lang/es.json lang/fr.json

Repository: David-Crty/databasement

Length of output: 50380


🏁 Script executed:

rg -i "organization" lang/es.json lang/fr.json

Repository: David-Crty/databasement

Length of output: 49


🏁 Script executed:

# Search for organization in the codebase
echo "=== Files containing 'organization' ==="
rg -l "organization" --type-list

# Check the Blade file itself
echo ""
echo "=== Organization Blade file content around line 30 ==="
cat -n resources/views/livewire/configuration/organization.blade.php | sed -n '20,40p'

# Check if there are any en.json files
echo ""
echo "=== English locale files ==="
fd --extension json . lang/

Repository: David-Crty/databasement

Length of output: 1667


🏁 Script executed:

# Search for en.json specifically
echo "=== Checking for en.json ==="
find . -name "en.json" -o -name "en*.json" 2>/dev/null | head -20

# Check what locale files actually exist
echo ""
echo "=== All JSON files in lang directory ==="
ls -la lang/

# Search the entire codebase for the translation strings
echo ""
echo "=== Searching for 'default organization' in entire codebase ==="
rg "default organization" --type php --type blade -i

# Also search for 'main organization' (the old key)
echo ""
echo "=== Searching for 'main organization' in entire codebase ==="
rg "main organization" --type php --type blade -i

Repository: David-Crty/databasement

Length of output: 578


🏁 Script executed:

# Search for the translation strings more broadly
echo "=== Searching for 'default organization' ==="
rg "default organization" -i

# Search for 'main organization' 
echo ""
echo "=== Searching for 'main organization' ==="
rg "main organization" -i

# Check the git history to see what the old translation key was
echo ""
echo "=== Recent git commits affecting organization.blade.php ==="
git log --oneline -20 resources/views/livewire/configuration/organization.blade.php 2>/dev/null || echo "Git history not available"

# Check if there's a translation file generation or default locale config
echo ""
echo "=== Laravel config files for translations ==="
find . -name "*.php" -path "*/config/*" | grep -i locale

# Check app config
echo ""
echo "=== Checking app/App locale config ==="
rg "default.*locale" config/ -i 2>/dev/null || echo "Not found in config"

Repository: David-Crty/databasement

Length of output: 3941


🏁 Script executed:

# Check Laravel locale configuration and fallback strategy
echo "=== Checking config/app.php for locale settings ==="
cat -n config/app.php | grep -A5 -B5 "locale"

# Check if there's a fallback_locale setting
echo ""
echo "=== Check for fallback locale configuration ==="
rg "fallback" config/ -i

# Let's see the actual locale registration in the app
echo ""
echo "=== Checking service providers for locale setup ==="
rg "setlocale\|App::setlocale\|locale" app/Providers/ -i

# Check what locales the application supports
echo ""
echo "=== Application supported locales ==="
rg "en\|es\|fr" config/app.php

Repository: David-Crty/databasement

Length of output: 1408


🏁 Script executed:

# Let's check the git diff to see what changed in this file
echo "=== Git diff for the organization.blade.php change ==="
git show 95fb402:resources/views/livewire/configuration/organization.blade.php | grep -A5 -B5 "organization cannot" || echo "File not in that commit or pattern not found"

# Check git diff to see the actual change
echo ""
echo "=== Git diff showing the change ==="
git diff HEAD~1 HEAD -- resources/views/livewire/configuration/organization.blade.php 2>/dev/null | grep -A3 -B3 "organization" || echo "No recent changes or git unavailable"

# Check the most recent change to lang files
echo ""
echo "=== Recent git commits affecting lang files ==="
git log --oneline -20 -- lang/ 2>/dev/null || echo "No changes to lang files in recent history"

Repository: David-Crty/databasement

Length of output: 860


🏁 Script executed:

# Check what was changed in the commit that renamed "Main" to "Default"
echo "=== Files changed in commit 95fb402 ==="
git show 95fb402 --stat | head -30

# Check specifically if lang files were modified
echo ""
echo "=== Changes to lang files in commit 95fb402 ==="
git show 95fb402 -- lang/ | head -100 || echo "No lang file changes in this commit"

# Check if the old key exists in the lang files
echo ""
echo "=== Searching for 'The main organization' in lang files ==="
rg "The main organization" lang/

# Let's also verify what the fallback behavior means - English files should exist
echo ""
echo "=== Check if English translations are inline or in separate files ==="
grep -r "The default organization" . --include="*.php" --include="*.blade.php" 2>/dev/null | head -5

Repository: David-Crty/databasement

Length of output: 9642


🏁 Script executed:

# Let's verify the translation key is actually missing from the Spanish and French files
echo "=== Exact search for the translation key in lang files ==="
grep -n "The default organization cannot be edited or deleted" lang/*.json || echo "Key not found in any locale file"

# Also check with single quotes
echo ""
echo "=== Search with escaped quotes ==="
rg "default organization cannot be edited" lang/

# Let's look at one more thing - the actual structure of lang files to see if this key should be there
echo ""
echo "=== Sample of es.json structure (first 50 lines with organization context) ==="
head -50 lang/es.json | tail -30

Repository: David-Crty/databasement

Length of output: 2275


Add the missing translation key to locale files.

The translation key 'The default organization cannot be edited or deleted.' was added to the Blade template but is missing from lang/es.json and lang/fr.json. Non-English users will see the raw English string instead of their localized translation.

Add this key-value pair to both locale files:

"The default organization cannot be edited or deleted.": "La organización predeterminada no se puede editar ni eliminar."

(For French, provide the appropriate translation in lang/fr.json.)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@resources/views/livewire/configuration/organization.blade.php` at line 30,
Add the missing translation key "The default organization cannot be edited or
deleted." to both locale JSON files (es.json and fr.json): add the Spanish value
"La organización predeterminada no se puede editar ni eliminar." and the French
value "L'organisation par défaut ne peut pas être modifiée ou supprimée." so the
Blade template translation call resolves correctly.

"Default" better communicates the role of the primary organization —
it is the fallback context, not necessarily the most important one.

Renames: is_main → is_default column, Organization::main() → Organization::default(),
factory state main() → default(), and all references in app code, migrations,
factories, seeders, tests, and docs.
@David-Crty David-Crty force-pushed the refactor/rename-main-to-default-org branch from 95fb402 to 95876ee Compare May 7, 2026 21:17
@David-Crty David-Crty merged commit 280ed0d into main May 7, 2026
1 of 2 checks passed
@David-Crty David-Crty deleted the refactor/rename-main-to-default-org branch May 7, 2026 21:21
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