fix(work-graph): preserve scheduled task evaluation revision
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user