p59 + p60
This commit is contained in:
@@ -9,8 +9,10 @@ final class GovernanceConfig
|
||||
/**
|
||||
* @param array<string, mixed> $config
|
||||
*/
|
||||
public function __construct(private readonly array $config = [])
|
||||
{
|
||||
public function __construct(
|
||||
private readonly array $config = [],
|
||||
private readonly ?GenreConfig $genreConfig = null,
|
||||
) {
|
||||
}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
@@ -22,49 +24,57 @@ final class GovernanceConfig
|
||||
/** @return string[] */
|
||||
public function getRegressionProtectedShortModelTokens(): array
|
||||
{
|
||||
return $this->requiredStringList('regression_baseline.protected_short_model_tokens');
|
||||
return $this->genreStringList('governance_and_regression.regression_baseline.protected_short_model_tokens')
|
||||
?: $this->requiredStringList('regression_baseline.protected_short_model_tokens');
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
public function getRegressionProtectedMeasurementValues(): array
|
||||
{
|
||||
return $this->requiredStringList('regression_baseline.protected_measurement_values');
|
||||
return $this->genreStringList('governance_and_regression.regression_baseline.protected_measurement_values')
|
||||
?: $this->requiredStringList('regression_baseline.protected_measurement_values');
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
public function getRegressionProtectedTechnicalPromptKeywords(): array
|
||||
{
|
||||
return $this->requiredStringList('regression_baseline.protected_technical_prompt_keywords');
|
||||
return $this->genreStringList('governance_and_regression.regression_baseline.protected_technical_prompt_keywords')
|
||||
?: $this->requiredStringList('regression_baseline.protected_technical_prompt_keywords');
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
public function getRegressionTechnicalPriorityRequiredMarkers(): array
|
||||
{
|
||||
return $this->requiredStringList('regression_baseline.technical_priority_required_markers');
|
||||
return $this->genreStringList('governance_and_regression.regression_baseline.technical_priority_required_markers')
|
||||
?: $this->requiredStringList('regression_baseline.technical_priority_required_markers');
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
public function getRegressionProtectedAccessoryPromptKeywords(): array
|
||||
{
|
||||
return $this->requiredStringList('regression_baseline.protected_accessory_prompt_keywords');
|
||||
return $this->genreStringList('governance_and_regression.regression_baseline.protected_accessory_prompt_keywords')
|
||||
?: $this->requiredStringList('regression_baseline.protected_accessory_prompt_keywords');
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
public function getRegressionProtectedSearchRepairSpecificityTerms(): array
|
||||
{
|
||||
return $this->requiredStringList('regression_baseline.protected_search_repair_specificity_terms');
|
||||
return $this->genreStringList('governance_and_regression.regression_baseline.protected_search_repair_specificity_terms')
|
||||
?: $this->requiredStringList('regression_baseline.protected_search_repair_specificity_terms');
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
public function getRegressionProtectedRetrievalReagentWords(): array
|
||||
{
|
||||
return $this->requiredStringList('regression_baseline.protected_retrieval_reagent_words');
|
||||
return $this->genreStringList('governance_and_regression.regression_baseline.protected_retrieval_reagent_words')
|
||||
?: $this->requiredStringList('regression_baseline.protected_retrieval_reagent_words');
|
||||
}
|
||||
|
||||
/** @return array<string, string[]> */
|
||||
public function getRegressionProtectedRetrievalDeviceWordGroups(): array
|
||||
{
|
||||
$value = $this->requiredValue('regression_baseline.protected_retrieval_device_word_groups');
|
||||
$value = $this->genreArray('governance_and_regression.regression_baseline.protected_retrieval_device_word_groups')
|
||||
?: $this->requiredValue('regression_baseline.protected_retrieval_device_word_groups');
|
||||
if (!is_array($value)) {
|
||||
throw $this->invalid('regression_baseline.protected_retrieval_device_word_groups', 'must be a map of string lists');
|
||||
}
|
||||
@@ -99,31 +109,36 @@ final class GovernanceConfig
|
||||
|
||||
public function getRegressionShopPromptOriginalQuery(): string
|
||||
{
|
||||
return $this->requiredString('regression_baseline.shop_prompt_regression_original_query');
|
||||
return $this->genreString('governance_and_regression.regression_baseline.shop_prompt_regression_original_query')
|
||||
?: $this->requiredString('regression_baseline.shop_prompt_regression_original_query');
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
public function getRegressionShopPromptRequiredOutputInstructionMarkers(): array
|
||||
{
|
||||
return $this->requiredStringList('regression_baseline.shop_prompt_required_output_instruction_markers');
|
||||
return $this->genreStringList('governance_and_regression.regression_baseline.shop_prompt_required_output_instruction_markers')
|
||||
?: $this->requiredStringList('regression_baseline.shop_prompt_required_output_instruction_markers');
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
public function getRegressionShopQueryMetaGuardTerms(): array
|
||||
{
|
||||
return $this->requiredStringList('regression_baseline.shop_query_meta_guard_terms');
|
||||
return $this->genreStringList('governance_and_regression.regression_baseline.shop_query_meta_guard_terms')
|
||||
?: $this->requiredStringList('regression_baseline.shop_query_meta_guard_terms');
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
public function getRegressionShopQueryContextFallbackFilterTerms(): array
|
||||
{
|
||||
return $this->requiredStringList('regression_baseline.shop_query_context_fallback_filter_terms');
|
||||
return $this->genreStringList('governance_and_regression.regression_baseline.shop_query_context_fallback_filter_terms')
|
||||
?: $this->requiredStringList('regression_baseline.shop_query_context_fallback_filter_terms');
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
public function getRegressionShopQueryCurrentInputPreservationTerms(): array
|
||||
{
|
||||
return $this->requiredStringList('regression_baseline.shop_query_current_input_preservation_terms');
|
||||
return $this->genreStringList('governance_and_regression.regression_baseline.shop_query_current_input_preservation_terms')
|
||||
?: $this->requiredStringList('regression_baseline.shop_query_current_input_preservation_terms');
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
@@ -138,7 +153,8 @@ final class GovernanceConfig
|
||||
/** @return string[] */
|
||||
public function getLanguageProtectedStopwordTerms(): array
|
||||
{
|
||||
return $this->requiredStringList('language.protected_stopword_terms');
|
||||
return $this->genreStringList('retrieval_and_language.protected_terms.terms')
|
||||
?: $this->requiredStringList('language.protected_stopword_terms');
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
@@ -241,7 +257,8 @@ final class GovernanceConfig
|
||||
/** @return string[] */
|
||||
public function getCorePatternAuditDomainMarkerTerms(): array
|
||||
{
|
||||
return $this->requiredStringList('core_pattern_audit.domain_marker_terms');
|
||||
return $this->genreStringList('governance_and_regression.core_pattern_audit.domain_marker_terms')
|
||||
?: $this->requiredStringList('core_pattern_audit.domain_marker_terms');
|
||||
}
|
||||
|
||||
/** @return array<int, array{path:string, pattern:string, reason:string}> */
|
||||
@@ -288,6 +305,23 @@ final class GovernanceConfig
|
||||
return $this->requiredInt('core_pattern_audit.max_snippet_length', 20);
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
private function genreStringList(string $path): array
|
||||
{
|
||||
return $this->genreConfig?->getValueStringList($path) ?? [];
|
||||
}
|
||||
|
||||
private function genreString(string $path): string
|
||||
{
|
||||
return $this->genreConfig?->getValueString($path) ?? '';
|
||||
}
|
||||
|
||||
/** @return array<int|string, mixed> */
|
||||
private function genreArray(string $path): array
|
||||
{
|
||||
return $this->genreConfig?->getValueArray($path) ?? [];
|
||||
}
|
||||
|
||||
private function requiredInt(string $path, int $min = PHP_INT_MIN): int
|
||||
{
|
||||
$value = $this->requiredValue($path);
|
||||
|
||||
Reference in New Issue
Block a user