Files
document-haness/docs/clean-architecture-backend-template/final/evidence/raw/119a-notification-migration-ladder-probe.java
T
DongHyeonkaandClaude Opus 5 b2963105a8 docs(keycloak-session-store): import the session-storage lab as a new project
The keycloak project ended with four open questions that design could not
settle. A two-VM lab was built to answer them by measurement, and this is
that material: 26 experiments, 125 raw command outputs, 22 browser captures.

Follows the import procedure in README.md.

  source/     the originating repository verbatim — 78 documents, 28 SVGs,
              8 manifests, plus .source-revision recording the commit
  final/      the SSOT
    document.md   729 lines written from the 29 experiment documents, not
                  concatenated: what was predicted, what was measured, and
                  where the measurement itself was wrong
    evidence/raw    125 outputs, flattened to <experiment>__<file> because
                    the originals collided (01-baseline.txt appeared three
                    times) and the audit only globs the top level
    evidence/meta   one per raw file; command and exitCode are null and the
                    README says why rather than inventing them
    evidence/browser  22 captures
    assets/       three diagrams through techviz
    .techviz/     their VizSpecs

A separate project rather than an addition to keycloak: the B-layer answers
that project's four questions, but the A, C and D layers are about cluster
failure, SSO and operations, and one document.md should hold one subject.
The four question records there can point here through 관계.

Recorded rather than papered over: only three of the 28 diagrams were
remade. The repository forbids hand-drawn SVG and forbids titles inside the
canvas; all 28 originals carry both, so converting them is redrawing, not
reformatting. They stay in source/ and the gap is written into the document.

verify-pipeline.py passes. audit-records.py reports no issues.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-04 22:51:59 +09:00

102 lines
3.8 KiB
Java

package dev.caskeleton.adapter.outbound.persistence.notification;
import dev.caskeleton.adapter.outbound.persistence.platform.JpaPlatformContractSupport;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
/** Analysis-only probe: what each hand-maintained notification migration ladder actually builds. */
@Tag("jpa-contract")
class AnalysisNotificationLadderProbe {
private static final List<String> NOTIFICATION =
List.of(
"V1__notification_platform_core.sql",
"V2__notification_platform_contact_template_policy.sql",
"V3__notification_platform_inbox_admin.sql",
"V4__notification_platform_alignment_and_activation.sql",
"V5__notification_recipient_expiry.sql",
"V6__notification_projection_facts.sql",
"V7__notification_collapse.sql",
"V8__notification_admin_claim.sql",
"V9__notification_evidence_certainty.sql",
"V10__variables_payload_envelope_guard.sql");
@Test
void ladderColumnCoverage() throws Exception {
Set<String> full = null;
for (int depth : new int[] {6, 8, 9, 10}) {
Set<String> columns = columnsAfter(depth);
if (depth == 10) {
full = columns;
}
System.out.println("ladder.notificationVersions=" + depth + " columns=" + columns.size());
}
for (int depth : new int[] {6, 8, 9}) {
Set<String> columns = columnsAfter(depth);
TreeSet<String> missing = new TreeSet<>(full);
missing.removeAll(columns);
System.out.println(
"ladder.notificationVersions=" + depth + " missingVersusV10=" + missing.size());
System.out.println("ladder." + depth + ".missing=" + missing);
}
}
private static Set<String> columnsAfter(int notificationDepth) throws Exception {
try (JpaPlatformContractSupport server = JpaPlatformContractSupport.start()) {
List<String> statements = new ArrayList<>();
statements.add(read("jpa/core", "V1__initialize_or_adopt.sql"));
statements.add(read("jpa/core", "V2__widen_capability_schema_stream.sql"));
for (int index = 0; index < notificationDepth; index++) {
statements.add(read("jpa/notification-platform", NOTIFICATION.get(index)));
}
try (Connection connection = server.connection();
Statement statement = connection.createStatement()) {
for (String sql : statements) {
statement.execute(sql);
}
}
return notificationColumns(server);
}
}
private static Set<String> notificationColumns(JpaPlatformContractSupport server)
throws SQLException {
TreeSet<String> columns = new TreeSet<>();
try (Connection connection = server.connection();
Statement statement = connection.createStatement();
ResultSet rows =
statement.executeQuery(
"select table_name || '.' || column_name from information_schema.columns"
+ " where table_schema = 'public' and table_name like 'notification%'"
+ " order by 1")) {
while (rows.next()) {
columns.add(rows.getString(1));
}
}
return columns;
}
private static String read(String stream, String fileName) throws IOException {
try (InputStream resource =
AnalysisNotificationLadderProbe.class
.getClassLoader()
.getResourceAsStream("db/migration/" + stream + "/" + fileName)) {
if (resource == null) {
throw new IOException("missing " + fileName);
}
return new String(resource.readAllBytes(), StandardCharsets.UTF_8);
}
}
}