fix(mcp): submissions.get score from evaluations + FK — GHB-191#91
Merged
Gastonfoncea merged 1 commit intoMay 15, 2026
Conversation
The Supabase embed `bounty:issue_pda(creator)` failed in prod with a schema
cache error because no FK was declared between submissions.issue_pda and
issues.pda. Adding the FK with NOT VALID (16 orphan rows from early devnet
testing exempted).
The tool was also selecting `score` from submissions — that column doesn't
exist there. Score lives in evaluations (one row per source: stub | opus |
genlayer + retries). Now the tool fetches the most recent evaluation and
returns { score, score_source, rank } so agents know where the number came
from and can correlate with submission state.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
Fixes GHB-191 —
submissions.getfailing in prod with"Could not find a relationship between 'submissions' and 'issue_pda' in the schema cache".Two bugs found, both fixed here:
submissions.issue_pda → issues.pdawas never declared. Postgrest needs it for the embedbounty:issue_pda(creator). Added withNOT VALIDbecause prod has 16 orphan auto_rejected submissions from early devnet testing (bounties that no longer exist).scorefromsubmissions, butscorelives inevaluations(one row per source: stub | opus | genlayer + retries). Rewritten to fetch the most recent evaluation in a second query and return{ score, score_source, rank }so agents know where the number came from.Changes
packages/db/src/schema.ts— declared FKsubmissions.issuePda → issues.pdapackages/db/drizzle/0022_submissions_issue_pda_fk.sql— new migration (NOT VALID) already applied to prod manuallypackages/db/drizzle/meta/_journal.json— entry for 0022apps/mcp/lib/tools/submissions/get.ts— query rewrite (no more bogusscore, added evaluations lookup, new response shape)apps/mcp/tests/tools/submissions.test.ts— 4 tests covering 403, pending state, scored with source, scored without eval rowNew response contract
{ "submission": { "id": "...", "state": "scored", "solver": "...", "pr_url": "...", "score": 78, "score_source": "genlayer", "rank": 2, "opus_report_hash": "..." } }pendingnullnullnullscored/winner/auto_rejectedsubmissions.rankTest plan
pg_constraint(convalidated=falseas expected for NOT VALID)ALTER TABLE submissions VALIDATE CONSTRAINT submissions_issue_pda_issues_pda_fk;🤖 Generated with Claude Code