1
0

M7 Logging-Sensitivität mit echten Log- und Persistenznachweisen

abgesichert
This commit is contained in:
2026-04-08 10:52:59 +02:00
parent f2bbc8a884
commit cab9fed5b0
3 changed files with 202 additions and 272 deletions

View File

@@ -753,6 +753,61 @@ class SqliteProcessingAttemptRepositoryAdapterTest {
assertThat(saved.get(0).status()).isEqualTo(ProcessingStatus.PROPOSAL_READY);
}
// -------------------------------------------------------------------------
// AI field persistence is independent of logging configuration
// -------------------------------------------------------------------------
/**
* Verifies that the repository always stores the complete AI raw response and reasoning,
* independent of any logging sensitivity configuration.
* <p>
* The {@code AiContentSensitivity} setting controls only whether sensitive content is
* written to log files. It has no influence on what the repository persists. This test
* demonstrates that full AI fields are stored regardless of any logging configuration by
* verifying a round-trip with both full content and long reasoning text.
*/
@Test
void save_persistsFullAiResponseAndReasoning_unaffectedByLoggingConfiguration() {
// The repository has no dependency on AiContentSensitivity.
// It always stores the complete AI raw response and reasoning.
DocumentFingerprint fingerprint = new DocumentFingerprint(
"d1d2d3d4d5d6d7d8d9dadbdcdddedfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfd0".substring(0, 64));
RunId runId = new RunId("persistence-independence-run");
Instant now = Instant.now().truncatedTo(ChronoUnit.MICROS);
// Deliberately long and complete AI raw response — must be stored in full
String fullRawResponse = "{\"date\":\"2026-03-01\",\"title\":\"Stromabrechnung\","
+ "\"reasoning\":\"Invoice date clearly stated on page 1. Utility provider named.\"}";
// Deliberately complete reasoning — must be stored in full
String fullReasoning = "Invoice date clearly stated on page 1. Utility provider named.";
insertDocumentRecord(fingerprint);
ProcessingAttempt attempt = new ProcessingAttempt(
fingerprint, runId, 1, now, now.plusSeconds(5),
ProcessingStatus.PROPOSAL_READY,
null, null, false,
"gpt-4o", "prompt-v1.txt",
3, 750,
fullRawResponse,
fullReasoning,
LocalDate.of(2026, 3, 1), DateSource.AI_PROVIDED,
"Stromabrechnung",
null
);
repository.save(attempt);
List<ProcessingAttempt> saved = repository.findAllByFingerprint(fingerprint);
assertThat(saved).hasSize(1);
ProcessingAttempt result = saved.get(0);
// Full raw response is stored completely — not truncated, not suppressed
assertThat(result.aiRawResponse()).isEqualTo(fullRawResponse);
// Full reasoning is stored completely — not truncated, not suppressed
assertThat(result.aiReasoning()).isEqualTo(fullReasoning);
}
// -------------------------------------------------------------------------
// Integration with document records (FK constraints)
// -------------------------------------------------------------------------