You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -3091,40 +3096,55 @@ func (s *service) checkCompanyCompliance(ctx context.Context, company *v1Models.
3091
3096
returnfalse, fmt.Errorf("checkCompanyCompliance: unexpected SSS status %q for company %s (required mode blocks on ambiguous results)", result.Status, company.CompanyID)
3092
3097
}
3093
3098
3094
-
// Persist result: set origin="sss" on flagged; conditionally clear on clean (only if sss-origin).
3099
+
// Persist result and reflect it on the in-memory model so downstream gates in this
3100
+
// same request (e.g. ProcessEmployeeSignature) see the just-updated state instead of
3101
+
// the stale value loaded before this check ran.
3095
3102
ifsanctioned {
3096
3103
log.WithFields(f).Warnf("SSS returned flagged status for company %s, persisting sanction with origin=sss", company.CompanyID)
log.WithFields(f).WithError(clearErr).Warnf("failed to conditionally clear sanction status for company %s", company.CompanyID)
3110
3120
ifs.sssRequired {
3111
3121
returnfalse, fmt.Errorf("checkCompanyCompliance: SSS returned clean but clearing the persisted sanction failed for company %s: %w", company.CompanyID, clearErr)
3112
3122
}
3113
3123
}
3124
+
// Only mirror the clear on the in-memory model when it actually applied. If the
3125
+
// conditional did not match — e.g. a concurrent manual/admin block now owns the
3126
+
// record — leave the loaded state so downstream gates still honor that block.
3127
+
ifcleared {
3128
+
s.applyComplianceToModel(company, false)
3129
+
}
3114
3130
}
3115
3131
3116
-
// Reflect the live SSS decision on the in-memory model so any downstream gate in
3117
-
// this same request (e.g. ProcessEmployeeSignature) sees the just-updated state
3118
-
// rather than the now-stale value that was loaded before this check ran.
3132
+
s.setComplianceCache(cacheKey, sanctioned)
3133
+
returnsanctioned, nil
3134
+
}
3135
+
3136
+
// applyComplianceToModel updates the in-memory company model to reflect a compliance
3137
+
// decision so downstream gates in the same request stay consistent with this check.
0 commit comments