Automated PR: merge branch 248-private-ai-policy-foundation into dev (created by Copilot) Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #288
55 lines
2.1 KiB
PHP
55 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\Tenant;
|
|
use App\Models\Workspace;
|
|
use App\Support\Ai\AiDataClassification;
|
|
use App\Support\ProductKnowledge\ContextualHelpResolver;
|
|
use App\Support\SupportDiagnostics\SupportDiagnosticBundleBuilder;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('exposes only the approved product knowledge source input for ai answer drafts', function (): void {
|
|
$source = app(ContextualHelpResolver::class)->aiProductKnowledgeAnswerDraftSource();
|
|
|
|
expect($source)->toMatchArray([
|
|
'use_case_key' => 'product_knowledge.answer_draft',
|
|
'source_family' => 'product_knowledge',
|
|
'data_classifications' => [
|
|
AiDataClassification::ProductKnowledge->value,
|
|
AiDataClassification::OperationalMetadata->value,
|
|
],
|
|
])
|
|
->and($source['topics'])->not->toBeEmpty()
|
|
->and($source['operational_metadata'])->toHaveKeys(['version', 'topic_count'])
|
|
->and($source)->not->toHaveKeys(['tenant', 'tenant_id', 'workspace', 'workspace_id']);
|
|
});
|
|
|
|
it('exposes only the approved redacted support summary input for ai diagnostic drafts', function (): void {
|
|
$workspace = Workspace::factory()->create();
|
|
$tenant = Tenant::factory()->create([
|
|
'workspace_id' => (int) $workspace->getKey(),
|
|
]);
|
|
|
|
$source = app(SupportDiagnosticBundleBuilder::class)->aiSupportDiagnosticsSummaryDraftSource($tenant);
|
|
|
|
expect($source)->toMatchArray([
|
|
'use_case_key' => 'support_diagnostics.summary_draft',
|
|
'source_family' => 'support_diagnostics',
|
|
'data_classifications' => [
|
|
AiDataClassification::RedactedSupportSummary->value,
|
|
],
|
|
])
|
|
->and($source['summary'])->toHaveKeys([
|
|
'headline',
|
|
'dominant_issue',
|
|
'freshness_state',
|
|
'redaction_note',
|
|
'generated_from',
|
|
])
|
|
->and(data_get($source, 'redaction.mode'))->toBe('default_redacted')
|
|
->and($source)->not->toHaveKeys(['sections', 'context', 'tenant', 'workspace', 'operation_run']);
|
|
});
|