# Tasks: Workspace / Environment Surface Scope Contract

**Input**: `/Users/ahmeddarrazi/Documents/projects/wt-plattform/specs/311-workspace-environment-surface-scope-contract/spec.md`, `/Users/ahmeddarrazi/Documents/projects/wt-plattform/specs/311-workspace-environment-surface-scope-contract/plan.md`
**Prerequisites**: Current branch is `311-workspace-environment-surface-scope-contract`; Customer Review Workspace product completion is deferred to 312.
**Scope**: Global admin shell/navigation/filter contract only.

**Tests**: Pest/Livewire feature tests and route-category unit test.

## Test Governance Checklist

- [x] Lane assignment is named and is the narrowest sufficient proof: focused Feature/Unit lane.
- [x] New or changed tests stay in existing surface families.
- [x] No new shared test helper, seed, factory, or heavy family is introduced.
- [x] Browser smoke is not required because no visual layout/styling changed.
- [x] Legacy tenant-owned resource parity remains covered to prevent over-broad scope regression.

## Format: `[ID] [P?] [Story?] Description with file path`

## Phase 1: Branch and WIP Split

- [x] T001 Save dirty Customer Review Workspace WIP patch to `/tmp/311-customer-review-workspace-wip.patch`.
- [x] T002 Stash dirty WIP, including untracked files, before switching branches.
- [x] T003 Switch from the mixed branch to `platform-dev`, pull, and create `311-workspace-environment-surface-scope-contract`.
- [x] T004 Confirm no commits are made during implementation.

## Phase 2: Contract Tests First

- [x] T005 [US1] Add workspace-wide query-independence cases to `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/tests/Feature/Filament/PanelNavigationSegregationTest.php`.
- [x] T006 [US1] Add representative shell-contract coverage to `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/tests/Feature/Workspaces/GlobalContextShellContractTest.php`.
- [x] T007 [US1] Update Operations topbar/filter tests in `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/tests/Feature/Filament/WorkspaceContextTopbarAndTenantSelectionTest.php`, `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/tests/Feature/Monitoring/OperationsTenantScopeTest.php`, `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/tests/Feature/Monitoring/OperationsKpiHeaderTenantContextTest.php`, `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/tests/Feature/Monitoring/OperationsCanonicalUrlsTest.php`, and `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/tests/Feature/Spec085/OperationsIndexHeaderTest.php`.
- [x] T008 [US1] Update Customer Review Workspace and Review Register filter tests in `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/tests/Feature/Reviews/CustomerReviewWorkspacePageTest.php`, `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/tests/Feature/EnvironmentReview/EnvironmentReviewRegisterPrefilterTest.php`, and `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/tests/Feature/EnvironmentReview/EnvironmentReviewRegisterTest.php`.
- [x] T009 [US1] Update Audit Log and Alerts workspace-wide tests in `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/tests/Feature/Filament/AuditLogPageTest.php`, `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/tests/Feature/Alerts/AlertDeliveryDeepLinkFiltersTest.php`, `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/tests/Feature/Filament/Alerts/AlertsKpiHeaderTest.php`, and `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/tests/Feature/Filament/Alerts/AlertDeliveryViewerTest.php`.
- [x] T010 [US2] Add route-category coverage to `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/tests/Unit/Tenants/TenantPageCategoryTest.php`.
- [x] T011 [US3] Keep `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/tests/Feature/Filament/TenantOwnedResourceScopeParityTest.php` green as a legacy tenant-owned regression guard.

## Phase 3: Runtime Contract

- [x] T012 [US1] Add `WorkspaceWideSurface` classification to `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/app/Support/Tenants/TenantPageCategory.php`.
- [x] T013 [US1] Make `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/app/Support/Tenants/TenantPageCategory.php` resolve Livewire update/request paths from referer when needed.
- [x] T014 [US1] Update `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/app/Support/Tenants/TenantInteractionLane.php` for the new route category.
- [x] T015 [US1] Update `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/app/Support/OperateHub/OperateHubShell.php` so `WorkspaceWideSurface` resolves tenantless before query, Filament tenant, or remembered tenant hints.
- [x] T016 [US1] Remove remembered-tenant default filters and global-context clearing from `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/app/Filament/Pages/Reviews/CustomerReviewWorkspace.php` and `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/app/Filament/Pages/Reviews/ReviewRegister.php`.
- [x] T017 [US1] Make Provider Connection list filtering query-driven only in `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/app/Filament/Resources/ProviderConnectionResource.php`.
- [x] T018 [US1] Make Alert Delivery list and Alerts KPI workspace-wide in `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/app/Filament/Resources/AlertDeliveryResource.php` and `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/app/Filament/Widgets/Alerts/AlertsKpiHeader.php`.
- [x] T019 [US1] Make Operations KPI use workspace entitlement scope when shell is tenantless in `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/app/Filament/Widgets/Operations/OperationsKpiHeader.php`.

## Phase 4: Spec Artifacts

- [x] T020 Create `/Users/ahmeddarrazi/Documents/projects/wt-plattform/specs/311-workspace-environment-surface-scope-contract/spec.md`.
- [x] T021 Create `/Users/ahmeddarrazi/Documents/projects/wt-plattform/specs/311-workspace-environment-surface-scope-contract/plan.md`.
- [x] T022 Create `/Users/ahmeddarrazi/Documents/projects/wt-plattform/specs/311-workspace-environment-surface-scope-contract/tasks.md`.

## Phase 5: Validation and Close-Out

- [x] T023 Run the focused 311 Feature/Unit test selection from `/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform`.
- [x] T024 Run `cd /Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform && ./vendor/bin/sail bin pint --dirty --format agent`.
- [x] T025 Run `git diff --check` from `/Users/ahmeddarrazi/Documents/projects/wt-plattform`.
- [x] T026 Record final changed files, validation, no-migration/no-RBAC/no-CRW-product-logic close-out.

## Dependencies

- T001-T004 before runtime edits.
- T005-T011 before or alongside T012-T019.
- T012-T019 before final validation.
- T020-T022 before final close-out because runtime files changed.
- T023-T026 last.

## Parallel Work Examples

- T005-T011 can be maintained by surface family after the contract is known.
- T016-T019 are disjoint runtime surface updates after T012-T015.
- T023 can run before T024/T025; T024 and T025 are final formatting/whitespace checks.

## Implementation Strategy

1. Preserve 312 WIP by patch/stash.
2. Establish route-scope tests first.
3. Harden central taxonomy and shell.
4. Remove remembered/global tenant defaults from explicit workspace-wide surfaces.
5. Preserve legacy tenant-owned list parity.
6. Validate focused suite, format, and whitespace.
