## Summary - implement the canonical shared fixture profile model with minimal, standard, and full semantics plus temporary legacy alias resolution - slim default factory behavior for operation runs, backup sets, provider connections, and provider credentials while keeping explicit heavy opt-in states - migrate the first console, navigation, RBAC, and drift caller packs to explicit lean helpers and wire lane comparison reporting into the existing Spec 206 seams - reconcile spec 207 docs, contracts, quickstart guidance, and task tracking with the implemented behavior ## Validation - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Unit/Support/CreateUserWithTenantProfilesTest.php tests/Unit/Factories/TenantFactoryTest.php tests/Unit/Factories/OperationRunFactoryTest.php tests/Unit/Factories/BackupSetFactoryTest.php tests/Unit/Factories/ProviderConnectionFactoryTest.php tests/Unit/Factories/ProviderCredentialFactoryTest.php tests/Feature/Guards/FixtureCostProfilesGuardTest.php tests/Feature/Guards/FixtureLaneImpactBudgetTest.php tests/Feature/Guards/TestLaneArtifactsContractTest.php tests/Feature/Console/ReconcileOperationRunsCommandTest.php tests/Feature/Console/ReconcileBackupScheduleOperationRunsCommandTest.php tests/Feature/Navigation/RelatedNavigationResolverMemoizationTest.php tests/Feature/Spec080WorkspaceManagedTenantAdminMigrationTest.php tests/Feature/BaselineDriftEngine/FindingFidelityTest.php` - `cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent` - `./scripts/platform-test-lane fast-feedback` - `./scripts/platform-test-lane confidence` - `./scripts/platform-test-report fast-feedback` - `./scripts/platform-test-report confidence` ## Lane outcome - `fast-feedback`: 136.400761s vs 176.73623s baseline, status `improved` - `confidence`: 394.5669s vs 394.383441s baseline, status `stable` Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #240
6.5 KiB
Quickstart: Shared Test Fixture Slimming
Goal
Reduce per-test cost in the shared support layer without reducing meaningful coverage by making minimal fixture behavior the default, moving heavy provider or membership or workspace behavior behind explicit opt-in paths, migrating the highest-usage expensive callers, and proving the result against the existing Spec 206 lane budgets.
Implementation Order
- Capture the pre-migration fast-feedback and confidence lane baseline with the existing Spec 206 wrappers before helper or factory edits begin.
- Inventory and classify the existing helper and factory seams that still hide extra workspace, provider, credential, session, user-relationship, or graph state.
- Finalize the fixture-profile vocabulary of
minimal,standard, andfullorintegration-heavy, including mapping rules and retirement triggers for current explicit variants. - Audit and slim tenant workspace provisioning across both
TenantFactoryand theTenantmodel boot hook. - Audit and slim the next high-cost factories, starting with
OperationRunFactory,ProviderConnectionFactory,ProviderCredentialFactory, andBackupSetFactory. - Make heavy-by-intent builders and helpers announce their cost through naming or explicit parameters.
- Add guard coverage that asserts lean paths stay lean and heavy paths create only their promised extra context.
- Migrate the first high-usage caller packs in fast-feedback and confidence.
- Measure post-migration lane impact against the recorded baseline with the existing Spec 206 lane-report tooling.
./scripts/platform-test-reportshould emit thesharedFixtureSlimmingComparisonblock forfast-feedbackandconfidence. - Publish concise contributor guidance for choosing the cheapest valid fixture path.
Suggested Code Touches
apps/platform/app/Models/Tenant.php
apps/platform/database/factories/TenantFactory.php
apps/platform/database/factories/OperationRunFactory.php
apps/platform/database/factories/ProviderConnectionFactory.php
apps/platform/database/factories/BackupSetFactory.php
apps/platform/database/factories/RestoreRunFactory.php
apps/platform/tests/Pest.php
apps/platform/tests/Feature/Concerns/*
apps/platform/tests/Feature/Console/*
apps/platform/tests/Feature/Guards/*
apps/platform/tests/Feature/Navigation/*
apps/platform/tests/Feature/Spec080WorkspaceManagedTenantAdminMigrationTest.php
apps/platform/tests/Support/*
scripts/platform-test-lane
scripts/platform-test-report
Validation Flow
Use focused suites while slimming one seam at a time, then validate the standard lanes against the Spec 206 baseline:
cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Console
cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Guards
cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Navigation
cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Spec080WorkspaceManagedTenantAdminMigrationTest.php
./scripts/platform-test-lane fast-feedback
./scripts/platform-test-lane confidence
./scripts/platform-test-report fast-feedback
./scripts/platform-test-report confidence
cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent
If a touched factory or helper affects an intentionally heavy builder, validate that specific surface before measuring the lanes.
Recorded Pre-Migration Baseline Capture
The current pre-migration snapshots for this spec were captured on 2026-04-16T13:11:57+00:00 and are the baseline that the lane-impact guard and report comparison use:
| Lane | Baseline | Budget | Target |
|---|---|---|---|
fast-feedback |
176.73623s |
200s |
improve by >=10% or stay within +5% |
confidence |
394.383441s |
450s |
improve by >=10% or stay within +5% |
Baseline References
Use the existing Spec 206 recorded measurements as the starting point for lane impact:
fast-feedback:176.74sbudget200sconfidence:394.38sbudget450sheavy-governance:83.66sbudget120sbrowser:128.87sbudget150s
The first success target for this feature is not to redesign the lane model. It is to improve per-test cost enough that at least one affected standard lane gets measurably faster while the others remain stable.
Record fresh pre-migration fast-feedback and confidence snapshots on the feature branch before fixture changes land so the eventual comparison is not inferred only from historical Spec 206 documentation.
Legacy Alias Retirement
provider-enabledretires after the first fast-feedback and confidence migration packs callstandarddirectly.credential-enabledretires after credential-dependent callers move tofullplus explicit local overrides where needed.ui-contextretires after UI-context callers use the canonicalfullprofile or an equally explicit local helper.heavyretires after the remaining legacy callers usefulldirectly.
Manual Review Checklist
- Confirm the default helper path stays on
minimalsemantics and does not silently create provider or credential or UI context. - Confirm touched factories declare lean versus heavy behavior explicitly instead of hiding it in callbacks or attribute resolvers.
- Confirm the tenant workspace cascade is controlled consistently across both factory and model layers.
- Confirm legacy heavy paths remain visible, temporary during migration, and tied to explicit removal triggers.
- Confirm the first migrated caller packs match their real business need and do not fall back to full context without explanation.
- Confirm guard coverage asserts both absence and presence of context where appropriate.
- Confirm both pre- and post-migration lane measurements are taken through the existing Spec 206 wrappers and artifacts under
storage/logs/test-lanes.
Exit Criteria
- The shared support layer has a documented fixture-profile model with
minimal,standard, andfullorintegration-heavy. - Touched high-usage helpers and factories no longer create hidden heavy context by default.
- Legacy heavy behavior is available through an explicit and visibly temporary transition path with a declared removal trigger.
- The first high-usage caller packs in fast-feedback and confidence have been migrated.
- Guard coverage protects lean paths, heavy paths, and the transition path.
- Post-migration lane measurements show at least one affected standard lane improved and no affected standard lane materially regressed against the Spec 206 budgets.