Clamp self-serve path projection limits

This commit is contained in:
Jeppe B
2026-06-01 23:27:22 +02:00
parent 7cb248a112
commit 6712368323
3 changed files with 53 additions and 28 deletions
@@ -1321,7 +1321,7 @@ it('truncates path outcome projection when the state cap is reached', function (
->and($projection['warnings'][0])->toContain('truncated at 2 explored state');
});
it('returns complete terminal path results for wide question trees and reports progress', function (): void {
it('applies default caps for wide question trees and reports progress', function (): void {
$service = selfserve_studio_graph_without_constructor();
$simulate = function (array $overrides): array {
$answers = [];
@@ -1380,17 +1380,18 @@ it('returns complete terminal path results for wide question trees and reports p
},
]);
expect($projection['truncated'])->toBeFalse()
->and($projection['summary']['state_count'])->toBe(8191)
expect($projection['truncated'])->toBeTrue()
->and($projection['summary']['state_count'])->toBe(2048)
->and($projection['summary']['question_count'])->toBe(12)
->and($projection['summary']['terminal_path_count'])->toBe(4096)
->and($projection['summary']['terminal_path_count'])->toBe(1023)
->and($projection['summary']['outcome_count'])->toBe(2)
->and($projection['summary']['path_sample_count'])->toBe(4096)
->and($projection['summary']['path_sample_count'])->toBe(200)
->and($projection['progress']['complete'])->toBeTrue()
->and($projection['progress']['percent'])->toBe(100)
->and($projection['paths'])->toHaveCount(4096)
->and($projection['paths'])->toHaveCount(200)
->and($projection['paths'][0]['answers'])->toHaveCount(12)
->and($projection['paths'][0]['result'])->toBe('Allowed')
->and($projection['warnings'][0])->toContain('truncated at 2048 explored state')
->and($progressEvents)->not->toBeEmpty()
->and($progressEvents[0]['terminal_path_count'])->toBeGreaterThan(0)
->and($progressEvents[0]['path_sample_count'])->toBeGreaterThan(0);