This commit is contained in:
Your Name
2026-09-21 10:26:14 +08:00
parent bbe3e870a1
commit dbf474ddd7
67 changed files with 10636 additions and 279 deletions
@@ -27,6 +27,7 @@ $expect = static function (bool $condition, string $message) use (&$checks): voi
};
$command = (string) file_get_contents(dirname(__DIR__) . '/app/command/PrescriptionAiWork.php');
$configSource = (string) file_get_contents(dirname(__DIR__) . '/config/prescription_analysis.php');
$config = require dirname(__DIR__) . '/config/prescription_analysis.php';
// A model task keeps its database connection idle for the whole upstream call. MySQL's
@@ -50,4 +51,17 @@ $expect($requestTimeout > 0 && $requestTimeout < (int) $config['lease_seconds'],
$expect((int) $config['max_attempts'] >= 1 && (int) $config['lease_seconds'] >= 60,
'lease and attempt limits stay within a recoverable range');
// Several prescriptions must be analysed at the same time instead of queueing one by one.
$expect((int) $config['max_parallel_per_model'] >= 2,
'more than one task may run per model');
$expect(str_contains($configSource, "env('prescription_analysis.MAX_PARALLEL_PER_MODEL'"),
'the concurrency limit is tunable without a code edit');
$expect(str_contains($configSource, "env('prescription_analysis.DAILY_PATIENT_BATCHES'")
&& str_contains($configSource, "env('prescription_analysis.DAILY_MODEL_TASKS'"),
'the daily budgets are tunable without a code edit');
// A context rebuild sweep must never delay a prescription that is waiting to be prepared.
$expect(str_contains($command, '!$worked && time() >= $sweepAt'),
'source sweeps only run while the prepare lane has nothing to claim');
echo 'Prescription AI worker resilience: ' . $checks . " checks passed\n";