Aegis Gateway 2.0

Two gateway processes sharing one PostgreSQL namespace

Scope and classification

On 2026-10-03 the working tree reportedly ran TwoGatewayProcessesPostgresIT (aegis-gateway/src/test/java/.../TwoGatewayProcessesPostgresIT.java) against a real PostgreSQL 17.6 server on the validating workstation. This is historical recorded-unattested evidence: the exact command and outcome were recorded, but no immutable raw Surefire output, process logs, commit/tree manifest, or content-addressed archive was retained.

The test starts two own-host gateways as separate JVMs with io.github.vaquarkhan.aegis.gateway.Main --config replica-<x>.json, the same way an operator runs two replicas. Both configurations name the same gateway, signing key, and state.type: postgres namespace. Each replica keeps its own audit journal. The only path between the two processes is the PostgreSQL database.

The backend is a local JDK HttpServer that counts reads and deletes. It stands for a product API; the subject under test is the shared governance state, so the counter records whether the call reached the backend.

Server

Item Value
Server PostgreSQL 17.6, EDB Windows x64 binaries zip (select version(): PostgreSQL 17.6 on x86_64-windows, compiled by msvc-19.44.35213, 64-bit)
Zip SHA-256 D378882ABD001A186735ACD6F6BA716BCA6CCD192E800412D4FD15ED25376B3E
Listen 127.0.0.1:55432, password authentication, database aegis_state, role aegis
Tables after the run aegis_state, aegis_window (created by aegis-state-postgres)
Rows left in it-two-replicas-* namespaces 0 (the test deletes its namespace afterwards)

Command

$env:AEGIS_POSTGRES_URL = "jdbc:postgresql://127.0.0.1:55432/aegis_state"
$env:AEGIS_POSTGRES_USER = "aegis"
$env:AEGIS_POSTGRES_PASSWORD = "<local password>"
C:\tools\apache-maven-3.9.11\bin\mvn.cmd -B -Ppostgres-integration -pl aegis-gateway -am install `
  "-Dtest=TwoGatewayProcessesPostgresIT" "-Dsurefire.failIfNoSpecifiedTests=false" "-Djacoco.skip=true"

Reported result: Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, BUILD SUCCESS. Without the three environment variables the test is reported as skipped, never as passed.

What the historical run reportedly showed

Step Replica Observed
Dry run of the DESTRUCTIVE delete_item A receipt and approval request issued; backend deletes = 0
Approver approves the request B HTTP 200; B can only find the request through PostgreSQL
Operator collects the approval token A HTTP 200 with the token
Approved call with token and receipt B ALLOWED; backend deletes = 1
Same token and receipt replayed A APPROVAL_REQUIRED, reason “already been used”; backend deletes still 1
Four list_items calls alternating A, B, A, B with perCallerPerToolPerMinute: 3 A and B ALLOWED, ALLOWED, ALLOWED, RATE_LIMITED; backend reads = 3
AuditChainVerifier on both journals A and B both chains intact

Evidence boundary

The reported run covered shared approvals, single-use approval and receipt nonces, signed serial high-water state, and rate windows across two processes using one PostgreSQL namespace. Catalog files and pins remain process-local inputs, while signed serial high-water marks are stored in the configured shared state store. Circuit-breaker state remains process-local, and each replica writes its own journal.

It did not cover PostgreSQL replication, failover, backup restore, TLS to the database, or behavior under a network partition. Relevant code has changed since 2026-10-03. Re-run on the exact release candidate and retain raw artifacts before making a current claim.