fix(work-graph): preserve scheduled task evaluation revision
CI / test (push) Successful in 50s
CI / test (pull_request) Successful in 49s

This commit is contained in:
m
2026-08-23 20:58:50 +03:00
parent 1f5569db15
commit aeafc6e0ac
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -218,7 +218,11 @@ func AdmitAndScheduleTaskEvaluation(ctx context.Context, store ports.GraphStore,
intents[i].TaskEvaluationProfile = &profile
}
intents[i].TaskEvaluationCases = append([]capability.TaskEvaluationCase(nil), node.TaskCases...)
intents[i].TaskEvaluationExecution = &work.TaskEvaluationDispatchContext{GraphID: graph.ID, GraphRevision: graph.Revision, NodeID: node.ID, BindingRevision: request.Plan.BindingRevision, ActorID: identity.ActorID(request.Plan.ActorID), PrincipalID: identity.PrincipalID(request.Plan.PrincipalID), ScopeID: authority.ScopeID(request.Plan.ScopeID)}
// AdmitAndSchedule increments the draft revision before persisting
// the leased node. The callback must target that scheduled revision;
// using the draft revision would save a completed copy that loses to
// the already-persisted immutable scheduled revision.
intents[i].TaskEvaluationExecution = &work.TaskEvaluationDispatchContext{GraphID: graph.ID, GraphRevision: graph.Revision + 1, NodeID: node.ID, BindingRevision: request.Plan.BindingRevision, ActorID: identity.ActorID(request.Plan.ActorID), PrincipalID: identity.PrincipalID(request.Plan.PrincipalID), ScopeID: authority.ScopeID(request.Plan.ScopeID)}
break
}
}
@@ -41,7 +41,7 @@ func TestAdmitAndScheduleTaskEvaluationCarriesSpecialistContext(t *testing.T) {
if _, _, err := AdmitAndScheduleTaskEvaluation(context.Background(), store, request); err != nil {
t.Fatal(err)
}
if len(store.intents) != 1 || store.intents[0].TaskEvaluationProfileID != "profile-general" || store.intents[0].TaskEvaluationBindingID != "binding-a" || len(store.intents[0].TaskEvaluationCaseIDs) != 2 || store.intents[0].SpecialistPurpose != string(work.GraphNodePurposeTaskEvaluation) {
if len(store.intents) != 1 || store.intents[0].TaskEvaluationProfileID != "profile-general" || store.intents[0].TaskEvaluationBindingID != "binding-a" || len(store.intents[0].TaskEvaluationCaseIDs) != 2 || store.intents[0].SpecialistPurpose != string(work.GraphNodePurposeTaskEvaluation) || store.intents[0].TaskEvaluationExecution == nil || store.intents[0].TaskEvaluationExecution.GraphRevision != 2 {
t.Fatalf("specialist context was not carried into dispatch: %+v", store.intents)
}
}