fix(frontend): add explicit project_id to evaluation scenarios POST#4085
Merged
junaway merged 1 commit intorelease/v0.95.1from Mar 31, 2026
Merged
Conversation
The createScenarios call in usePreviewEvaluations was missing project_id in the query string. When a workspace has multiple projects, the auth middleware falls back to the default project instead of the one the user is viewing. This causes a FK violation (project_id, run_id) because the run belongs to a different project than the one resolved by auth. The runs and results endpoints already pass project_id explicitly — this aligns the scenarios endpoint to match.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
junaway
approved these changes
Mar 31, 2026
Contributor
Railway Preview Environment
Updated at 2026-03-31T10:36:13.857Z |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
createScenarioscall was missingproject_idin the query string, causing the auth middleware to resolve the default project instead of the current one(project_id, run_id)since the run belongs to a different project than what auth resolvedRoot Cause
In
usePreviewEvaluations, the runs endpoint (line 417) and results endpoint (line 499) both explicitly pass?project_id=${projectId}, but the scenarios endpoint did not. Without it, the auth middleware falls back toget_default_project_id_from_workspace()which returns the first project created — not the one the user is viewing.Fix
Added explicit
project_idquery parameter to the scenarios POST, matching the pattern already used by runs and results.