phase a audit

This commit is contained in:
team2
2026-02-22 13:51:45 +01:00
parent 5656a10930
commit b3e9110dd1
14 changed files with 222 additions and 463 deletions

View File

@@ -49,9 +49,8 @@ final class VectorIndexBuilder
// --------------------------------------------
// 🔵 FALL: NDJSON ist leer → kein Vector Index
// --------------------------------------------
if (filesize($this->indexNdjsonPath) === 0) {
if (!is_file($this->indexNdjsonPath) || filesize($this->indexNdjsonPath) === 0) {
// Alten Index entfernen
@unlink($this->vectorIndexPath);
@unlink($this->vectorMetaPath);
@@ -63,7 +62,7 @@ final class VectorIndexBuilder
);
}
return; // WICHTIG: kein Python, kein tmp, kein Fehler
return;
}
// --------------------------------------------
@@ -79,7 +78,6 @@ final class VectorIndexBuilder
$tmpVectorIndexPath = $this->vectorIndexPath . '.tmp';
// Clean leftovers
@unlink($tmpVectorIndexPath);
@unlink($this->vectorMetaPath);
@@ -108,11 +106,15 @@ final class VectorIndexBuilder
private function assertPreconditions(): void
{
if (!is_file($this->scriptPath)) {
throw new \RuntimeException('vector_ingest.py not found at: ' . $this->scriptPath);
throw new \RuntimeException(
'Vector build script not found at: ' . $this->scriptPath
);
}
if (!is_file($this->indexNdjsonPath)) {
throw new \RuntimeException('index.ndjson not found at: ' . $this->indexNdjsonPath);
throw new \RuntimeException(
'index.ndjson not found at: ' . $this->indexNdjsonPath
);
}
}
@@ -195,4 +197,4 @@ final class VectorIndexBuilder
@file_put_contents($logPath, "=== VectorIndexBuilder OK ===\n", FILE_APPEND);
}
}
}
}