Kanalkonfigurator und Prozess-Tester auf Schablonenbasis

Geschäftsentscheidungen zuerst (Schablonen je Bereich, Voreinstellungen A3–A5), Einzelschritte
eingeklappt, Auswirkungsanalyse beim Schablonenwechsel, unbestätigte Portal-Fähigkeiten gekennzeichnet.
Tester-Bericht nennt Schablonen, unabhängig laufende Schritte und fehlende Nachweise; alle vier
Kombinationen sind als Szenario getestet. Doku: SCHABLONEN.md.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-05 10:56:51 +01:00
1 parent e95ba4f986
commit c46f4a032b
12 files changed
+810 -10

No files matched your search

+55 -2
View File
@@ -8,8 +8,10 @@
use App\Models\Channel;
use App\Models\Property;
use App\Models\Tenant;
use App\Process\Capability;
use App\Process\CaseActivities;
use App\Process\CaseContext;
use App\Process\ChannelCapabilities;
use App\Process\ProcessCatalogue;
use App\Process\ProcessPlan;
use App\Process\ProcessProfile;
@@ -37,6 +39,9 @@ final class ProcessSandboxDriver
private int $ledgerSeen = 0;
/** @var list<string> labels of the activities that were done after the previous event */
private array $doneBefore = [];
/** @var list<Email> every mail of the run (simulated: the only mailer is `array`) */
private array $sent = [];
@@ -98,7 +103,7 @@ public function run(array $input): array
return [
'scenario' => ['key' => $scenario::key(), 'label' => $scenario::label(), 'inputs' => $context->inputs, 'available_events' => count($scenario->events($context->inputs))],
'plan' => $booking === null ? null : $this->plan($booking),
'plan' => $booking === null ? null : $this->plan($booking, $channel),
'timeline' => $timeline,
'result' => $booking === null ? null : ['status' => $booking->status->getLabel(), 'situation' => CaseActivities::situation($booking), 'next' => CaseActivities::next($booking)?->label],
'violations' => EffectLedger::violations(),
@@ -122,7 +127,7 @@ private function assertSandbox(): void
/**
* @return array<string, mixed>
*/
private function plan(Booking $booking): array
private function plan(Booking $booking, Channel $channel): array
{
$plan = ProcessPlan::of($booking);
$profile = $booking->process();
@@ -134,10 +139,49 @@ private function plan(Booking $booking): array
'variant' => $plan->variant,
'modules' => $plan->modules,
'case_type' => strtoupper($profile->caseType->value),
'templates' => $this->templates($plan, $channel),
'configuration' => collect(ProcessSetting::cases())->map(fn ($setting): array => ['question' => $setting->question(), 'value' => $setting->describe($profile->value($setting)), 'source' => ProcessProfile::sourceLabel($profile->source($setting))])->all(),
];
}
/**
* The function templates the case follows: what each stands for, its modules and the portal capabilities it relies on
* with their origin – a capability that is only suggested or derived is shown as not confirmed, never as proven.
*
* @return list<array{area: string, label: string, reference: string, responsibility: string, modules: list<string>, capabilities: list<array{label: string, required: string, source: string, confirmed: bool}>}>
*/
private function templates(ProcessPlan $plan, Channel $channel): array
{
$catalogue = app(ProcessCatalogue::class);
$capabilities = app(ChannelCapabilities::class)->resolve($channel);
$rows = [];
foreach ($plan->templates as $area => $reference) {
$class = $catalogue->templateClass($reference);
if ($class === null) {
continue;
}
$rows[] = [
'area' => $class::area()->label(),
'label' => $class::label(),
'reference' => $reference,
'responsibility' => $class::responsibility()->getLabel(),
'modules' => array_values(array_map(fn (string $module): string => $plan->labels[$module] ?? $module, $class::modules())),
'capabilities' => array_values(array_map(function (string $key, bool $required) use ($capabilities): array {
$capability = $capabilities[$key] ?? null;
return [
'label' => ChannelCapabilities::definitions()[$key]['question'],
'required' => $required ? 'ja' : 'nein',
'source' => $capability?->sourceLabel() ?? 'noch nicht bekannt',
'confirmed' => $capability?->source === Capability::CONFIRMED,
];
}, array_keys($class::capabilityRequirements()), $class::capabilityRequirements())),
];
}
return $rows;
}
/**
* The case after one event: its course, the skipped steps, the simulated mails and effects.
*
@@ -172,9 +216,18 @@ private function capture(SandboxContext $context): array
}
}
$activities = CaseActivities::for($booking);
$waiting = array_values(array_map(fn ($activity): string => $activity->label, array_filter($activities, fn ($activity): bool => $activity->state->value === 'waiting')));
$done = array_values(array_map(fn ($activity): string => $activity->label, array_filter($activities, fn ($activity): bool => in_array($activity->state->value, ['done', 'external'], true))));
// Steps that came to an end in this event while others wait: they do not hold each other up.
$independent = $waiting === [] ? [] : array_values(array_diff($done, $this->doneBefore));
$this->doneBefore = $done;
return [
'status' => $booking->status->getLabel(),
'situation' => CaseActivities::situation($booking),
'waiting' => $waiting,
'independent' => $independent,
'activities' => array_map(fn ($activity): array => ['label' => $activity->label, 'state' => $activity->state->getLabel(), 'state_key' => $activity->state->value, 'detail' => $activity->detail], CaseActivities::for($booking)),
'skipped' => $skipped,
'calendar' => ['occupying' => Booking::query()->occupying()->whereKey($booking->id)->exists(), 'hold_until' => $booking->isHoldActive() ? $booking->hold_expires_at->format('d.m.Y H:i') : null],