fix: updating metric library - #111
Conversation
|
| Filename | Overview |
|---|---|
| app/services/signup_reference_codes.py | Implements reference-code validation and consumption, but the previously reported concurrent overuse path remains. |
| app/api/v1/routes/metric_studio.py | Adds the Metrics Studio API; explicit retries still accept active results and dispatch overlapping workers. |
| app/workers/tasks/evaluate_studio_run_item.py | Evaluates Studio results and persists scores, but has no stale-task ownership guard to prevent an older worker from overwriting a retry. |
| app/api/v1/routes/call_imports.py | Expands call-import validation, retry handling, telephony checks, and manual audio upload and append support. |
| app/api/v1/routes/auth.py | Adds gated signup and active-organization enforcement while retaining the non-atomic reference-code consumption flow. |
Reviews (2): Last reviewed commit: "feat: updating some of the changes" | Re-trigger Greptile
| row = ( | ||
| db.query(SignupReferenceCode) | ||
| .filter(SignupReferenceCode.code_hash == code_hash) | ||
| .first() | ||
| ) |
There was a problem hiding this comment.
Non-atomic signup code consumption
If concurrent signup requests use the final available reference-code slot, each request reads the same use_count before the later increment and all pass validation, causing more accounts to be created than max_uses permits. Make validation and consumption a single locked or atomic conditional operation. How this was verified: The signup path performs an unlocked read and a later ORM increment with no database constraint or atomic update enforcing the limit.
| if body.result_ids: | ||
| query = query.filter(MetricStudioRunResult.id.in_(body.result_ids)) | ||
| else: | ||
| query = query.filter(MetricStudioRunResult.status == "failed") |
There was a problem hiding this comment.
Running results can be retried
When result_ids includes a pending or running result, this branch bypasses the failed-status filter and dispatches another worker without cancelling the original task. Both workers then write the complete score payload and terminal state to the same row, so the older execution can overwrite the retry's result and duplicate billed evaluation work.
|
Too many files changed for review (112 files, 100 file limit). Bypass the limit by tagging |
No description provided.