Skip to content

Conformance

The Java and Go frameworks are meant to be interchangeable to the platform and to each other: the same outbox rows, ids, configuration semantics and framework tables, so a Go service can take over a Java service’s database. The specifications say what that means in prose. The conformance vectors say it in files.

A vector is an input and an expected output, kept in the conformance/ directory at the root of the framework repository. Both implementations read the same files.

The Java framework is the reference. Each Java module has a vector test that runs the Java code on every input in its files and compares the result with the committed expected output. Run with -Dconformance.update=true, the same test writes the file instead:

./mvnw -q verify -Dconformance.update=true # rewrite every vector
git diff conformance/ # review the change, then commit

The Go tests only compare. From the go/ directory, go test ./internal/conformance/ runs the shared runner; other packages (for example httpfw/spa, push, ui/i18n) read their own vectors. A Go mismatch therefore means Go is wrong, or the vector exposes a Java bug, which is fixed in Java first.

flowchart LR
  J[Java module test] -- "-Dconformance.update=true" --> V[(conformance/*.json, sql, lua)]
  V -- compares --> JT[Java tests in CI]
  V -- compares --> GT[Go tests in CI]
  • JSON values (payloads, rows) are compared as parsed values. Key order and whitespace are free; values are exact. A JSON document carried inside a string (an event’s data, an audit row’s operationData) is parsed and compared the same way.
  • Text files under sql/ and lua/ are compared as exact bytes: they are the statements and scripts both implementations send to the server. They have no trailing newline.
  • OpenAPI documents under openapi/ are compared as exact bytes too.
  • Generated values are pinned: vectors use fixed clocks and fixed ids. Where a value cannot be pinned, the vector says how it is checked.
  • Newer vectors open with description (the setup and how to read each expect) and howToRun (what a runner in another language does with a case). Where Java’s wording of an error is not part of the contract it is recorded as messageJava and is not compared.
  • An allowed difference is recorded in the vector with a reason, so every difference between the implementations is deliberate and visible.
Directory Covers
tsid/ TSID decoding, canonical encoding, prefixes, the millisecond layout
config/ environment names, value parsing, whole scenarios (sources in order, every problem, collisions)
sql/locks/, lua/locks/, migrations/ the lock statements and scripts, and the fw_schema_history rows a migration set writes
sql/outbox/, outbox/ the outbox INSERT and the rows stored for events, dispatch jobs, audit entries and PUSH rows
usecase/ runner scenarios: phase trace, result, events, audits, rows, conflicts and joined runs
settings/ per-client settings
ratelimit/ GCRA decisions and the rate-limit middleware (the 429 envelope and headers)
receivers/, flowcatalyst/ the receiver signature gate, dispatch and scheduled-job endpoints, the context a handler receives, the targetUrl the sync sends
http/, openapi/ the SPA fallback; OpenAPI documents
auth/, field/ sign-in failure navigation; field access tokens and DPoP proofs
admin/ navigation, configuration and platform-read sections of the admin shell
push/ topics, tickets, the stream’s exact bytes, replay and reset (written by hand for Go)
i18n/ catalog lookup, plurals, locale resolution
objectstore/ key rules
measure/ the ISO 4217 and unit tables, decimal arithmetic, every rounding mode, money allocation, unit conversions, packaging, pricing, error codes
  1. Add the input to the file, or a new file, with a Java test that fills it.
  2. Run the Java module’s tests in update mode, review the output, and commit both.
  3. Make the Go test pass. If the vector shows Go is wrong, fix Go; if it shows a Java bug, fix Java first and rewrite the vector.

Because the vectors are the shared truth, a behaviour change in the reference has to arrive as a vector change in the same commit. That is how the two implementations stay interchangeable rather than merely similar.

The normative description of each area is its specification.