## Summary - consolidate internal platform naming from `Tenant` to `Environment` / `ManagedEnvironment` across models, controllers, services, and Filament resources - rename environment-scoped UI surfaces such as dashboards, chooser flows, navigation, and related widgets to match the updated environment-first domain language - align middleware, onboarding/review lifecycle services, jobs, and route/context controllers with the new environment-scoped architecture ## Validation - not rerun as part of this commit/push/PR request ## Notes - branch is 1 commit ahead of `platform-dev` - main commit: `refactor: consolidate internal tenant model naming` Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #355
12 KiB
Tenant Reference Inventory
Feature: Spec 300 Internal Tenant Model Naming Consolidation
Created: 2026-05-13
Status: Preparation baseline; implementation must refresh and expand this to file-level close-out classification before runtime edits.
Preparation Baseline
Commands run during preparation:
git status --short --branch
git diff --stat
git log -1 --oneline
cd apps/platform
./vendor/bin/sail artisan route:list | rg "admin/t|admin/tenants|workspaces/.*/environments|provider-connections|required-permissions|operations"
Observed during preparation:
- Starting branch before Spec Kit script:
platform-dev - Feature branch after Spec Kit script:
300-internal-tenant-model-naming-consolidation - Starting commit:
b98bafcf feat: finalize managed environment cutover seal (#354) ManagedEnvironmentmodel exists.ManagedEnvironmentFactoryexists.managed_environmentstable exists.- No active
App\Models\Tenantmodel was found in the model list orapps/platform/app/Models. - No
admin/toradmin/tenantsroutes were found through Laravel Boost route lookup. - Sail route scan found canonical
/admin/workspaces/{workspace}/environments/...routes but route parameters and route names still use{tenant}in many route definitions.
Preparation scan counts:
| Scan | Count | Notes |
|---|---|---|
| Broad tenant scan | 2323 | Active code/tests/config/migrations still contain substantial tenant vocabulary. |
| Provider-specific scan | 1661 | Many hits are likely legitimate provider/Graph/Entra tenant terms. |
| Migration/schema scan | 851 | Table/column/index/constraint and historical migration naming need careful classification. |
| Legacy route/helper/resource scan | 242 | Route/helper/resource names remain a focused cleanup area. |
Classification Rules
| Category | Meaning | Action |
|---|---|---|
platform-managed-environment |
Internal platform object currently named Tenant but semantically Managed Environment | Rename |
provider-specific |
Microsoft/Entra/Azure/Graph/external tenant concept | Keep |
framework-required |
Filament/Laravel/package tenant API | Keep and document |
historical |
Old specs/docs/changelogs/migration history where not active runtime truth | Keep unless active docs require update |
regression-guard |
Negative tests or regexes preventing legacy reintroduction | Keep |
test-fixture-stale |
Old test naming not tied to provider/framework/guard | Rename |
blocked/unclear |
Ambiguous meaning | Inspect manually before changing |
Initial Inventory Summary
| Pattern | Representative File(s) | Category | Action | Fixed? |
|---|---|---|---|---|
TenantResource, TenantDashboard, TenantDiagnostics, TenantRequiredPermissions |
apps/platform/app/Filament/Resources/TenantResource.php, apps/platform/app/Filament/Pages/TenantDashboard.php, apps/platform/app/Filament/Pages/TenantDiagnostics.php, apps/platform/app/Filament/Pages/TenantRequiredPermissions.php |
platform-managed-environment |
Rename active Filament technical owners | No - prep only |
{tenant} route parameter under /admin/workspaces/{workspace}/environments/... |
apps/platform/routes/web.php |
platform-managed-environment |
Rename parameter where feasible to {environment} while preserving URL segment |
No - prep only |
managed_environments with tenant-named migration/index files |
apps/platform/database/migrations/2025_12_10_000100_create_tenants_table.php, apps/platform/database/migrations/*_tenants_* |
platform-managed-environment or historical |
Rename active schema names where safe; classify historical migration names | No - prep only |
tenant_permissions, tenant_role_mappings, tenant_settings, tenant_reviews, tenant_review_sections, tenant_triage_reviews |
apps/platform/app/Models/TenantPermission.php, apps/platform/app/Models/TenantReview.php, related migrations |
platform-managed-environment pending file-level review |
Rename if they point to Managed Environment product truth | No - prep only |
TenantMembershipManager, TenantDiagnosticsService, TenantRequiredPermissionsViewModelBuilder |
apps/platform/app/Services/Auth/TenantMembershipManager.php, apps/platform/app/Services/Auth/TenantDiagnosticsService.php, apps/platform/app/Services/Intune/TenantRequiredPermissionsViewModelBuilder.php |
mixed: platform-managed-environment and possible provider-specific |
Classify by method/field before rename | No - prep only |
setTenantPanelContext, panel: 'tenant', panel: "tenant" |
Guard/test scan returned matches | test-fixture-stale or regression-guard |
Remove stale helpers; keep negative guard literals only | No - prep only |
Filament::getTenant(), Filament::setTenant(), tenancy contracts |
Filament framework usages in app/resources/views/tests | framework-required |
Keep and document | No - prep only |
tenantId, entra_tenant_id, microsoft_tenant_id, Microsoft tenant ID |
Provider connections, Graph services, onboarding, verification, target scope | provider-specific |
Keep and document | No - prep only |
| Historical completed specs 297-299 tenant references | specs/297-*, specs/298-*, specs/299-* |
historical / regression-guard |
Do not rewrite completed specs | N/A |
Required Close-Out State
Before Spec 300 can be reported merge-ready, this inventory must be replaced or extended with file-level rows for all remaining active tenant references and each row must have:
- Pattern/reference
- File
- Category
- Action taken
- Fixed? status
- Why allowed if not renamed
No blocked/unclear or unclassified active platform-owned reference may remain at close-out.
Implementation Loop Slice - 2026-05-13
This implementation loop completed a bounded Filament/page/widget/route-owner slice and stopped before the schema/model/table phase. The stop condition is blocked by unresolved platform-owned tenant references: remaining database and domain families are too broad to safely rename as a follow-on to the UI route-owner rename without a separate focused pass and migration plan.
Validation scan counts after the slice:
| Scan | Count | Outcome |
|---|---|---|
Broad active tenant file scan |
1559 files | Not clean; includes provider/framework terms plus unresolved platform-owned schema/model/test families. |
| Tenant schema/model family scan | 230 files | Not clean; active TenantReview, TenantPermission, TenantOnboardingSession, TenantTriageReview, tenant-named factories, migrations, resources, and tests remain. |
| Old Filament owner scan | 2 files | Clean for active runtime; remaining hits are regression guard literals and action-surface reference notes only. |
Completed runtime rename summary:
| Pattern | Representative File(s) | Category | Action | Fixed? |
|---|---|---|---|---|
TenantResource |
apps/platform/app/Filament/Resources/ManagedEnvironmentResource.php |
platform-managed-environment |
Renamed resource class and references to ManagedEnvironmentResource |
Yes |
TenantResource nested pages |
apps/platform/app/Filament/Resources/ManagedEnvironmentResource/Pages/* |
platform-managed-environment |
Renamed ListTenants, ViewTenant, EditTenant, ManageTenantMemberships to environment-first page owners |
Yes |
TenantMembershipsRelationManager |
apps/platform/app/Filament/Resources/ManagedEnvironmentResource/RelationManagers/ManagedEnvironmentMembershipsRelationManager.php |
platform-managed-environment |
Renamed relation manager | Yes |
TenantDashboard, TenantDiagnostics, TenantRequiredPermissions |
apps/platform/app/Filament/Pages/EnvironmentDashboard.php, EnvironmentDiagnostics.php, EnvironmentRequiredPermissions.php |
platform-managed-environment |
Renamed page owners and Blade page views | Yes |
Widgets/Tenant environment widgets |
apps/platform/app/Filament/Widgets/ManagedEnvironment/* |
platform-managed-environment |
Moved widget namespace and renamed tenant-prefixed widget classes | Yes |
{tenant} on canonical environment routes |
apps/platform/routes/web.php, apps/platform/app/Filament/Concerns/WorkspaceScopedTenantRoutes.php |
platform-managed-environment |
Renamed route parameter to {environment} for canonical workspace environment routes while preserving URL segments |
Yes |
TenantMembershipManager, TenantDiagnosticsService, TenantRequiredPermissionsViewModelBuilder |
apps/platform/app/Services/Auth/*, apps/platform/app/Services/Intune/* |
platform-managed-environment |
Renamed first service-owner slice | Yes |
Remaining unresolved platform-owned references:
| Pattern/reference | Representative file(s) | Category | Action needed | Fixed? |
|---|---|---|---|---|
TenantReview, TenantReviewResource, tenant_reviews, tenant_review_sections |
apps/platform/app/Filament/Resources/TenantReviewResource.php, apps/platform/app/Models/TenantReview.php, review tests/factories/migrations |
platform-managed-environment pending review |
Requires dedicated review/evidence/customer-review rename plan and migrations | No |
TenantPermission, tenant_permissions |
apps/platform/app/Models/TenantPermission.php, required-permissions tests/factories/migrations |
platform-managed-environment pending review |
Requires schema/model/resource/support rename with provider permission terminology preserved | No |
TenantOnboardingSession, managed_tenant_onboarding_sessions |
apps/platform/app/Models/TenantOnboardingSession.php, onboarding routes/services/tests |
platform-managed-environment pending review |
Requires onboarding-session rename and route/controller/service updates | No |
TenantTriageReview, tenant_triage_reviews |
portfolio triage models/support/tests | platform-managed-environment pending review |
Requires portfolio triage domain rename | No |
tenantId variables/named args using Managed Environment primary keys |
jobs, resources, support helpers, tests | mixed | Classify provider target-scope tenant IDs vs platform Managed Environment IDs before rename | No |
| Stale test file names and historical helper names | apps/platform/tests/Feature/Filament/Tenant*, tests/Browser/Tenant* |
test-fixture-stale |
Rename in a separate broad test-file pass after schema/domain names settle | Partial |
Commands run and outcomes:
| Command | Outcome |
|---|---|
./vendor/bin/sail artisan route:list | rg "admin/t|admin/tenants|workspaces/.*/environments|provider-connections|required-permissions|operations" |
Passed; canonical environment routes use {environment} and no active /admin/t or /admin/tenants route appeared. |
./vendor/bin/sail composer dump-autoload |
Passed; emitted pre-existing PSR-4 warnings for test helper classes and ran Filament asset publish hook without tracked public asset changes. |
./vendor/bin/sail artisan test --compact tests/Feature/Guards |
Passed: 266 tests, 4707 assertions. |
./vendor/bin/sail artisan test --compact tests/Feature/Workspaces tests/Feature/ProviderConnections |
Passed: 174 tests, 864 assertions. |
./vendor/bin/sail artisan test --compact tests/Feature/RequiredPermissions ... access-scope tests |
Passed: 49 tests, 203 assertions. |
./vendor/bin/sail artisan test --compact tests/Feature/Filament |
Passed: 773 tests, 5017 assertions, 5 skipped. |
./vendor/bin/sail artisan test --compact tests/Feature/Rbac |
Passed: 156 tests, 744 assertions. |
./vendor/bin/sail artisan test --compact tests/Browser/Spec281ProviderConnectionScopeSmokeTest.php tests/Browser/Spec285WorkspaceRbacEnvironmentAccessSmokeTest.php tests/Browser/Spec299WorkspaceOverviewCutoverSealSmokeTest.php |
Passed: 3 tests, 38 assertions. |
./vendor/bin/sail artisan test --compact tests/Browser/Dashboard/TenantDashboardProductizationSmokeTest.php tests/Browser/TenantMembershipsPageTest.php |
Passed: 2 tests, 68 assertions. |
./vendor/bin/sail bin pint --dirty --format agent |
Passed. |
git diff --check |
Passed. |