fix: review fixes for webhook and auto mode (#8)
Clear available_* only when the deployed ref equals it, drop the unused poll source, stop leaking internal errors to CI, use the request-scoped logger, validate X-Request-ID, re-read jobs once after the timeout, report refused when no target ref exists, and tidy UI, deploy and docs.
This commit is contained in:
@@ -174,6 +174,7 @@ func (m *memStore) FinishJob(_ context.Context, agentID, jobID int64, f model.Jo
|
||||
return false, nil
|
||||
}
|
||||
j.Status, j.Error, j.Output, j.OutputTruncated, j.FinishedAt = f.Status, f.Error, f.Output, f.OutputTruncated, &f.FinishedAt
|
||||
requestedRef := j.ToRef
|
||||
if f.Ref != "" {
|
||||
j.ToRef = f.Ref
|
||||
}
|
||||
@@ -183,8 +184,9 @@ func (m *memStore) FinishJob(_ context.Context, agentID, jobID int64, f model.Jo
|
||||
if f.Status == model.JobSucceeded {
|
||||
svc := m.svcRows[j.ServiceID]
|
||||
svc.DesiredRef = f.Ref
|
||||
// Same rule as the SQL: a job created after the suggestion deployed it.
|
||||
if svc.AvailableAt != nil && !svc.AvailableAt.After(j.CreatedAt) {
|
||||
// Same rule as the SQL: the job was created for the suggested ref after it was reported.
|
||||
requested, _, _ := strings.Cut(requestedRef, "@")
|
||||
if svc.AvailableAt != nil && svc.AvailableRef == requested && !svc.AvailableAt.After(j.CreatedAt) {
|
||||
svc.AvailableRef, svc.AvailableSource, svc.AvailableAt = "", "", nil
|
||||
}
|
||||
m.svcRows[j.ServiceID] = svc
|
||||
|
||||
Reference in New Issue
Block a user