feat(assessment): add the review band of attempt signals and the disclosed collector

This commit is contained in:
shira committed 2026-10-08 23:04:57 +03:00
1 parent 68286af8b7
commit b3c6dc870b
124 files changed
+13522 -633

No files matched your search

@@ -51,6 +51,7 @@ type SignalService struct {
transactor outbound.Transactor
keyring Keyring
clock func() time.Time
observer *SignalObserver
}
func NewSignalService(transactor outbound.Transactor, keyring Keyring, clock func() time.Time) (*SignalService, error) {
@@ -65,6 +66,9 @@ type RecordSignalsCommand struct {
AttemptID domain.AssessmentAttemptID
IdempotencyKey string
Events []domain.AssessmentSignalEvent
// Origin is the sender of the batch. It feeds the server signals only and
// is not part of the idempotency fingerprint.
Origin RequestOrigin
}
type canonicalSignalRequest struct {
@@ -191,6 +195,11 @@ func (service *SignalService) recordNewSignals(
if err != nil {
return fmt.Errorf("%s - persist bounded event batch: %w", location, err)
}
if status == domain.AssessmentSignalReceiptAccepted {
if err := service.observer.recordOrigin(ctx, repository, attempt.ID(), domain.AssessmentOriginSignals, databaseTime, command.Origin); err != nil {
return fmt.Errorf("%s - record request origin: %w", location, err)
}
}
newReceipt, err := domain.NewAssessmentSignalReceipt(status, acceptedCount, databaseTime)
if err != nil {
return fmt.Errorf("%s - build receipt: %w", location, err)