This commit is contained in:
team 1
2026-05-10 12:04:46 +02:00
parent 0174c8d1b1
commit 886b6fac84
5 changed files with 431 additions and 0 deletions

View File

@@ -1371,6 +1371,47 @@ final readonly class RetriexEffectiveConfigProvider
$this->validateRegexPatternList($positiveTokenFilter['adjacent_variant_patterns'] ?? [], 'genre.configuration_values.shop_query_runtime.positive_token_filter.adjacent_variant_patterns', $errors);
}
$genericDeviceAnchor = is_array($shopQueryRuntime['generic_device_anchor'] ?? null)
? $shopQueryRuntime['generic_device_anchor']
: [];
if ($genericDeviceAnchor !== []) {
foreach (['enabled', 'remove_generic_device_terms'] as $boolKey) {
if (array_key_exists($boolKey, $genericDeviceAnchor) && !is_bool($genericDeviceAnchor[$boolKey])) {
$errors[] = sprintf('genre.configuration_values.shop_query_runtime.generic_device_anchor.%s must be boolean.', $boolKey);
}
}
if (array_key_exists('template', $genericDeviceAnchor) && (!is_string($genericDeviceAnchor['template']) || trim($genericDeviceAnchor['template']) === '')) {
$errors[] = 'genre.configuration_values.shop_query_runtime.generic_device_anchor.template must be a non-empty string.';
}
$this->validateStringList($this->toList($genericDeviceAnchor['trigger_terms'] ?? []), 'genre.configuration_values.shop_query_runtime.generic_device_anchor.trigger_terms', $errors, $warnings);
$this->validateStringList($this->toList($genericDeviceAnchor['suppress_if_terms'] ?? []), 'genre.configuration_values.shop_query_runtime.generic_device_anchor.suppress_if_terms', $errors, $warnings);
$anchorRules = $genericDeviceAnchor['anchor_rules'] ?? [];
if ($anchorRules !== [] && !is_array($anchorRules)) {
$errors[] = 'genre.configuration_values.shop_query_runtime.generic_device_anchor.anchor_rules must be a list.';
} elseif (is_array($anchorRules)) {
foreach ($anchorRules as $index => $rule) {
if (!is_array($rule)) {
$errors[] = sprintf('genre.configuration_values.shop_query_runtime.generic_device_anchor.anchor_rules.%s must be a map.', (string) $index);
continue;
}
if (!is_string($rule['anchor'] ?? null) || trim((string) ($rule['anchor'] ?? '')) === '') {
$errors[] = sprintf('genre.configuration_values.shop_query_runtime.generic_device_anchor.anchor_rules.%s.anchor must be a non-empty string.', (string) $index);
}
$this->validateStringList(
$this->toList($rule['match_terms'] ?? []),
sprintf('genre.configuration_values.shop_query_runtime.generic_device_anchor.anchor_rules.%s.match_terms', (string) $index),
$errors,
$warnings
);
}
}
}
foreach ($this->collectGenreConfigurationValueSourcePaths($configurationValues) as $valuePath => $sourcePaths) {
foreach ($sourcePaths as $sourcePath) {
if (!isset($flattened[$sourcePath])) {