Validate and publish source-only candidates

This commit is contained in:
2026-12-05 21:05:56 +00:00
parent 0f9923d230
commit 3b925231d5
18 changed files with 291 additions and 56 deletions

View File

@@ -27,7 +27,7 @@ version. The repository argument defaults to the current directory. ReleaseKit
resolves its containing Git checkout root before selecting the module or profile;
the profile defaults to `<repository-root>/releasekit.json`. A successful command prints the
captured module, version, full tag, and commit. It checks the committed release note and
local Git state, runs the standard offline Go test suite (with `-race` when
local Git state, runs the standard offline Go test suite when Go is selected (with `-race` when
`validation.go.race` is true), and runs a separate `go vet -mod=readonly ./...`
pass after successful tests when `validation.go.full_vet` is true. It then runs
selected package compilation and committed Go formatting, followed by
@@ -37,11 +37,12 @@ availability or publish a tag.
The profile's optional `module_dir` selects a repository-relative physical
module directory; omission selects the root module. Validation and configured
product checks use that module selection. Additional check commands run with
the selected module as their working directory and receive
the selected source as their working directory and receive
`RELEASEKIT_VERSION`, `RELEASEKIT_CANDIDATE`, `RELEASEKIT_REPOSITORY_DIR`,
`RELEASEKIT_MODULE_DIR`, `RELEASEKIT_MODULE_PATH`, and `RELEASEKIT_TAG` in their
`RELEASEKIT_SOURCE_DIR`, `RELEASEKIT_MODULE_DIR`, `RELEASEKIT_MODULE_PATH`, and `RELEASEKIT_TAG` in their
environment. These values are added to each child environment without changing
the ReleaseKit process environment.
the ReleaseKit process environment. Module values are empty for source-only
selections.
When `validation.go.compile_targets` is selected, `check` compiles all packages
for each configured `GOOS/GOARCH` pair after tests and full vet, using static
@@ -82,7 +83,7 @@ go run ./cmd/releasekit publish [--repo DIR] [--config FILE] [--expected-module
`publish` reads the same product, remote, validation, and additional-check
settings as `check`. It checks the authoritative remote and validates the
candidate: the single standard offline Go test suite runs first, with `-race`
candidate: when Go is selected, the standard offline Go test suite runs first, with `-race`
when `validation.go.race` is true. When `validation.go.full_vet` is true,
test-time vet is disabled and `go vet -mod=readonly ./...` runs after successful
tests. Selected package compilation and committed Go formatting follow. The

View File

@@ -10,7 +10,11 @@ The current profile fields are:
| Field | Required | Behavior |
| --- | --- | --- |
| `product` | Yes | Product name used by release operations. |
| `module_dir` | No | Repository-relative physical Go module directory with its own `go.mod`; omission selects `.` (the repository root). |
| `module_dir` | No | Repository-relative physical directory; in the legacy model it selects a Go module and defaults to `.`. |
| `source` | No | Explicit source selection with optional `dir` and `tag_prefix`. |
| `go` | No | A non-null object selects Go capability in the explicit model. |
| `publication` | No | Explicit publication `mode`: `source` or `go-module`. |
| `version` | No | Explicit identifier `format` and `prefix`. |
| `remote` | No | Selected Git remote; defaults to `origin`. |
| `expected_push_url` | No | Exact effective push URL required by `publish`; ignored by local `check`. |
| `checks` | No | Ordered additional child commands, each with an argument vector and optional environment map. |
@@ -25,6 +29,22 @@ live either at `integrations/core` or `integrations/core/v2`, while both use the
same full release tag. Root-only profiles can omit `module_dir` and do not need
a module map.
When all four selection objects are absent or null, the legacy selection uses
Go module publication and prefixed stable semantic versions. Any non-null
selection object chooses the explicit model: `source.dir` defaults to `.` or
the supplied `module_dir`, `go` defaults to disabled, and `publication.mode`
defaults to `source`. If both directory fields are supplied they must resolve
to the same physical directory. Go module publication requires `go: {}`.
`version.format` defaults to `semver` and also accepts `date` and `year-month`;
`version.prefix` accepts `v` or an empty string, defaulting to `v` for SemVer
and empty for calendar formats. `source.tag_prefix` overrides the physical
source directory used as the source-tag prefix; an explicit empty string
selects an unprefixed tag. Go module publication requires prefixed SemVer and
rejects tag-prefix overrides that conflict with Go's module tag rules. The Go
facade's `Check` and `Publish` support these
selections; the current CLI version argument is restricted as described in the
[command reference](cli.md).
Each check requires a nonempty `args` array whose first element names the
executable. Arguments are passed directly to the child process; ReleaseKit does
not parse a shell command string. Select a shell explicitly when a check needs
@@ -45,9 +65,11 @@ exist in the candidate, even when no file checks are enabled. Paths are literal,
repository-relative files with no glob semantics and may select a file outside
the chosen module. ReleaseKit deduplicates them with module inputs by path. This
field does not enable any checks or expand Go test, vet, or package-compilation
scope. Automatic file inputs stop at independent nested-module boundaries;
vendored files remain included. Reference inspection can read destinations
elsewhere in the captured repository without adding them to those inputs.
scope. For Go selections, automatic file inputs stop at independent
nested-module boundaries; source-only selections treat nested `go.mod` files
as data. Vendored files remain included. Reference inspection can read
destinations elsewhere in the captured repository without adding them to those
inputs.
`validation.go.race` enables the race detector for the single standard Go test
suite. `validation.go.full_vet` runs a separate native `go vet` pass after that
suite succeeds; ReleaseKit disables test-time vet for that suite to avoid
@@ -59,6 +81,8 @@ This source compatibility check does not name or produce binaries, run a target
executable, or create an artifact manifest. Omitted or empty `compile_targets`
selects no package-compilation pass. When `full_vet` is omitted or false, the
test command keeps its existing vet behavior. These settings are independent.
For source-only selections, Go execution checks and nonempty build targets are
configuration errors; explicitly selected file checks remain available.
`validation.go_format` checks regular committed Go blobs with the Go formatter
used to build ReleaseKit. It uses the selected file inputs, including vendor and
explicit shared files, and ignores

View File

@@ -33,13 +33,23 @@ example, both `integrations/core/v2` and `integrations/core` can declare
`<module>/docs/releases/<version>.md`.
The repository must have a clean index and worktree on `main`, and the selected
version must be stable `vMAJOR.MINOR.PATCH`. The module-local committed
version must match the selected format. With the module shorthand it must be
stable `vMAJOR.MINOR.PATCH`. The module-local committed
`<module>/docs/releases/<version>.md` note must have a first Markdown H1 containing the
product name and exact version as complete title elements. No local tag with
the derived complete tag may already exist. Different modules may use the same
semantic version with distinct notes and tags.
ReleaseKit runs one `go test -mod=readonly -count=1 ./...` suite from the
For an explicit source release, set `Source` on the request. A zero-valued
`SourceSpec` selects the repository root without Go capability; `Dir` selects
a nested physical source directory. Set `GoEnabled` for Go checks, and select
`PublicationGoModule` only when distributing a Go module. `VersionFormat` and
`VersionPrefix` select the production identifier grammar. A source-only check
needs no `go.mod` or Go toolchain, and its automatic file inputs include nested
`go.mod` files as data. The candidate reports its source scope and selection;
module fields are empty when Go is disabled.
When Go is selected, ReleaseKit runs one `go test -mod=readonly -count=1 ./...` suite from the
selected module directory with the available compatible local Go toolchain.
Set `Validation.Go.Race` to run that
suite with `-race`; set `Validation.Go.FullVet` to run
@@ -93,9 +103,9 @@ standard suite, selected vet/format/distribution checks, or Markdown navigation
checks in `AdditionalChecks` or profile `checks`. Keep release-note rules and
consumer-specific assertions—such as tests of maintained examples—in those
product-owned checks.
The `Candidate` supplies both `RepositoryDir` and `ModuleDir`, plus the declared
`ModulePath`, semantic `Version`, and full `Tag`; use its module directory for
module-local product checks. ReleaseKit calls `AdditionalChecks` once after
The `Candidate` supplies `RepositoryDir` and `SourceDir`, plus optional module
fields, the selected `Version`, and full `Tag`; use its source directory for
source-local product checks. ReleaseKit calls `AdditionalChecks` once after
shared validation when supplied.
For local token files, set `Validation.ForbiddenFiles` to the repository-relative

View File

@@ -31,6 +31,9 @@ physical location. `Version` remains the stable semantic version. The note is
the note path but is removed from the tag prefix only when the module path ends
in `/v2`. `PublicationResult` returns the absolute `ModuleDir`, declared
`ModulePath`, complete `Tag`, and existing commit and tag-object evidence.
For general source publication, set `Source` as described in the
[candidate check guide](check.md#local-candidate-check). `PublicationResult`
also reports the selected source directory and capabilities.
The optional `ValidationSpec.SharedFiles` selects additional committed files
for enabled file checks. Its nil and empty-slice behavior is described in the
@@ -44,7 +47,7 @@ when fetch and push URLs differ. A mismatch fails preflight before Go validation
callbacks, or tag creation; detect it with
`errors.Is(err, releasekit.ErrUnexpectedPushURL)`. `Check` ignores this
publication-only field.
It runs one `go test -mod=readonly -count=1 ./...` suite with the available
When Go is selected, it runs one `go test -mod=readonly -count=1 ./...` suite with the available
compatible local Go toolchain. Set `Validation.Go.Race` to run that suite with
`-race`. Set `Validation.Go.FullVet` to run `go vet -mod=readonly ./...` after
successful tests, with test-time vet disabled for that suite. The zero values

View File

@@ -149,6 +149,13 @@ compatibility. Test diagnostic construction through its supported domain seam.
## Stage 3: Generalize committed candidate and publication checks
**Completed:** Candidate checking and publication use the captured source
identity, run Go execution checks only when selected, retain source-scoped file
checks, and pass source context to product commands. A temporary source-only
repository was checked and published to a local Git remote with Go unavailable;
targeted tests, the offline `go test ./...` suite, and `go run ./internal/apicheck`
pass.
**Work:** adapt `internal/candidate`, `internal/validation`, `internal/publish`,
the `Check`/`Publish` facade bridge, and configured child checks.