Preserve release identity in records and receipts

This commit is contained in:
2026-12-05 21:34:51 +00:00
parent bbee996f84
commit 697ab32715
20 changed files with 343 additions and 44 deletions

View File

@@ -233,9 +233,8 @@ output directory are invalidated; no new receipt is written. An
empty target list returns the source commit without building or writing a
receipt.
The current receipt format supports the legacy prefixed SemVer module identity.
For other source identities, use the Go `Build` API until receipt support is
updated.
The current receipt format carries the selected source and release identity;
receipts from older formats must be regenerated with `build`.
The command returns status 0 on completion, 1 for build or output failure, and
2 for usage, profile, or invalid-version errors. It builds the current source

View File

@@ -137,12 +137,13 @@ RELEASEKIT_GITEA_TOKEN="$GITEA_TOKEN" releasekit deliver --assets dist v1.2.3
The build command does not need delivery credentials. The `--assets DIR`
directory must contain the private `.releasekit-build.json` receipt created by
`build`. ReleaseKit checks its schema, repository, commit, version, resolved
module directory and path, full tag, normalized build settings, and artifact
declarations. Old receipts must be regenerated with the updated `build`
`build`. ReleaseKit checks its schema, repository, commit, source selection,
identity kind, version, module directory and path, full tag, normalized build
settings, and artifact declarations. Old receipts must be regenerated with the updated `build`
command. Delivery verifies the artifact bytes and sizes after read-only
preflight and before any hosted write; caller-owned files remain available for
retries.
retries. See the [receipt format](../integrations/build-receipts.md) for its
identity and compatibility rules.
Ordinary `deliver` does not download application dependencies or change the
checkout.

View File

@@ -0,0 +1,22 @@
# Build receipts
The CLI writes a private `.releasekit-build.json` receipt after a successful
nonempty build. It lets a later `deliver --assets` invocation bind the retained
files to the selected source and release identity. The
[delivery guide](../consumers/delivery.md) describes the workflow and ownership
of those files.
The current receipt uses `schema_version: 2`. Its identity includes the
repository and physical source directories, repository-relative source scope,
Go capability and module identity, publication mode, version format and prefix,
identity kind, exact version, full tag, production note path when applicable,
and captured commit. It also records source verification, compiler and build
settings, output directory, targets, artifact paths, filenames, and SHA-256
digests. A diagnostic identity has a diagnostic version and tag rather than a
production note path.
Readers accept additive unknown fields in schema 2. Older or unsupported
schemas require a new build and receipt. Loading a receipt checks its structure
and declared identity; delivery verifies the selected source and actual artifact
bytes before making hosted writes. A receipt is local coordination evidence, not
a source attestation.

View File

@@ -13,9 +13,17 @@ Each saved attempt is one complete JSON document with this versioned envelope:
```json
{
"format_version": 1,
"format_version": 3,
"evidence": {
"repository_dir": "/work/project",
"source_dir": "/work/project",
"source_subdir": ".",
"go_enabled": true,
"publication_mode": "go-module",
"version_format": "semver",
"version_prefix": "v",
"identity_kind": "production",
"note_path": "docs/releases/v1.2.3.md",
"module_dir": "/work/project",
"module_path": "example.com/project",
"version": "v1.2.3",
@@ -34,20 +42,20 @@ stopped before they were captured; loading preserves that partial evidence and
does not fill fields from the current checkout. Additional fields in a
supported version are ignored. A missing or unsupported version, malformed or
multiple JSON documents, or fields with invalid structural types are reported
as record-format errors. The codec supports versions 1 and 2; no migration from
as record-format errors. The codec reads versions 1, 2, and 3; no migration from
an unsupported version is performed.
Ordinary UTF-8 evidence uses version 1. Evidence containing other pathname or
endpoint bytes uses version 2 with the same `evidence` object and an additional
`evidence_bytes` object. Each entry in `evidence_bytes` uses an evidence field
New records use version 3, including source and selection evidence. Legacy
versions 1 and 2 retain only the evidence they captured. Version 2 and version 3
may include an `evidence_bytes` object for non-UTF-8 string values. Each entry
in `evidence_bytes` uses an evidence field
name and a standard base64 string containing its exact bytes. That entry
supplies the field's value when loading; the writer omits its lossy string form
from `evidence`. Invalid known-field types or base64 encodings produce a
record-format error with the available decoding cause. Unknown field names are
ignored. This representation applies
to every evidence field and preserves the same identity as typed Go evidence.
Older CLIs that support only version 1 report an unsupported version for these
byte-containing records; use a CLI supporting version 2 to load them.
to string evidence fields and preserves the same identity as typed Go evidence.
Older CLIs report an unsupported version for records they cannot read.
The `endpoint` value is stored exactly as captured and may contain credentials.
Private records are sensitive. Do not copy them into public logs or source
@@ -65,7 +73,8 @@ not private attempt records or a Go serialization of public structs.
was read. Available `observed_tag_object` and `observed_commit` fields are
included when present. A `diagnostic` is included for unresolved observation
or record loading failure. Loading failure omits evidence, state, and observed
IDs.
IDs. Safe evidence may include source, capability, publication, and version
selection fields when those were captured.
`publication-attempts` includes `record_dir`, an `attempts` array with each
`record_path` and safe `evidence`, and a `diagnostics` array. A top-level

View File

@@ -229,6 +229,13 @@ and existing cancellation, cleanup, partial-upload, and immutable-retry tests.
## Stage 5: Update identity evidence and publication recovery
**Completed:** Publication records write format 3 and retain legacy readers;
build receipts carry and bind the complete selected identity. Source-only
recovery works after the publishing process exits. Calendar and diagnostic
receipts, exact evidence bytes, recovery, the offline `go test ./...` suite,
and `go run ./internal/apicheck` pass. The committed-pin bootstrap is implemented
in Stage 8.
**Work:** update facade evidence, CLI receipts, publication codecs, recovery
handoffs, and their integration references.