Skip to content

fix: updating metric library - #111

Open
TEJASNARAYANS wants to merge 4 commits into
mainfrom
feat/metric-library
Open

fix: updating metric library#111
TEJASNARAYANS wants to merge 4 commits into
mainfrom
feat/metric-library

Conversation

@TEJASNARAYANS

Copy link
Copy Markdown
Contributor

No description provided.

@greptile-apps

greptile-apps Bot commented Aug 5, 2026

Copy link
Copy Markdown

Greptile Summary

The PR introduces Metrics Studio, platform administration, gated signup, workspace activation controls, call-import enhancements, and associated frontend, worker, migration, and test changes.

  • Adds Metrics Studio run creation, evaluation, result display, and retry workflows.
  • Adds platform-admin and signup-reference-code functionality.
  • Extends call-import schemas, manual audio uploads, telephony validation, retries, and sharding behavior.
  • Updates workspace and organization access controls across backend and frontend.

Confidence Score: 4/5

The PR does not appear safe to merge until signup-code consumption is made atomic and Metric Studio retries are restricted to eligible results or protected against overlapping workers.

Concurrent signups can still pass the same unlocked reference-code usage check and create more accounts than allowed, while explicit Studio retries can still dispatch a second worker for an active result and permit stale or conflicting terminal writes.

Files Needing Attention: app/services/signup_reference_codes.py, app/api/v1/routes/auth.py, app/api/v1/routes/metric_studio.py, app/workers/tasks/evaluate_studio_run_item.py

Important Files Changed

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

Comment on lines +46 to +50
row = (
db.query(SignupReferenceCode)
.filter(SignupReferenceCode.code_hash == code_hash)
.first()
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 security 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.

Comment on lines +315 to +318
if body.result_ids:
query = query.filter(MetricStudioRunResult.id.in_(body.result_ids))
else:
query = query.filter(MetricStudioRunResult.status == "failed")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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.

@greptile-apps

greptile-apps Bot commented Aug 11, 2026

Copy link
Copy Markdown

Too many files changed for review (112 files, 100 file limit).

Bypass the limit by tagging @greptile-apps to review.

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