M3-AP-007 Bootstrap- und CLI-Anpassungen Pre-Version

This commit is contained in:
2026-04-01 22:09:04 +02:00
parent 4d769643d4
commit 1b974db321
3 changed files with 59 additions and 50 deletions
@@ -203,6 +203,30 @@ class BootstrapRunnerTest {
"Lock path passed to adapter must not be blank (default must be applied)");
}
/**
* M3 exit-code contract: a completed batch run returns exit code 0 even when individual
* documents ended with M3 content errors or technical document errors.
* Only hard infrastructure or startup failures must cause exit code 1.
*/
@Test
void run_returnsZeroWhenBatchRunCompletesWithDocumentLevelFailures() throws Exception {
ConfigurationPort mockConfigPort = new MockConfigurationPort(tempDir, true);
// BatchRunOutcome.SUCCESS is what the M3 use case returns when the run completed,
// regardless of how many individual documents had content or technical errors.
RunBatchProcessingUseCase useCaseWithDocumentFailures = (context) -> BatchRunOutcome.SUCCESS;
BootstrapRunner runner = new BootstrapRunner(
() -> mockConfigPort,
lockFile -> new MockRunLockPort(),
StartConfigurationValidator::new,
(config, lock) -> useCaseWithDocumentFailures,
SchedulerBatchCommand::new
);
assertEquals(0, runner.run(),
"M3 contract: batch completion with document-level failures must return exit code 0");
}
@Test
void run_withDefaultConstructor_usesRealImplementations() {
BootstrapRunner runner = new BootstrapRunner();