Follow-up-Precision-Fix

This commit is contained in:
team 1
2026-04-26 12:44:44 +02:00
parent cd70460918
commit 76cb2189d5
9 changed files with 1008 additions and 30 deletions

View File

@@ -58,6 +58,15 @@ final class ConfigDumpEffectiveCommand extends Command
$retrieval = $this->section($config, 'retrieval');
$vector = $this->section($config, 'vector');
$commerce = $this->section($config, 'commerce');
$prompt = $this->section($config, 'prompt');
$agent = $this->section($config, 'agent');
$intent = $this->section($config, 'intent');
$vocabulary = $this->section($config, 'vocabulary');
$searchRepair = $this->section($config, 'search_repair');
$commerceQuery = $this->section($config, 'commerce_query');
$shopMatching = $this->section($config, 'shop_matching');
$language = $this->section($config, 'language');
$queryEnrichment = $this->section($config, 'query_enrichment');
$io->section('Runtime');
$io->definitionList(
@@ -86,7 +95,8 @@ final class ConfigDumpEffectiveCommand extends Command
$io->definitionList(
['hard_max_chunks' => (string) ($retrieval['hard_max_chunks'] ?? '')],
['hard_max_vectork' => (string) ($retrieval['hard_max_vectork'] ?? '')],
['vector_score_threshold' => (string) ($retrieval['vector_score_threshold'] ?? '')]
['vector_score_threshold' => (string) ($retrieval['vector_score_threshold'] ?? '')],
['retrieval_vocabulary_lists' => (string) $this->countMapEntries($retrieval['vocabulary'] ?? [])]
);
$io->section('Vector');
@@ -100,7 +110,21 @@ final class ConfigDumpEffectiveCommand extends Command
$io->definitionList(
['enabled' => $this->formatBool($commerce['enabled'] ?? false)],
['max_shop_results' => (string) ($commerce['max_shop_results'] ?? '')],
['store_api_base_url' => (string) ($commerce['store_api_base_url'] ?? '')]
['store_api_base_url' => (string) ($commerce['store_api_base_url'] ?? '')],
['commerce_query_lists' => (string) $this->countMapEntries($commerceQuery)],
['shop_matching_lists' => (string) $this->countMapEntries($shopMatching)],
['search_repair_lists' => (string) $this->countMapEntries($searchRepair)]
);
$io->section('Centralized YAML-backed configuration');
$io->definitionList(
['vocabulary_classes' => (string) $this->countMapEntries($this->section($vocabulary, 'classes'))],
['vocabulary_views' => (string) $this->countMapEntries($this->section($vocabulary, 'views'))],
['intent_sections' => (string) $this->countMapEntries($intent)],
['prompt_rule_groups' => (string) $this->countMapEntries($this->section($prompt, 'rules'))],
['agent_message_groups' => (string) $this->countMapEntries($this->section($agent, 'messages'))],
['stopwords' => (string) $this->countListEntries($language['stopwords'] ?? [])],
['query_enrichment_rules' => (string) $this->countMapEntries($queryEnrichment['rules'] ?? [])]
);
}
@@ -117,4 +141,14 @@ final class ConfigDumpEffectiveCommand extends Command
{
return filter_var($value, FILTER_VALIDATE_BOOLEAN) ? 'yes' : 'no';
}
private function countMapEntries(mixed $value): int
{
return is_array($value) ? count($value) : 0;
}
private function countListEntries(mixed $value): int
{
return is_array($value) ? count($value) : 0;
}
}

View File

@@ -0,0 +1,84 @@
<?php
declare(strict_types=1);
namespace App\Command;
use App\Config\RetriexEffectiveConfigProvider;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
#[AsCommand(
name: 'mto:agent:regression:test',
description: 'Run offline regression guards for stable RetrieX configuration paths'
)]
final class RegressionBaselineCommand extends Command
{
public function __construct(
private readonly RetriexEffectiveConfigProvider $provider,
) {
parent::__construct();
}
protected function configure(): void
{
$this->addOption('json', null, InputOption::VALUE_NONE, 'Render regression result as JSON.');
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$result = $this->provider->regressionBaseline();
if ((bool) $input->getOption('json')) {
$json = json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
$output->writeln(is_string($json) ? $json : '{}');
return $result['status'] === 'OK' ? Command::SUCCESS : Command::FAILURE;
}
$this->renderSummary(new SymfonyStyle($input, $output), $result);
return $result['status'] === 'OK' ? Command::SUCCESS : Command::FAILURE;
}
/**
* @param array{status:string, checks:array<string,bool>, errors:list<string>, warnings:list<string>} $result
*/
private function renderSummary(SymfonyStyle $io, array $result): void
{
$io->title('RetrieX regression baseline');
$rows = [];
foreach ($result['checks'] as $name => $passed) {
$rows[] = [$name, $passed ? 'OK' : 'FAILED'];
}
if ($rows !== []) {
$io->table(['Check', 'Result'], $rows);
}
if ($result['errors'] !== []) {
$io->section('Errors');
foreach ($result['errors'] as $error) {
$io->writeln('- ' . $error);
}
}
if ($result['warnings'] !== []) {
$io->section('Warnings');
foreach ($result['warnings'] as $warning) {
$io->writeln('- ' . $warning);
}
}
if ($result['status'] === 'OK') {
$io->success('Regression baseline checks passed.');
} else {
$io->error('Regression baseline checks failed.');
}
}
}