## 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
11 KiB
Data Model: Shared Test Fixture Slimming
This feature introduces no new runtime database tables. The data-model work formalizes repository-level fixture-governance objects that describe how shared helpers, factories, migration packs, and lane measurements should behave. Field names are conceptual and may later map to PHP arrays, guard tests, or documentation rather than to persisted runtime records.
1. Fixture Profile
Purpose
Represents one named level of setup cost and side effects for shared test support.
Fields
profile_id: stable identifier such asminimal,standard, orfulldisplay_name: contributor-facing namecost_class:minimal,standard, orintegration-heavycreates_workspace: booleancreates_workspace_membership: booleancreates_tenant_membership: booleansets_session_context: booleanclears_capability_caches: booleancreates_provider_connection: booleancreates_provider_credential: booleansets_ui_context: booleanlegacy_aliases: optional list such asprovider-enabled,credential-enabled, orui-contextnotes: short guidance for when the profile is appropriate
Validation Rules
- The catalog must contain at least
minimal,standard, andfull. - Exactly one profile may be the default profile for a given helper binding.
minimalmust not create provider, credential, cache-clearing, or UI-context side effects.fullmay create integration-heavy side effects, but those side effects must be declared explicitly.
2. Helper Entry Point
Purpose
Represents one shared helper or helper alias that resolves to a fixture profile contract.
Fields
helper_name: examplecreateUserWithTenantdefault_profile_id: the profile used when no explicit profile is requestedsupported_profile_ids: list of allowed profileslegacy_aliases: transitional helper names or profile aliasesannounces_heavy_context: boolean indicating whether the name itself signals heavy behaviorside_effect_contract: list of side effects promised by this helper when a given profile is selectedtransition_status:current,legacy-transition, orplanned-removal
Validation Rules
- Every shared helper must resolve to exactly one default profile.
- Heavy behavior must be reachable through an explicit profile or clearly named helper, not only hidden booleans.
- Legacy aliases must map to a declared profile, remain temporary, and point to a declared removal trigger in the transition-path model.
3. Factory Cascade Finding
Purpose
Represents one audited place where a factory, model hook, or callback creates hidden extra context.
Fields
finding_id: stable identifiersubject_name: factory or model name such asTenantFactoryorTenant::bootedcascade_source:definition,attribute-callback,afterCreating,model-event, orsupport-helpertrigger_condition: what causes the extra context to appearcreated_objects: list of related models or state written as a side effectcost_class:standardorheavydisposition:remove,make-explicit,retain-documented, orfollow-upnotes: rationale and migration concerns
Validation Rules
- Every audited high-usage subject must have at least one explicit disposition.
- A finding marked
retain-documentedmust explain why the behavior is materially required.
4. Factory State Contract
Purpose
Represents the expected cost posture of a factory default or named state.
Fields
factory_namestate_namecost_class:minimal,standard, orintegration-heavydefault_state: booleancreates_relationships: related models or graph expansionsforbidden_side_effects: side effects that must not happen in this stateintended_usage: short explanation of what the state is for
Validation Rules
- A touched high-usage factory must have a declared default cost class.
- A
minimalstate must not create undeclared relationships or repair missing workspace/provider context behind the scenes. - An
integration-heavystate must document the graph it creates.
5. Legacy Transition Path
Purpose
Represents how an old helper or heavy default remains temporarily available during migration.
Fields
transition_idlegacy_entry_point: helper name, alias, or factory default being preserved temporarilyresolved_profile_id: the explicit profile or state it maps tovisibility_mode:named-alias,warning-comment, orguard-testedremoval_trigger: condition for retiring the transition pathnotes
Validation Rules
- A transition path must remain visibly heavier than the new default behavior.
- A transition path must have a declared removal trigger so it does not become permanent accidental API.
6. Caller Migration Pack
Purpose
Represents one batch of high-usage callers migrated together.
Fields
pack_idtarget_lanes: one or more offast-feedback,confidence,browser, orheavy-governanceselection_basis:high-usage,high-cost,shared-surface, orlegacy-dependencycaller_selectors: directories, files, or patterns identifying the packtarget_profile_id: preferred fixture profile after migrationlegacy_fallback_allowed: booleanexpected_lane_impact: narrative or numeric expectation
Validation Rules
- The first slice must include at least one migration pack affecting either
fast-feedbackorconfidence. - Packs migrated to
minimalorstandardmust not silently fall back to full context without an explicit reason.
7. Fixture Guard Contract
Purpose
Represents a guard test that protects fixture behavior from regression.
Fields
guard_idsubject_type:helper,factory,builder, orlane-measurementsubject_nameasserts_absent_context: list of context that must not appearasserts_present_context: list of context that must appearcovers_transition_path: booleanfailure_signal: brief description of what regression should be obvious in CI
Validation Rules
- Minimal-path guards must assert absence of hidden heavy context.
- Heavy-path guards must assert presence of promised heavy context.
- Transition-path guards must remain explicit about what legacy behavior is being preserved.
8. Lane Impact Measurement
Purpose
Represents before and after measurement for a migration pack using the Spec 206 reporting seams.
Fields
measurement_idlane_id: examplefast-feedbackorconfidencebaseline_seconds: pre-migration wall-clock valuepost_migration_seconds: post-migration wall-clock valuebudget_threshold_seconds: current Spec 206 budget for the lanestatus:improved,stable, orregressednotes
Validation Rules
- Standard-lane measurements must reference the existing Spec 206 budgets.
- A lane marked
regressedmust explain whether the regression is temporary, justified, or blocking.
9. First-Slice Governance Inventory
Current Shared Fixture Surface
apps/platform/tests/Pest.phpnow exposes a canonicalminimal,standard, andfullprofile catalog plus explicit transition helpers forprovider-enabled,credential-enabled,ui-context, andheavycallers.apps/platform/app/Models/Tenant.phpstill contains a test-only boot hook that auto-provisions a workspace whenworkspace_idis null.apps/platform/database/factories/TenantFactory.phpusesafterCreating()workspace provisioning by default and only partially suppresses it inminimal().apps/platform/database/factories/OperationRunFactory.phpnow keeps the default path userless and requires an explicitwithUser()opt-in for interactive initiator context.apps/platform/database/factories/ProviderConnectionFactory.phpnow exposes explicitminimal,standard, andfullprovider graph states instead of leaving the cost posture implicit.apps/platform/database/factories/ProviderCredentialFactory.phpnow exposes an explicit verified-connection state and keeps legacy-migrated credentials visible through a named state.apps/platform/database/factories/BackupSetFactory.phpnow keeps the default path item-free and uses explicitfull,staleCompleted(), anddegradedCompleted()states for backup-item graphs.apps/platform/tests/Feature/Concerns/BuildsBaselineCompareMatrixFixtures.phpand similar builders create intentionally rich multi-record graphs that should remain explicit heavy helpers.
Recorded Cascade Dispositions
Tenant::bootedworkspace auto-provisioning:make-explicitviaTenant::skipTestWorkspaceProvisioning()andTenantFactory::minimal().TenantFactory::configure()default workspace provisioning:retain-documentedfor legacy callers, withminimal()as the lean escape hatch.OperationRunFactoryimplicit initiator user creation:removefrom the default path, now restored only throughwithUser().OperationRunFactoryworkspace repair when a tenant lacks workspace context:follow-up; guarded through lean caller migration rather than silently broadening helper defaults further in this slice.ProviderConnectionFactoryprovider credential graph inflation:make-explicitthroughfull()andwithCredential().ProviderCredentialFactoryverified dedicated connection graph:make-explicitthroughverifiedConnection().BackupSetFactorybackup-item graph creation:retain-documentedon named states only (full,staleCompleted,degradedCompleted).
First-Slice Migration Packs
console-navigation-pack:tests/Feature/Console/ReconcileOperationRunsCommandTest.php,tests/Feature/Console/ReconcileBackupScheduleOperationRunsCommandTest.php, andtests/Feature/Navigation/RelatedNavigationResolverMemoizationTest.phpnow use explicit minimal helpers or lean operation-run factory states.rbac-drift-pack:tests/Feature/Spec080WorkspaceManagedTenantAdminMigrationTest.phpandtests/Feature/BaselineDriftEngine/FindingFidelityTest.phpnow callcreateMinimalUserWithTenant()directly instead of depending on the generic default helper entry point.heavy-builder-pack:BuildsBaselineCompareMatrixFixturesandBuildsPortfolioTriageFixturesnow make the chosen minimal actor-setup path explicit while still remaining intentionally graph-heavy builders.
First-Slice Target Objects
- Canonical fixture-profile vocabulary and helper bindings
- Tenant and workspace provisioning cascade audit
- Lean state contracts for the touched high-usage factories
- Legacy transition paths for heavy historical callers
- High-usage migration packs for fast-feedback and confidence
- Guard contracts for lean, heavy, and legacy-path behavior
- Lane impact measurements against Spec 206 budgets