refactor: 리펙토링 진행중 의존성 gradle은 얇게 유지, 각 모듈에서 처리하고 있는 부분에 대해서 리펙토링

This commit is contained in:
donghyeon-ka
2026-09-23 17:27:09 +09:00
parent f412efff73
commit ba8a8c171c
98 changed files with 1999 additions and 939 deletions
@@ -14,9 +14,9 @@ import java.util.Objects;
* then tells an adopter that connection-cut and confirm-timeout are certified when neither has ever
* run.
*
* <p>This record is what a lane emits after running. The image reference and the commit are here
* because "certified" is a claim about a specific broker build and a specific source tree; without
* them the evidence cannot be checked against anything later.
* <p>This record is what a lane emits after running. The image reference, commit and observation
* time are provenance: they identify the run for audit/replay. The certification equality gate
* compares the behavioral claim fields and deliberately does not use commit/time as freshness keys.
*
* <p>{@link #toJson()} and {@link #fromJson(String)} are the same statement in both directions: the
* certification lane writes a line per scenario it proved and the compatibility matrix reads those
@@ -86,6 +86,26 @@ public final class BrokerFailureMatrix {
.anyMatch(scenario -> coverageOf(adapter, scenario) == Coverage.LIVE_BROKER);
}
/**
* Reports whether every scenario is backed by live-broker evidence or an explicitly approved gap.
*
* <p>This is the Stable certification predicate. A single live scenario is not certification, and
* an absent scenario is not silently converted into an approved exception.
*
* @param adapter the adapter module name
* @param approvedGaps gaps reviewed and accepted independently of this matrix
* @return true when every scenario is explained by evidence or an approved gap
*/
public boolean hasCertificationCoverage(
String adapter, java.util.Set<NetworkFaultScenario> approvedGaps) {
Objects.requireNonNull(approvedGaps, "approvedGaps must not be null");
return NetworkFaultScenario.all().stream()
.allMatch(
scenario ->
coverageOf(adapter, scenario) == Coverage.LIVE_BROKER
|| approvedGaps.contains(scenario));
}
/**
* Reports whether an adapter covers every scenario.
*
@@ -4,6 +4,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
@@ -33,6 +34,9 @@ public final class CertifiedEvidence {
private static final List<BrokerCertificationEvidence> RECORDED = load();
private static final Map<String, Set<NetworkFaultScenario>> APPROVED_GAPS =
Map.of("messaging-kafka", Set.of(NetworkFaultScenario.CONNECTION_REFUSED));
private CertifiedEvidence() {}
/**
@@ -44,6 +48,17 @@ public final class CertifiedEvidence {
return RECORDED;
}
/**
* Returns gaps that were deliberately accepted after review rather than inferred from missing
* evidence.
*
* @param adapter the adapter module name
* @return the explicit approved gaps for that adapter
*/
public static Set<NetworkFaultScenario> approvedGaps(String adapter) {
return APPROVED_GAPS.getOrDefault(adapter, Set.of());
}
/**
* Returns the scenarios an adapter has no evidence for.
*
@@ -58,7 +58,8 @@ public final class CompatibilityMatrix {
* @return true when {@link CertifiedEvidence} has live-broker evidence for this adapter
*/
public boolean hasLiveBrokerCertification() {
return BrokerFailureMatrix.from(CertifiedEvidence.recorded()).hasLiveBrokerCoverage(adapter);
return BrokerFailureMatrix.from(CertifiedEvidence.recorded())
.hasCertificationCoverage(adapter, CertifiedEvidence.approvedGaps(adapter));
}
public Entry {
@@ -46,17 +46,27 @@ class CompatibilityMatrixTest {
}
@Test
void aCertificationClaimCannotBeMadeWithoutEvidence() {
void oneLiveScenarioCannotSatisfyAStableCertification() {
String adapter = "messaging-partial";
BrokerFailureMatrix partial =
new BrokerFailureMatrix()
.record(
adapter,
NetworkFaultScenario.all().get(0),
BrokerFailureMatrix.Coverage.LIVE_BROKER);
assertThat(partial.hasCertificationCoverage(adapter, java.util.Set.of())).isFalse();
}
@Test
void everyStableAdapterHasOnlyExplicitlyApprovedEvidenceGaps() {
assertThat(CompatibilityMatrix.entries().values())
.filteredOn(entry -> entry.tier() == CompatibilityMatrix.Tier.STABLE)
.allSatisfy(
entry ->
assertThat(entry.hasLiveBrokerCertification())
.as(
"%s claims certification, so a lane must have produced evidence",
entry.adapter())
.isEqualTo(
BrokerFailureMatrix.from(CertifiedEvidence.recorded())
.hasLiveBrokerCoverage(entry.adapter())));
assertThat(CertifiedEvidence.approvedGaps(entry.adapter()))
.containsExactlyInAnyOrderElementsOf(
CertifiedEvidence.knownGaps(entry.adapter())));
}
@Test