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:
1 parent
e95ba4f986
commit
c46f4a032b
12 files changed
+810
-10
No files matched your search
@@ -6,6 +6,7 @@
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Models\Channel;
|
||||
use App\Process\Modules\ModuleDefinition;
|
||||
use App\Process\Templates\TemplateComposer;
|
||||
|
||||
/**
|
||||
* Rule-based comparison of a configuration draft (docs/Prozessarchitektur/MODUL_KONFIGURATIONSMATRIX.md §5): for every
|
||||
@@ -15,7 +16,7 @@
|
||||
*/
|
||||
final class ConfigurationImpact
|
||||
{
|
||||
public function __construct(private ProcessCatalogue $catalogue, private ChannelProcessConfiguration $configuration) {}
|
||||
public function __construct(private ProcessCatalogue $catalogue, private ChannelProcessConfiguration $configuration, private TemplateComposer $composer) {}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $draft
|
||||
@@ -61,6 +62,63 @@ public function of(Channel $channel, IntakeKind $intake, array $draft): array
|
||||
return $impacts;
|
||||
}
|
||||
|
||||
/**
|
||||
* What a change of function templates means (docs/Prozessarchitektur/SCHABLONEN.md): per changed area the modules that
|
||||
* drop out, join or stay, the responsibility that changes, the stored switches and settings that no longer apply and
|
||||
* what the new template still needs or does not build yet. Compared with the templates in force for new cases. Pure:
|
||||
* nothing is changed, nothing is dropped silently – the landlord sees every consequence before saving.
|
||||
*
|
||||
* @param array<string, mixed> $draft
|
||||
* @return list<array{area: string, from: ?string, to: string, removed: list<string>, added: list<string>, kept: list<string>, responsibility: ?array{from: string, to: string}, switches_lost: list<string>, settings_replaced: list<string>, needs: list<string>, extensions: list<string>}>
|
||||
*/
|
||||
public function ofTemplates(Channel $channel, IntakeKind $intake, array $draft): array
|
||||
{
|
||||
$model = $this->catalogue->model((string) ($draft['model'] ?? ''));
|
||||
if ($model->slots() === []) {
|
||||
return [];
|
||||
}
|
||||
$current = $this->configuration->currentTemplates($channel, $intake);
|
||||
$target = $this->composer->resolve($model, (array) ($draft['templates'] ?? []));
|
||||
$stored = (array) (($channel->process_overrides ?? [])[$intake->value] ?? []);
|
||||
$labelOf = fn (string $module): string => ($this->catalogue->hasModule($module) ? $this->catalogue->modules()[$module]::definition()->label : $module);
|
||||
$impacts = [];
|
||||
|
||||
foreach ($model->slots() as $area) {
|
||||
$from = $current[$area->value] ?? null;
|
||||
$to = $target[$area->value] ?? null;
|
||||
$toClass = $to === null ? null : $this->catalogue->templateClass($to);
|
||||
if ($toClass === null || $from === $to) {
|
||||
continue;
|
||||
}
|
||||
$fromClass = $from === null ? null : $this->catalogue->templateClass($from);
|
||||
$before = $fromClass === null ? [] : $fromClass::modules();
|
||||
$after = $toClass::modules();
|
||||
$removed = array_values(array_diff($before, $after));
|
||||
$setting = $area->setting();
|
||||
$storedValue = $setting->normalize($stored[$setting->value] ?? null);
|
||||
|
||||
$impacts[] = [
|
||||
'area' => $area->label(),
|
||||
'from' => $fromClass === null ? null : $fromClass::label(),
|
||||
'to' => $toClass::label(),
|
||||
'removed' => array_map($labelOf, $removed),
|
||||
'added' => array_map($labelOf, array_values(array_diff($after, $before))),
|
||||
'kept' => array_map($labelOf, array_values(array_intersect($after, $before))),
|
||||
'responsibility' => $fromClass !== null && $fromClass::responsibility() !== $toClass::responsibility()
|
||||
? ['from' => $setting->describe($fromClass::responsibility()->value), 'to' => $setting->describe($toClass::responsibility()->value)]
|
||||
: null,
|
||||
'switches_lost' => array_map($labelOf, array_values(array_filter($removed, fn (string $module): bool => ($stored['steps'][$module]['on'] ?? true) === false))),
|
||||
'settings_replaced' => $storedValue !== null && (string) $storedValue !== $toClass::responsibility()->value
|
||||
? [$setting->question().' Bisher gespeichert: „'.$setting->describe($storedValue).'“, künftig durch die Schablone: „'.$setting->describe($toClass::responsibility()->value).'“. Der gespeicherte Wert muss beim Speichern ausdrücklich entfernt werden.']
|
||||
: [],
|
||||
'needs' => array_map(fn (string $result): string => 'Voraussetzung: '.$result, $toClass::requires()),
|
||||
'extensions' => $toClass::extensions(),
|
||||
];
|
||||
}
|
||||
|
||||
return $impacts;
|
||||
}
|
||||
|
||||
/**
|
||||
* The results that stay necessary although the step is off: what the steps depending on it still need.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user