TenantAtlas/apps/platform/tests/Architecture/PlatformVocabularyBoundaryGuardTest.php
ahmido fb32e9bfa5
Some checks failed
Main Confidence / confidence (push) Failing after 49s
feat: canonical operation type source of truth (#276)
## Summary
- implement the canonical operation type source-of-truth slice across operation writers, monitoring surfaces, onboarding flows, and supporting services
- add focused contract and regression coverage for canonical operation type handling
- include the generated spec 239 artifacts for the feature slice

## Validation
- browser smoke PASS for `/admin` -> workspace overview -> operations -> operation detail -> tenant-scoped operations drilldown
- spec/plan/tasks/quickstart artifact analysis cleaned up to a no-findings state
- automated test suite not run in this session

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #276
2026-04-25 18:11:23 +00:00

58 lines
2.3 KiB
PHP

<?php
declare(strict_types=1);
use App\Support\Governance\PlatformVocabularyGlossary;
use App\Support\OperationCatalog;
use App\Support\OperationRunType;
use App\Services\Providers\ProviderOperationRegistry;
it('keeps touched registry ownership metadata inside the allowed three-way boundary classification', function (): void {
$classifications = collect(app(PlatformVocabularyGlossary::class)->registries())
->map(static fn ($descriptor): string => $descriptor->boundaryClassification)
->unique()
->values()
->all();
expect($classifications)->toEqualCanonicalizing([
PlatformVocabularyGlossary::BOUNDARY_CROSS_DOMAIN_GOVERNANCE,
PlatformVocabularyGlossary::BOUNDARY_PLATFORM_CORE,
PlatformVocabularyGlossary::BOUNDARY_INTUNE_SPECIFIC,
]);
});
it('guards the false-universal policy_type alias behind explicit context-aware vocabulary helpers', function (): void {
$glossary = app(PlatformVocabularyGlossary::class);
expect($glossary->term('policy_type')?->boundaryClassification)->toBe(PlatformVocabularyGlossary::BOUNDARY_INTUNE_SPECIFIC)
->and($glossary->resolveAlias('policy_type', 'compare')?->termKey)->toBe('governed_subject')
->and(OperationCatalog::canonicalCode('baseline_capture'))->toBe('baseline.capture');
});
it('guards canonical operation type writers against raw alias reintroduction', function (): void {
$legacyAliases = [
'baseline_capture',
'baseline_compare',
'inventory_sync',
'entra_group_sync',
'backup_schedule_run',
'backup_schedule_retention',
'backup_schedule_purge',
'directory_role_definitions.sync',
];
$registry = app(ProviderOperationRegistry::class);
$registryTypes = array_merge(
array_keys($registry->definitions()),
collect($registry->definitions())->pluck('operation_type')->all(),
array_keys($registry->providerBindings()),
collect($registry->providerBindings())
->flatMap(static fn (array $bindings): array => collect($bindings)->pluck('operation_type')->all())
->all(),
OperationRunType::values(),
array_keys(config('tenantpilot.operations.lifecycle.covered_types', [])),
);
expect(array_values(array_intersect($legacyAliases, $registryTypes)))->toBe([]);
});