Diagnoselogs und Test für DB-Reset-Verifikation (FAILED_FINAL)

- [TEMP-TRACE] INFO-Logs in SqliteDocumentRecordRepositoryAdapter:
  deleteByFingerprint() zeigt Fingerprint, jdbcUrl und rowsAffected;
  findByFingerprint() zeigt Fingerprint, jdbcUrl und Lookup-Ergebnis
- [TEMP-TRACE] Log in DocumentProcessingCoordinator.processDeferredOutcome()
  zeigt Fingerprint und Lookup-Ergebnis-Typ nach DB-Abfrage
- Bestehende [TEMP-TRACE] Logs in GuiBatchRunCoordinator und
  SqliteUnitOfWorkAdapter sind ebenfalls enthalten
- Neuer Test resetDocumentByFingerprint_deletesFailedFinalRecord_resultIsDocumentUnknown:
  legt FAILED_FINAL-Datensatz in echter SQLite-DB an, führt Reset aus
  und prüft, dass der Datensatz danach DocumentUnknown zurückliefert

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-04-23 15:00:22 +02:00
parent 83f6d63c27
commit 55088354ab
5 changed files with 62 additions and 4 deletions
@@ -101,16 +101,20 @@ public class SqliteDocumentRecordRepositoryAdapter implements DocumentRecordRepo
if (rs.next()) {
// Document exists - map to appropriate result type based on status
DocumentRecord record = mapResultSetToDocumentRecord(rs, fingerprint);
return switch (record.overallStatus()) {
DocumentRecordLookupResult result = switch (record.overallStatus()) {
case SUCCESS -> new DocumentTerminalSuccess(record);
case FAILED_FINAL -> new DocumentTerminalFinalFailure(record);
case READY_FOR_AI, PROPOSAL_READY, PROCESSING, FAILED_RETRYABLE,
SKIPPED_ALREADY_PROCESSED, SKIPPED_FINAL_FAILURE ->
new DocumentKnownProcessable(record);
};
logger.info("[TEMP-TRACE] findByFingerprint: fingerprint={}, jdbcUrl={}, Ergebnis={}",
fingerprint.sha256Hex(), jdbcUrl, result.getClass().getSimpleName());
return result;
} else {
// Document not found
logger.info("[TEMP-TRACE] findByFingerprint: fingerprint={}, jdbcUrl={}, Ergebnis=DocumentUnknown",
fingerprint.sha256Hex(), jdbcUrl);
return new DocumentUnknown();
}
}
@@ -318,8 +322,8 @@ public class SqliteDocumentRecordRepositoryAdapter implements DocumentRecordRepo
statement.setString(1, fingerprint.sha256Hex());
int rowsAffected = statement.executeUpdate();
logger.debug("Deleted {} document_record row(s) for fingerprint: {}",
rowsAffected, fingerprint.sha256Hex());
logger.info("[TEMP-TRACE] deleteByFingerprint: fingerprint={}, jdbcUrl={}, rowsAffected={}",
fingerprint.sha256Hex(), jdbcUrl, rowsAffected);
} catch (SQLException e) {
String message = "Failed to delete document record for fingerprint '"
@@ -178,6 +178,8 @@ public class SqliteUnitOfWorkAdapter implements UnitOfWorkPort {
*/
@Override
public void resetDocumentByFingerprint(DocumentFingerprint fingerprint) {
logger.info("[TEMP-TRACE] resetDocumentByFingerprint: Fingerprint={}, jdbcUrl={}",
fingerprint.sha256Hex(), jdbcUrl);
// Delete attempts first (FK constraint: processing_attempt → document_record)
SqliteProcessingAttemptRepositoryAdapter attemptRepo =
new SqliteProcessingAttemptRepositoryAdapter(jdbcUrl) {
@@ -197,6 +199,8 @@ public class SqliteUnitOfWorkAdapter implements UnitOfWorkPort {
}
};
recordRepo.deleteByFingerprint(fingerprint);
logger.info("[TEMP-TRACE] resetDocumentByFingerprint: Löschung abgeschlossen für Fingerprint={}",
fingerprint.sha256Hex());
}
}
}