Skip to content

fix(telemetry,log): reject duplicate run events - #123

Merged
prdai merged 1 commit into
mainfrom
fix/duplicate-run-events
Nov 19, 2026
Merged

prdai merged 1 commit into
mainfrom
fix/duplicate-run-events

Conversation

@prdai

@prdai prdai commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

what changed

  • telemetry-service (secure/ and rads/): POST /events returns 409 when the run already has that event name, instead of enqueuing another row.
  • log-service (secure/ and rads/): POST /subject-access returns 409 when any data subject in the batch already has a row for that (algorithmId, runId), instead of appending under a new timestamp.
  • Service READMEs document the new response.

why

Duplicate writes currently append rows because the sort keys include the producer timestamp. A resumed or retried run can therefore record the same phase twice, and a subject-access retry can duplicate a data subject across timestamps.

verification

  • bun run typecheck and bun run lint pass in secure/telemetry-service, rads/telemetry-service, and rads/log-service.
  • secure/log-service lint passes. Typecheck fails on the pre-existing Cannot find module 'jose' error from packages/common/src/jwt.ts in this checkout; it passes when the service dependency is linked.
  • Not verified against deployed stacks or live DynamoDB.

notes

  • The check is a read-then-write, not an atomic conditional write. Two concurrent duplicates can both pass the check. This is accepted for ingest-level rejection; the worker still writes idempotently.
  • Producers treat non-2xx as best-effort logging and do not fail the run.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@prdai
prdai marked this pull request as ready for review November 19, 2026 02:57
@prdai
prdai merged commit 25d0a19 into main Nov 19, 2026
11 checks passed
@prdai
prdai deleted the fix/duplicate-run-events branch November 19, 2026 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant