fix: bind experimental rechecks to recovery transaction hooks
An isolated SHA-verified replay reproduces exit 78 at managed_experimental_recovery.go:148 with the nested required-hooks guard at managed_transaction.go:69. The production recheck closure retained the adapter path-only transaction instead of the job-bound transaction. Pass the current transaction explicitly without weakening ownership, Lua, runtime or reconciliation guards. Regression starts recovery with path-only hooks and checks bound ownership for cold/adaptive rechecks. Full native Go tests, affected race tests, go vet and diff checks passed. Corrected image replay and production restoration remain unverified. Co-authored-by: GPT-6 <gpt-6@openai.com>
This commit is contained in:
1 parent
1afee7d3bd
commit
fd25cb8939
4 files changed
+20
-7
No files matched your search
@@ -70,7 +70,7 @@ func TestExperimentalProductionProbeCollectorClassification(t *testing.T) {
|
||||
}
|
||||
}
|
||||
calls := 0
|
||||
d.recheckExperimental = func(_ context.Context, c storedCandidate, r mediaResource) error {
|
||||
d.recheckExperimental = func(_ context.Context, c storedCandidate, r mediaResource, _ *managedTransaction) error {
|
||||
if c.ID != id || !freshExperimentalMedia(r) {
|
||||
t.Fatal("recovery changed candidate or lost fresh media")
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ func recoverManagedExperimental(ctx context.Context, d managedRecoveryDeps) (int
|
||||
if experimentalGooglevideo(j.Scope, c) {
|
||||
r, err := experimentalMedia(ctx, d)
|
||||
if err == nil {
|
||||
err = d.recheckExperimental(ctx, c, r)
|
||||
err = d.recheckExperimental(ctx, c, r, d.transaction)
|
||||
}
|
||||
return id, managedRecoveryContextError(ctx, err)
|
||||
}
|
||||
@@ -68,8 +68,13 @@ func recoverManagedExperimental(ctx context.Context, d managedRecoveryDeps) (int
|
||||
return 0, &managedRecoveryFatal{Err: errors.New("owned experimental candidate missing")}
|
||||
}
|
||||
|
||||
func newManagedExperimentalRecheck(target managedDeps, d managedRecoveryDeps) func(context.Context, storedCandidate, mediaResource) error {
|
||||
func newManagedExperimentalRecheck(target managedDeps, d managedRecoveryDeps) func(context.Context, storedCandidate, mediaResource, *managedTransaction) error {
|
||||
runtime := newManagedAssetRuntime(target)
|
||||
return func(ctx context.Context, c storedCandidate, resource mediaResource, transaction *managedTransaction) error {
|
||||
// The adapter is constructed with path-only dependencies. Use this job's
|
||||
// bound hooks for ownership checks and reconciliation, not that stale copy.
|
||||
d := d
|
||||
d.transaction = transaction
|
||||
guard := func() error {
|
||||
if err := runtime.guard(); err != nil {
|
||||
return err
|
||||
@@ -103,7 +108,6 @@ func newManagedExperimentalRecheck(target managedDeps, d managedRecoveryDeps) fu
|
||||
}
|
||||
return d.run(ctx, managedZapretScript, "start")
|
||||
}
|
||||
return func(ctx context.Context, c storedCandidate, resource mediaResource) error {
|
||||
if !experimentalGooglevideo(GooglevideoScopeExperimental, c) {
|
||||
return &managedRecoveryFatal{Err: errors.New("unaudited experimental candidate")}
|
||||
}
|
||||
|
||||
@@ -96,13 +96,22 @@ func TestExperimentalServiceRecoveryPreservesOwnership(t *testing.T) {
|
||||
return managedServiceInventory{media: experimentalResourceFixture()}, &managedResourceFailure{"avatar", "yt3.ggpht.com", nil}
|
||||
}
|
||||
calls := 0
|
||||
d.recheckExperimental = func(_ context.Context, c storedCandidate, r mediaResource) error {
|
||||
var boundTransaction *managedTransaction
|
||||
d.recheckExperimental = func(_ context.Context, c storedCandidate, r mediaResource, transaction *managedTransaction) error {
|
||||
calls++
|
||||
boundTransaction = transaction
|
||||
if transaction.Reload == nil || transaction.Health == nil {
|
||||
t.Fatal("recheck retained path-only adapter transaction")
|
||||
}
|
||||
assertActiveCandidates(t, transaction, d.db, ids)
|
||||
if c.ID != id || !freshExperimentalMedia(r) {
|
||||
t.Fatal("wrong committed candidate/resource")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
// Production adapters carry paths only until recoverManagedTarget binds the
|
||||
// job's reload/health hooks. The recheck must receive that bound transaction.
|
||||
d.transaction.Reload, d.transaction.Health = nil, nil
|
||||
for _, adaptive := range []bool{false, true} {
|
||||
d.adaptive = adaptive
|
||||
result, err := recoverManagedTarget(context.Background(), d)
|
||||
@@ -130,7 +139,7 @@ func TestExperimentalServiceRecoveryPreservesOwnership(t *testing.T) {
|
||||
if err := monitor.probe(context.Background()); err != nil || reports != 1 {
|
||||
t.Fatalf("operational probe: %v reports=%d", err, reports)
|
||||
}
|
||||
assertActiveCandidates(t, d.transaction, d.db, ids)
|
||||
assertActiveCandidates(t, boundTransaction, d.db, ids)
|
||||
}
|
||||
|
||||
func TestExperimentalRefreshAndMixedFatalPrecedence(t *testing.T) {
|
||||
|
||||
@@ -39,7 +39,7 @@ type managedRecoveryDeps struct {
|
||||
adaptive bool
|
||||
mediaSamples func(context.Context) ([]mediaResource, error)
|
||||
verifyGooglevideo func(context.Context, storedCandidate, []mediaResource) (GooglevideoQualificationProof, error)
|
||||
recheckExperimental func(context.Context, storedCandidate, mediaResource) error
|
||||
recheckExperimental func(context.Context, storedCandidate, mediaResource, *managedTransaction) error
|
||||
}
|
||||
|
||||
// Target-local adapter: reuses bounded Player requests without invoking a CLI.
|
||||
|
||||
Reference in new issue
Block a user