Synchronize deadline regression with source inspection

This commit is contained in:
2026-11-01 21:56:13 +00:00
parent 66f5884ab4
commit fcd2e57887
3 changed files with 41 additions and 11 deletions

View File

@@ -14,6 +14,14 @@ import (
releasekit "go.maximumdirect.net/releasekit"
)
// inspectionDeadlineContext models deadline expiration at the readiness signal,
// so unrelated setup time cannot consume the source-inspection test's deadline.
type inspectionDeadlineContext struct{ context.Context }
func (ctx inspectionDeadlineContext) Err() error {
return context.Cause(ctx.Context)
}
func TestBuildSourceInspectionCancellation(t *testing.T) {
const source = `package main
import("fmt";"os";"go.maximumdirect.net/releasekit/buildinfo")
@@ -58,7 +66,9 @@ exec "$INSPECT_GIT" "$@"
var ctx context.Context
var cancel context.CancelFunc
if tc.deadline {
ctx, cancel = context.WithTimeout(context.Background(), 3*time.Second)
parent, expire := context.WithCancelCause(context.Background())
ctx = inspectionDeadlineContext{parent}
cancel = func() { expire(context.DeadlineExceeded) }
} else {
ctx, cancel = context.WithCancel(context.Background())
}
@@ -93,10 +103,13 @@ exec "$INSPECT_GIT" "$@"
case <-ticker.C:
}
}
if !tc.deadline {
cancel()
cancel()
var result outcome
select {
case result = <-done:
case <-timer.C:
t.Fatal("build did not stop after source inspection interruption")
}
result := <-done
want := context.Canceled
if tc.deadline {
want = context.DeadlineExceeded

View File

@@ -340,8 +340,11 @@ or a companion root test file.
smoke-checked. Verify `errors.Is(err, context.Canceled)` and retention of
completed artifact paths/digests for the latter case.
4. Add one focused deadline-expiration variant with synchronized readiness and
a bounded wait. Verify `context.DeadlineExceeded`, rather than asserting an
exact killed-process error string. Join test goroutines and reap children.
a bounded wait. Trigger a test-controlled expiration context after Git signals
readiness, so repository/module setup cannot consume the inspection deadline.
Verify `context.DeadlineExceeded`, rather than asserting an exact killed-process
error string. Join test goroutines and reap children. Check the deadline case
with delayed unrelated setup as well as normal and race-enabled execution.
**Verification:** ordinary source-inspection Git errors retain their causes;
`SourceVerified` is not reported true after an interrupted build. Retain

View File

@@ -3,9 +3,9 @@
## Status and scope
The planned remediation was implemented against baseline `59bb074`. A
post-implementation review of `6796310` found two follow-up issues below;
remediation remains open until they are addressed. The implementation plan
records the original stage and validation evidence.
post-implementation review of `6796310` found two follow-up issues below.
Both are complete as recorded in their completion markers. The implementation
plan records the original stage and validation evidence.
This roadmap defines the desired behavior and scope for all three findings in
the [functional correctness audit](correctness.md) and all five findings in the
@@ -128,7 +128,7 @@ work and automated validation.
The review compared implementation commits `0632aa5` through `6796310` with the
agreed target and the plan at `730e638`. It examined production changes, new
regressions, current documentation, and the final package boundaries. The
following findings require follow-up; the other planned corrections are present.
following findings required follow-up; the other planned corrections were present.
### 1. Damaged checkout metadata can silently select standalone preparation
@@ -180,7 +180,15 @@ refinement; reproducing its algorithm alone is insufficient completion evidence.
### 2. The deadline regression starts its timeout before inspection readiness
**Priority:** low. **Status:** open.
**Priority:** low. **Status:** complete.
**Completion evidence:** the deadline variant now uses a test-controlled
expiration context triggered after the blocked Git inspection signals readiness.
The public initial/final cancellation cases, completed-artifact assertions, and
ordinary Git error-chain check remain in place; the result wait shares the
bounded watchdog. Focused source-inspection tests pass with the race detector.
The deadline case also passes normally and with `-race` under the same
four-second repository-discovery delay that reproduced the original failure.
**Code:** `TestBuildSourceInspectionCancellation/deadline` in
[build_source_cancellation_test.go](../../build_source_cancellation_test.go).
@@ -233,3 +241,9 @@ additional public types, configuration knobs, receipt changes, stronger page-onl
response requirements, or broader source/preflight guarantees introduced by the
implementation. The two findings concern incomplete realization of the agreed
behavior and regression reliability rather than an intentional scope expansion.
After the follow-up corrections, the complete offline `go test ./...` suite and
compiled `go run ./internal/apicheck` check pass. Focused discovery, dependency
preparation, and source-inspection regressions pass with the race detector.
Roadmap local links and whitespace checks pass. Both follow-up findings are
resolved within the existing public interfaces and package boundaries.