Package com.egoge.ai.atlas.plugin
Class ReleaseSnapshots
java.lang.Object
com.egoge.ai.atlas.plugin.ReleaseSnapshots
Releases the accepted contract as an immutable snapshot,
<releases>/<version>/, and
verifies a build's contract against one already released. The engine behind the Gradle plugin's
agenticRelease and agenticReleaseVerify; it reads and writes only the files it is
given, with no network, database or model call, and writes no timestamp, host or path.
A release directory holds:
- "api.ir.json": the accepted baseline, byte for byte, which the build's IR must equal;
openapi-v<major>.json, the OpenAPI document of the released major, when generated;- "mcp-tools.json", when generated;
- "contract-diff.json": the comparison with the previous release, in the gate's form;
- "CHANGELOG.md": the release's changelog section;
- "release.json": the
ReleaseManifest, with a SHA-256 of every other file.
irVersion it was written with; IrJson.read(java.nio.file.Path) migrates an
older one in memory, so released files never change when ai-atlas is upgraded.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA release made.static final classA release that cannot be made, or a released snapshot that fails verification.static final recordWhat to release. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe release's changelog section.static final StringThe comparison with the previous release, in the gate'scontract-diff.jsonform.static final StringThe released Contract IR, byte-identical to the accepted baseline.static final StringThe release manifest.static final StringThe MCP tool specifications, whenai.atlas.constraintsgenerated them. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringopenApiFile(int apiMajor) The file name of a major's OpenAPI document in a release.static ReleaseSnapshots.Outcomerelease(Path releases, Path changelog, ReleaseSnapshots.Request request) Releases the accepted contract to<releases>/<version>/, then regenerates the aggregate changelog.static Stringsha256(byte[] bytes) The lowercase hexadecimal SHA-256 ofbytes.static voidverifyBuild(Path releases, Path changelog, String version, byte[] emittedIr, Map<String, byte[]> artifacts, String contractResourcesJson) Verifies the release history's internal consistency, and thatversion's release is exactly what the build produced (E2, D8.2, plan §3.5 step 6, OQ-4): the IR canonically equal, every snapshotted artifact byte for byte, the same set of snapshotted files present in both (naming an artifact the build produces the release does not, or the reverse), and the releasedcontractResources.configurationstructurally equal to the build's effective configuration.
-
Field Details
-
IR_FILE
The released Contract IR, byte-identical to the accepted baseline.- See Also:
-
DIFF_FILE
The comparison with the previous release, in the gate'scontract-diff.jsonform.- See Also:
-
CHANGELOG_FILE
The release's changelog section.- See Also:
-
MANIFEST_FILE
The release manifest.- See Also:
-
MCP_TOOLS_FILE
The MCP tool specifications, whenai.atlas.constraintsgenerated them.- See Also:
-
-
Method Details
-
openApiFile
The file name of a major's OpenAPI document in a release.- Parameters:
apiMajor- the major- Returns:
openapi-v<major>.json
-
release
public static ReleaseSnapshots.Outcome release(Path releases, Path changelog, ReleaseSnapshots.Request request) throws ReleaseSnapshots.ReleaseException, IOException Releases the accepted contract to<releases>/<version>/, then regenerates the aggregate changelog. Nothing is written when the release fails. The release directory is written to a temporary sibling and moved into place in one step.- Parameters:
releases- the directory of releaseschangelog- the aggregate changelog to regeneraterequest- what to release- Returns:
- the release made
- Throws:
ReleaseSnapshots.ReleaseException- if the version is not a release version or is already released, the build's IR is not the accepted baseline, a released snapshot fails verification, the version or major goes backwards, or the policy failsIOException- if a file cannot be read or written
-
verifyBuild
public static void verifyBuild(Path releases, Path changelog, String version, byte[] emittedIr, Map<String, byte[]> artifacts, String contractResourcesJson) throws ReleaseSnapshots.ReleaseException, IOExceptionVerifies the release history's internal consistency, and thatversion's release is exactly what the build produced (E2, D8.2, plan §3.5 step 6, OQ-4): the IR canonically equal, every snapshotted artifact byte for byte, the same set of snapshotted files present in both (naming an artifact the build produces the release does not, or the reverse), and the releasedcontractResources.configurationstructurally equal to the build's effective configuration. Reads no git;agenticReleaseVerifyproves the tag andHEADseparately, in the plugin.- Parameters:
releases- the directory of releaseschangelog- the aggregate changelog, checked byReleaseSnapshotHistory.checkConsistency(java.nio.file.Path, java.nio.file.Path)version- the version the build claims to be,MAJOR.MINOR.PATCHemittedIr- the IR the build emitted, or the empty document when it declares nothingartifacts- the build's snapshotted artifacts (ContractResources.snapshotted), keyed by snapshot file name, the IR included under "api.ir.json"contractResourcesJson- the build's class output's contract-resources manifest, verbatim- Throws:
ReleaseSnapshots.ReleaseException- if the history is inconsistent, the version is not released, or the build differs from its release, each naming the differenceIOException- if a file cannot be read
-
sha256
The lowercase hexadecimal SHA-256 ofbytes.- Parameters:
bytes- the content- Returns:
- 64 hexadecimal digits
-