TenantAtlas/specs/322-browser-no-drift-regression-guard/test-plan.md
Ahmed Darrazi d5086ff35a
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 52s
test: add Spec 322 browser no-drift regression guards
2026-05-17 12:57:29 +02:00

140 lines
5.2 KiB
Markdown

# Spec 322 Test Plan
## Purpose
Prove the Workspace / Environment context contracts from Specs 314 through 321 remain durable across Feature/static guards and Pest Browser smoke tests.
Assertions are authoritative. Screenshots are diagnostic only.
## Test Families
### Feature / Static Guards
Suggested files:
```text
apps/platform/tests/Feature/Navigation/Spec322AdminSurfaceScopeContractTest.php
apps/platform/tests/Feature/Navigation/Spec322LegacyQueryAliasGuardTest.php
apps/platform/tests/Feature/Navigation/Spec322EnvironmentCtaUrlContractTest.php
```
Required assertions:
- Core surfaces classify as `workspace_hub`, `environment_owned_page`, `workspace_owned_analysis_surface`, or `workspace_configuration_surface`.
- Clean workspace hub URLs never emit `environment_id`, `tenant`, `tenant_id`, `managed_environment_id`, `environment`, `tenant_scope`, or `tableFilters`.
- Environment CTAs use canonical `environment_id` for filterable workspace hubs and Environment routes for Environment-owned pages.
- Clear-filter behavior matches clean workspace hub entry.
- Cross-workspace `environment_id` filters reject safely.
- Legacy Environment/Tenant query aliases do not create filter or shell state.
- `/admin/t` routes and `TenantPanelProvider` remain absent.
- Provider Tenant terms remain allowed only in provider-boundary allowlist contexts.
### Browser Contract Guards
Suggested files:
```text
apps/platform/tests/Browser/Spec322WorkspaceHubNoDriftSmokeTest.php
apps/platform/tests/Browser/Spec322EnvironmentOwnedSurfaceSmokeTest.php
apps/platform/tests/Browser/Spec322WorkspaceOwnedAnalysisSmokeTest.php
apps/platform/tests/Browser/Spec322AlertsAuditNoDriftSmokeTest.php
```
Required assertions:
- Workspace hub clean sidebar/global/direct entry from Environment origin remains clean and Workspace-only.
- Filterable workspace hubs opened with `environment_id` show visible Environment chip, keep Workspace-only shell, and reject legacy params.
- Clear filter removes query/chip/table/session state and remains clean after reload.
- Browser back/forward keeps URL, chip, shell, and data aligned.
- Environment-owned pages require Environment route and show Environment shell after reload/back.
- Baseline Compare rejects old clean workspace-only access.
- Workspace-owned analysis surfaces cut to Workspace-only shell from Environment origin.
- Workspace configuration surfaces remain Workspace-only and chip-free.
- Alerts/Audit Log Spec 321 decisions are protected in browser.
## Focused Commands
Run targeted Feature/static gates:
```bash
cd apps/platform
./vendor/bin/sail artisan test \
tests/Feature/Navigation/Spec322AdminSurfaceScopeContractTest.php \
tests/Feature/Navigation/Spec322LegacyQueryAliasGuardTest.php \
tests/Feature/Navigation/Spec322EnvironmentCtaUrlContractTest.php \
--compact
```
Run targeted Browser gates:
```bash
cd apps/platform
./vendor/bin/sail artisan test \
tests/Browser/Spec322WorkspaceHubNoDriftSmokeTest.php \
tests/Browser/Spec322EnvironmentOwnedSurfaceSmokeTest.php \
tests/Browser/Spec322WorkspaceOwnedAnalysisSmokeTest.php \
tests/Browser/Spec322AlertsAuditNoDriftSmokeTest.php \
--compact
```
Run existing related regression gates:
```bash
cd apps/platform
./vendor/bin/sail artisan test --filter='WorkspaceHub|EnvironmentFilter|ClearFilter|LegacyTenant|BaselineCompare|WorkspaceOwnedAnalysis|AlertsAudit' --compact
```
Run final formatting and diff checks:
```bash
cd apps/platform
./vendor/bin/sail pint --dirty
git diff --check
```
## Existing Anchors To Reuse
```text
apps/platform/tests/Browser/Spec314WorkspaceHubNavigationContextSmokeTest.php
apps/platform/tests/Browser/Spec316WorkspaceHubClearFilterSmokeTest.php
apps/platform/tests/Feature/Navigation/WorkspaceHubRegistryTest.php
apps/platform/tests/Feature/Navigation/WorkspaceHubEnvironmentFilterContractTest.php
apps/platform/tests/Feature/Navigation/WorkspaceHubClearFilterContractTest.php
apps/platform/tests/Feature/Navigation/Spec321AlertsAuditEnvironmentFilterContractTest.php
apps/platform/tests/Feature/Guards/NoLegacyTenantPanelRuntimeTest.php
apps/platform/tests/Feature/Guards/LegacyTenantPlatformContextCleanupTest.php
apps/platform/tests/Feature/Filament/BaselineCompareEnvironmentRouteContractTest.php
```
Spec 322 should extend these anchors where that is narrower than adding duplicate tests.
## Browser Fixture Rules
- Use explicit workspace, Managed Environment, membership, and session setup.
- Seed only records required to prove data scope.
- Avoid global seed assumptions.
- Avoid sleeps.
- Prefer stable text, route, ARIA, or existing `data-testid` selectors.
- Avoid volatile counters unless fixture records make the count deterministic.
- Keep each browser file focused by surface model.
## Screenshot Policy
Screenshots may be saved under:
```text
specs/322-browser-no-drift-regression-guard/artifacts/screenshots/
```
Screenshot capture is diagnostic. A failed screenshot capture must not replace browser assertions. A browser blocker must be recorded in `coverage-manifest.md`.
## Full Suite Statement
Do not claim full-suite green unless the full suite was run.
If only targeted commands are run, the final report must say targeted gates passed and full suite was not run.