Run validation in the selected module
This commit is contained in:
@@ -27,8 +27,9 @@ version must be stable `vMAJOR.MINOR.PATCH`. The committed
|
||||
product name and exact version as complete title elements. No local tag with
|
||||
that version may already exist.
|
||||
|
||||
ReleaseKit runs one `go test -mod=readonly -count=1 ./...` suite with the
|
||||
available compatible local Go toolchain. Set `Validation.Go.Race` to run that
|
||||
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
|
||||
`go vet -mod=readonly ./...` after successful tests, with test-time vet disabled
|
||||
for the suite. Set `Validation.Go.CompileTargets` to compile packages for each
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
# Go command environments
|
||||
|
||||
`internal/gotool` resolves effective Go settings once for a validation or build
|
||||
operation and applies the shared environment to its Go commands. It uses
|
||||
`internal/gotool` resolves effective Go settings when an operation first needs
|
||||
a Go command and applies the shared environment to its commands. Candidate
|
||||
validation and its build callback share an operation-local owner while the
|
||||
inherited environment and persistent Go settings file remain unchanged.
|
||||
Standalone and delivery builds create their own owners. The package uses
|
||||
`internal/process` for cancellation, the working directory, output, and wrapped
|
||||
errors.
|
||||
|
||||
@@ -35,9 +38,10 @@ uses the same ownership transfer when formatting a failure.
|
||||
|
||||
## Configuration discovery
|
||||
|
||||
The owner asks the installed `go` command for `GOHOSTOS` and `GOHOSTARCH`, then
|
||||
queries effective operational settings with that host selected. Both queries
|
||||
use `GOTOOLCHAIN=local` and controlled `GOFLAGS`. Discovery sets
|
||||
The owner asks the installed `go` command for `GOHOSTOS`, `GOHOSTARCH`, and the
|
||||
`GOENV` settings-file path, then queries effective operational settings with
|
||||
that host selected. Both queries use `GOTOOLCHAIN=local` and controlled
|
||||
`GOFLAGS`. Discovery sets
|
||||
`GOEXPERIMENT=none` and clears architecture feature variables so an invalid or
|
||||
nonbaseline tuning value cannot prevent settings from being read. The
|
||||
experiment override is discovery-only.
|
||||
@@ -48,6 +52,11 @@ and native cgo/C-tool configuration into its settings. This captures values
|
||||
supplied by either the process environment or the persistent Go environment
|
||||
file.
|
||||
|
||||
The operation-local owner snapshots the inherited environment and selected
|
||||
settings file. It reuses the resolved tool across validation and its following
|
||||
build callback while those inputs match, and rediscovers after a consumer
|
||||
callback changes either input. It does not cache settings across operations.
|
||||
|
||||
Configuration discovery parses JSON from stdout. Stderr is captured separately
|
||||
and included in command-failure diagnostics, so a successful query can emit
|
||||
warnings while supplying valid configuration.
|
||||
@@ -69,9 +78,10 @@ baseline values. Effective `GOCACHE`, `GOCACHEPROG`, `GOMODCACHE`, `GOPATH`,
|
||||
`GOROOT`, and `GOTMPDIR` values are retained. Other process variables remain
|
||||
available to child commands.
|
||||
|
||||
Candidate validation uses native mode for the offline `go test` suite and
|
||||
selected full `go vet` pass. Package-compilation checks use static mode for each
|
||||
selected target and direct Go's output to the operating system null device, so
|
||||
they leave no binary artifact. Artifact builds also use static mode for
|
||||
selected-target compilation, then build the native version-check executable;
|
||||
that executable runs as a normal child process.
|
||||
Candidate validation runs the offline `go test` suite and selected full
|
||||
`go vet` pass from the selected module directory using native mode.
|
||||
Package-compilation checks use static mode for each selected target and direct
|
||||
Go's output to the operating system null device, so they leave no binary
|
||||
artifact. Artifact builds also compile selected targets in static mode, then
|
||||
build the native version-check executable, which runs as a normal child
|
||||
process.
|
||||
|
||||
@@ -42,7 +42,7 @@ reports these implemented packages:
|
||||
| `internal/delivery` | Tagged-source and release-note checks, managed builds in disposable storage outside the checkout, structural artifact declaration, manifest assembly, one local digest-and-size preflight before hosted requests, and delivery coordination. |
|
||||
| `internal/git` | Git command boundary, committed-tree reads, lazy local-only batched blob reads, push-destination resolution, exact ref inspection, tagged checkout preparation, and tag operations, including captured-endpoint verification during recovery. |
|
||||
| `internal/gitea` | Gitea API transport, hosted release pages, asset inspection, manifests, and uploads. |
|
||||
| `internal/gotool` | Effective Go configuration discovery, shared native-validation and static-build environments, and network-capable dependency preparation; see [Go command environments](gotool.md). |
|
||||
| `internal/gotool` | Operation-local Go configuration discovery and reuse, shared native-validation and static-build environments, and network-capable dependency preparation; see [Go command environments](gotool.md). |
|
||||
| `internal/tempdir` | Disposable system temporary storage outside source worktrees. |
|
||||
| `internal/process` | Cancellable child-process execution, including owned stdin/stdout pipes for serialized exchanges, with per-command environment overlays and removals. |
|
||||
| `internal/preparation` | Coordination for expected-commit tag checkout and Go module dependency preparation. |
|
||||
@@ -61,10 +61,11 @@ also recorded in [ADR 0001](../adr/0001-public-facade.md) and the
|
||||
|
||||
Candidate checking captures and validates one clean committed source revision
|
||||
in `internal/candidate`. Its validation bridge calls `internal/validation` for
|
||||
the default offline Go suite, then runs product-specific checks once. The
|
||||
candidate package owns post-validation builds and local-state rechecks;
|
||||
publication owns endpoint guards, tag creation, push, and recovery around that
|
||||
same candidate validation path. `internal/validation.CandidateTree` reads
|
||||
the selected module's default offline Go suite, then runs product-specific
|
||||
checks once. Validation and its post-validation build callback share one local
|
||||
Go settings owner; the candidate package owns those builds and local-state
|
||||
rechecks; publication owns endpoint guards, tag creation, push, and recovery
|
||||
around that same candidate validation path. `internal/validation.CandidateTree` reads
|
||||
committed blobs lazily and resolves local destinations from committed entries;
|
||||
it does not consult neighboring files or traverse submodule checkouts.
|
||||
See the [shared validation guide](validation.md) for checker, Go command, and
|
||||
@@ -81,7 +82,7 @@ not a separate release matrix:
|
||||
| Candidate capture, shared validation, public diagnostics, additional checks, and rechecks | `releasekit.Check`, `releasekit.Publish`, `internal/candidate`, `internal/validation`, `cmd/releasekit/internal/cli` | `TestRunUsesOneSuiteWithSelectedRaceSetting`, `TestRunReportsRacePrerequisiteFailureWithoutFallback`, `TestRunExecutesRaceEnabledSuiteOnHost`, `TestRunCompilesTargetsAfterTestAndVetInSelectionOrder`, `TestRunAttributesTargetCompileFailureAndStops`, `TestRunCompilesSourceOnlyAndExecutablePackagesWithoutArtifacts`, `TestCandidateRequestMapsGoValidation`, `TestCandidateRequestPreservesMarkdownObjectSelection`, `TestLoadSettingsReadsGoValidation`, `TestLoadSettingsPreservesMarkdownObjectSelection`, `TestCheckUsesSelectedRaceSuiteBeforeAdditionalChecks`, `TestCheckCapturesCandidateAndCallsAdditionalChecksOnce`, `TestCheckReturnsPublicValidationError`, `TestMarkdownValidationRunsThroughCheckAndPublish`, `TestCheckStopsBeforeProductAndBuildCallbacksWhenMarkdownBoundaryFails`, `TestCheckCommandBindsConfiguredChecksToCapturedCandidate`, `TestPublishCommandPublishesConfiguredCandidate`, `TestCandidateCommandsPresentValidationDiagnosticsOnce`, `TestDeliverPageOnlyCreatesAndReusesRelease` |
|
||||
| Committed-file validation: formatting, workspace files, local replacements, and file size | `internal/validation`, `internal/candidate`, `releasekit.Check`, `releasekit.Publish`, CLI profile conversion | `TestCheckGoFormatUsesCapturedRegularGoBlobs`, `TestCheckWorkspaceFilesReportsCommittedBlobNames`, `TestCheckLocalReplacementsParsesCommittedModuleDeclarations`, `TestCheckLocalReplacementsFollowsCommittedModuleSymlinks`, `TestCheckFileSizeUsesStrictLimitsAndDefault`, `TestCheckFileSizeAppliesLiteralPathExclusions`, `TestCheckFileSizeUsesCommittedBlobSizes`, `TestCheckFileSizeUsesOnlyCandidateFilesIndividually` |
|
||||
| Internal Markdown parsing, committed destinations, fragments, boundary observations, and public selection | `releasekit.Check`, `releasekit.Publish`, `internal/candidate`, `internal/validation`, `cmd/releasekit/internal/cli` | `TestParseMarkdownLinksAndSourceLocations`, `TestParseMarkdownDecodesEntitiesInDestinations`, `TestParseMarkdownHeadingAnchors`, `TestMarkdownCacheKeepsParsedDocumentsPerCandidatePath`, `TestCheckMarkdownLinksResolvesCommittedDestinationsAndFragments`, `TestCheckMarkdownLinksReportsMissingPathsAnchorsAndCycles`, `TestCheckMarkdownLinksUsesResolvedMarkdownIdentity`, `TestCheckMarkdownLinksReportsBoundaryAndSubmoduleObservations`, `TestCheckMarkdownLinksPreservesResolverCauseAndCancellation`, `TestCheckMarkdownLinksPreservesAnchorReadCause`, `TestRunSelectsMarkdownWithCombinedGoChecksAndReportsOutOfScopeLinks`, `TestMarkdownValidationRunsThroughCheckAndPublish`, `TestLoadSettingsPreservesMarkdownObjectSelection`, `TestValidationSpecPreservesMarkdownObjectSelection` |
|
||||
| Shared Go settings for validation and builds | `internal/gotool`, `internal/process`, `internal/candidate`, `internal/build` | `TestDefaultValidationDoesNotInheritGOFLAGSRunFilter`, `TestNativeAndStaticCommandsUseOwnedBaseline`, `TestPersistentSettingsPreserveCachesAndNativeCTools`, `TestBuildIgnoresAmbientAndPersistentArchitectureTuning` |
|
||||
| Shared Go settings for validation and builds | `internal/gotool`, `internal/process`, `internal/candidate`, `internal/build` | `TestDefaultValidationDoesNotInheritGOFLAGSRunFilter`, `TestNativeAndStaticCommandsUseOwnedBaseline`, `TestPersistentSettingsPreserveCachesAndNativeCTools`, `TestOwnerReusesSettingsUntilInheritedEnvironmentChanges`, `TestOwnerRefreshesWhenPersistentSettingsChange`, `TestCheckSharesGoDiscoveryWithAfterValidateCallback`, `TestCheckBuildsAfterValidationAndKeepsOutputOutsideWorktree`, `TestRunValidatesOnlyTheSelectedModule`, `TestBuildIgnoresAmbientAndPersistentArchitectureTuning` |
|
||||
| Batched local Git blob reads | `internal/git`, `internal/process` | `TestBlobReaderReadsLooseAndPackedObjects`, `TestBlobReaderMissingObjectKeepsBatchSessionUsable`, `TestCandidateObjectReadsStayLocalInPartialClones` |
|
||||
| Piped child-process exchanges and cancellation cleanup | `internal/process` | `TestStartPipedExchangesBeforeInputEOFAndPreservesSettings`, `TestStartPipedCancellationAfterReadinessReapsChild`, `TestStartPipedPreservesNonzeroExit` |
|
||||
| Authoritative endpoint and exact annotated tag publication | `releasekit.Publish`, `internal/publish`, `internal/git` | `TestPublishPushesOnlyTheCapturedAnnotatedTag`, `TestPublishRejectsUnexpectedPushURLBeforeValidation`, `TestPublishComparesExpectedURLWithResolvedInsteadOfDestination`, `TestPublishExpectedPushURLUsesPushURLWhenFetchAndPushDiffer`, `TestCheckIgnoresExpectedPushURL`, `TestResolveUsesPushURLAndQueriesWithoutMutation` |
|
||||
|
||||
@@ -8,15 +8,16 @@ post-validation build callback and local-state recheck. `internal/publish`
|
||||
adds its endpoint guards, tag creation, push, and recovery around that same
|
||||
candidate path.
|
||||
|
||||
The executor runs one offline Go suite, optionally with the race detector when
|
||||
selected. When full vet is selected, it disables test-time vet for that suite
|
||||
and runs native `go vet -mod=readonly ./...` after the suite succeeds. It then
|
||||
runs `go build -mod=readonly -o <os.DevNull> ./...` in static mode for each
|
||||
selected package-compilation target, preserving target order and stopping on
|
||||
the first failure. This compiles source without producing an artifact or
|
||||
executing a target binary. Test, vet, and package-compilation failures retain
|
||||
their `go-test`, `go-vet`, and `package-compile` identities, selected target
|
||||
where applicable, and underlying causes. Its
|
||||
The executor runs one offline Go suite from the captured module directory,
|
||||
optionally with the race detector when selected. When full vet is selected, it
|
||||
disables test-time vet for that suite and runs native
|
||||
`go vet -mod=readonly ./...` from the same directory after the suite succeeds.
|
||||
It then runs `go build -mod=readonly -o <os.DevNull> ./...` there in static mode
|
||||
for each selected package-compilation target, preserving target order and
|
||||
stopping on the first failure. This compiles source without producing an
|
||||
artifact or executing a target binary. Test, vet, and package-compilation
|
||||
failures retain their `go-test`, `go-vet`, and `package-compile` identities,
|
||||
selected target where applicable, and underlying causes. Its
|
||||
request carries the captured repository directory and commit, output writer,
|
||||
and internal settings. When selected, the Go-format check loads the candidate
|
||||
tree once, reads regular Go blobs from the captured commit, and compares them
|
||||
|
||||
@@ -371,6 +371,18 @@ suite and reused discovery in an unchanged validation/build operation; changing
|
||||
environment inputs through an additional callback triggers fresh settings.
|
||||
Run Go-tool, validation, and candidate coordination tests.
|
||||
|
||||
**Completed:** Go validation commands now run from the captured module
|
||||
directory. Candidate checks and publication share a lazy operation-local Go
|
||||
settings owner with their later build callbacks; standalone and managed delivery
|
||||
builds acquire separate owners. The owner reuses discovery while the inherited
|
||||
environment and selected `GOENV` file stay unchanged, and refreshes after
|
||||
consumer callbacks when either changes. Nested-module fixtures now include
|
||||
packages for selected-module validation. Verified one suite and shared discovery
|
||||
through candidate build coordination, environment and persistent-file refresh,
|
||||
nested-suite failure and sibling isolation, selected vet/compile command
|
||||
directories and compile baseline, `go test ./...`, and
|
||||
`go run ./internal/apicheck`.
|
||||
|
||||
## Stage 7: Build the selected module and bind output evidence
|
||||
|
||||
**Outcome:** Standalone and composite builds use the correct declaration source,
|
||||
|
||||
Reference in New Issue
Block a user