Synchronize deadline regression with source inspection
This commit is contained in:
@@ -14,6 +14,14 @@ import (
|
|||||||
releasekit "go.maximumdirect.net/releasekit"
|
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) {
|
func TestBuildSourceInspectionCancellation(t *testing.T) {
|
||||||
const source = `package main
|
const source = `package main
|
||||||
import("fmt";"os";"go.maximumdirect.net/releasekit/buildinfo")
|
import("fmt";"os";"go.maximumdirect.net/releasekit/buildinfo")
|
||||||
@@ -58,7 +66,9 @@ exec "$INSPECT_GIT" "$@"
|
|||||||
var ctx context.Context
|
var ctx context.Context
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
if tc.deadline {
|
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 {
|
} else {
|
||||||
ctx, cancel = context.WithCancel(context.Background())
|
ctx, cancel = context.WithCancel(context.Background())
|
||||||
}
|
}
|
||||||
@@ -93,10 +103,13 @@ exec "$INSPECT_GIT" "$@"
|
|||||||
case <-ticker.C:
|
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
|
want := context.Canceled
|
||||||
if tc.deadline {
|
if tc.deadline {
|
||||||
want = context.DeadlineExceeded
|
want = context.DeadlineExceeded
|
||||||
|
|||||||
@@ -340,8 +340,11 @@ or a companion root test file.
|
|||||||
smoke-checked. Verify `errors.Is(err, context.Canceled)` and retention of
|
smoke-checked. Verify `errors.Is(err, context.Canceled)` and retention of
|
||||||
completed artifact paths/digests for the latter case.
|
completed artifact paths/digests for the latter case.
|
||||||
4. Add one focused deadline-expiration variant with synchronized readiness and
|
4. Add one focused deadline-expiration variant with synchronized readiness and
|
||||||
a bounded wait. Verify `context.DeadlineExceeded`, rather than asserting an
|
a bounded wait. Trigger a test-controlled expiration context after Git signals
|
||||||
exact killed-process error string. Join test goroutines and reap children.
|
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;
|
**Verification:** ordinary source-inspection Git errors retain their causes;
|
||||||
`SourceVerified` is not reported true after an interrupted build. Retain
|
`SourceVerified` is not reported true after an interrupted build. Retain
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
## Status and scope
|
## Status and scope
|
||||||
|
|
||||||
The planned remediation was implemented against baseline `59bb074`. A
|
The planned remediation was implemented against baseline `59bb074`. A
|
||||||
post-implementation review of `6796310` found two follow-up issues below;
|
post-implementation review of `6796310` found two follow-up issues below.
|
||||||
remediation remains open until they are addressed. The implementation plan
|
Both are complete as recorded in their completion markers. The implementation
|
||||||
records the original stage and validation evidence.
|
plan records the original stage and validation evidence.
|
||||||
|
|
||||||
This roadmap defines the desired behavior and scope for all three findings in
|
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
|
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
|
The review compared implementation commits `0632aa5` through `6796310` with the
|
||||||
agreed target and the plan at `730e638`. It examined production changes, new
|
agreed target and the plan at `730e638`. It examined production changes, new
|
||||||
regressions, current documentation, and the final package boundaries. The
|
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
|
### 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
|
### 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
|
**Code:** `TestBuildSourceInspectionCancellation/deadline` in
|
||||||
[build_source_cancellation_test.go](../../build_source_cancellation_test.go).
|
[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
|
response requirements, or broader source/preflight guarantees introduced by the
|
||||||
implementation. The two findings concern incomplete realization of the agreed
|
implementation. The two findings concern incomplete realization of the agreed
|
||||||
behavior and regression reliability rather than an intentional scope expansion.
|
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.
|
||||||
|
|||||||
Reference in New Issue
Block a user