TenantAtlas/specs/317-legacy-tenant-environment-context-cleanup/legacy-inventory.md
ahmido b159dacd36 feat: clean up legacy tenant environment context (#372)
## Summary
- remove legacy tenant-scoped routing and middleware paths in favor of the current environment/workspace context flow
- update Filament pages and resources to use the cleaned-up admin surface and environment filter context
- add the related spec 317 artifacts and targeted tests for environment filter state and legacy context cleanup

## Testing
- not run as part of this commit/push/PR workflow

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #372
2026-05-16 18:25:36 +00:00

8.4 KiB

Spec 317 Legacy Tenant Usage Inventory

Status: implementation inventory Updated: 2026-05-16

This inventory classifies high-risk legacy Tenant platform-context occurrences before cleanup. It is intentionally focused on current runtime, tests, and current product-truth docs. Provider-boundary Tenant terminology is preserved by tenant-usage-allowlist.md.

File Symbol / Method / Route / Label Current Meaning Correct Meaning Classification Action Risk
apps/platform/app/Filament/Pages/Reviews/CustomerReviewWorkspace.php tenantPrefilterUrl() URL helper for an explicit Managed Environment filter on a workspace hub Environment filter URL rename_to_environment Rename to environmentFilterUrl() and update callers/tests with no alias High: old helper name advertises a valid Tenant filter seam
apps/platform/app/Support/Filament/CanonicalAdminTenantFilterState.php CanonicalAdminTenantFilterState Shared sync/reset helper for environment-like Filament table filters Canonical admin Environment filter state rename_to_environment Rename to CanonicalAdminEnvironmentFilterState and update callers/tests High: class name suggests Tenant context can seed workspace hub filter state
apps/platform/app/Filament/Concerns/WorkspaceScopedTenantRoutes.php WorkspaceScopedTenantRoutes Resource route helper for workspace/environment route generation Workspace-scoped Environment routes rename_to_environment Rename to WorkspaceScopedEnvironmentRoutes and update resource usage High: trait name encodes old Tenant route mental model
apps/platform/app/Support/Tenants/TenantPageCategory.php TenantPageCategory and cases TenantBound, TenantScopedEvidence Admin surface classification for workspace, environment, and record-viewer context Admin surface scope; environment-bound categories rename_to_environment Rename enum to AdminSurfaceScope and environment-bound cases High: shell scope classification is platform-core, not provider Tenant identity
apps/platform/app/Support/Middleware/EnsureFilamentTenantSelected.php EnsureFilamentTenantSelected / ensure-filament-tenant-selected Middleware that resolves admin shell/navigation environment context Ensure environment context selected rename_to_environment Rename class and middleware alias to EnsureEnvironmentContextSelected / ensure-environment-context-selected High: middleware name is an active bootstrapping seam
apps/platform/app/Support/Workspaces/WorkspaceContext.php LAST_TENANT_IDS_SESSION_KEY, lastTenantId(), rememberTenantContext(), rememberedTenant() Per-workspace remembered Managed Environment switcher memory Last Environment memory, switcher convenience only rename_to_environment Rename API and session key to Environment wording and update call sites/tests High: remembered state must not be confused with workspace hub filters
apps/platform/app/Support/OperateHub/OperateHubShell.php Filament::getTenant() usage Filament tenant can represent an environment on environment-owned routes Valid only for environment-bound pages, invalid for workspace hub scope allowed_provider_boundary Keep only where scope class permits environment-bound context; add static guard for workspace hub paths Medium: valid Filament tenancy API but unsafe if used on workspace hubs
apps/platform/app/Support/OperateHub/OperateHubShell.php Query hints tenant, managed_environment_id Legacy query hints for non-hub tenant-owned resources Not valid Workspace hub Environment filters remove Existing workspace hub short-circuit remains; add Spec 317 guard coverage Medium: active code already blocks hubs, but regression guard is required
apps/platform/routes/web.php /admin/t Legacy Tenant panel route family No active route remove Keep absent and add/extend route guard High: route family must not return
apps/platform/bootstrap/app.php and panel/routes ensure-filament-tenant-selected Middleware alias for environment selection Environment context alias rename_to_environment Replace alias usage with ensure-environment-context-selected Medium: active runtime alias name misleads future work
apps/platform/resources/views/filament/partials/context-bar.blade.php $lastTenantId Last selected Managed Environment memory Last Environment ID rename_to_environment Rename local variable and API call Low: visible copy is already Environment-oriented but variable name is wrong
apps/platform/app/Filament/Resources/ProviderConnectionResource.php lastTenantId() fallback in provider policy/resource context Remembered environment convenience for provider-adjacent behavior Last Environment ID rename_to_environment Update API name; do not convert provider tenant IDs into environment filters Medium: provider-adjacent surface must preserve boundary clarity
apps/platform/app/Support/EnvironmentDashboard/EnvironmentDashboardSummaryBuilder.php tenantPrefilterUrl() caller Environment Dashboard CTA into Customer Review Workspace environment_id filter URL rename_to_environment Update to environmentFilterUrl() High: generated CTA must be canonical
apps/platform/app/Support/GovernanceInbox/GovernanceInboxSectionBuilder.php tenantPrefilterUrl() callers Governance links into Customer Review Workspace environment_id filter URL rename_to_environment Update to environmentFilterUrl() Medium: link helper must not preserve old API
apps/platform/app/Filament/Widgets/ManagedEnvironment/ManagedEnvironmentReviewPackCard.php tenantPrefilterUrl() callers Environment-owned review pack link environment_id filter URL rename_to_environment Update to environmentFilterUrl() Medium: environment-owned CTA link
apps/platform/app/Filament/Resources/EnvironmentReviewResource.php tenantScopedUrl() Canonical URL helper for Managed Environment-owned review pages Environment-scoped review URL rename_to_environment Rename to environmentScopedUrl() and remove the ignored legacy panel hint parameter Medium: helper name and ignored panel argument preserved old route mental model
apps/platform/app/Filament/Resources/ProviderConnectionResource.php lastEnvironmentId() create/context fallback and parameters['tenant'] URL alias Hidden remembered Environment state and legacy parameter alias for Provider Connection context Explicit environment_id filter only remove Remove remembered-state create fallback and remove array tenant URL alias support High: credential-adjacent Workspace hub must not derive scope from hidden switcher memory
apps/platform/app/Filament/Resources/*Resource.php tenant relationship and managed_environment_id DB columns Tenant-owned model relationships and database columns Current schema truth out_of_scope Do not perform cosmetic DB/relationship renames in Spec 317 High if renamed broadly: migration and model churn outside scope
apps/platform/app/Support/Tenants/* except surface-scope classifier Tenant operability services, questions, lanes Tenant/Managed Environment operability domain vocabulary Existing domain vocabulary out_of_scope Only update type references required by renamed surface-scope enum Medium: broader terminology cleanup requires separate product/domain decision
docs/product/spec-candidates.md Current queue references to Tenant platform context, tenantPrefilterUrl, /admin/t Current product-truth docs and old follow-up notes Workspace-first / Environment-second platform context rename_to_environment Update current product-truth notes for Spec 317 Medium: stale docs can reintroduce drift
Completed specs under specs/313-* to specs/316-* Historical Tenant references Historical implementation evidence Historical context allowed_historical_archived_doc Do not rewrite completed specs Low: history remains valid as evidence
docs/audits/*, old specs before current truth Historical audit wording Historical provider/platform notes Historical context allowed_historical_archived_doc Do not rewrite unless referenced as current truth Low

Quarantine Decisions

No active runtime class/helper is intentionally quarantined at the start of implementation. If a later rename proves too broad for this spec, add a row with needs_product_decision or out_of_scope before skipping it.