Skip to content

Mark SRE build as BG-granted when a grant is completed#150

Merged
Pabl0cks merged 13 commits intomainfrom
grants-sre-connection
Aug 13, 2025
Merged

Mark SRE build as BG-granted when a grant is completed#150
Pabl0cks merged 13 commits intomainfrom
grants-sre-connection

Conversation

@Pabl0cks
Copy link
Member

@Pabl0cks Pabl0cks commented Aug 7, 2025

Complementary PR to BuidlGuidl/SpeedRunEthereum-v2#276

This PR adds:

  • SRE API call when a grant is completed, to flag the SRE build as bg granted
  • When a grant is marked as COMPLETED, we extract the buildId from the stored SRE link (…/builds/) and POST to SRE with { buildId, apiKey } to flag it as bgGrant.
  • We need to setup SRE_API_KEY in both grants and SRE with the same value
  • Centralized in the server-side review flow, so both single and batch reviews trigger the call consistently.
  • Non-blocking: failures don’t prevent the grant from being completed.

How to test locally:

  • Run both apps locally (grants + SRE). First grants, then SRE so they are setup in port 3000 and 3001 automatically
  • In grants, set env:
  • yarn seed and tweak one of the grants in local firestore to status= "submitted" and set the SRE link with the buildId you want to test, then do the final approval in admin
  • The build in SRE database should change its bg_grant field to TRUE

Optional quick check (curl):

curl -i -X POST http://localhost:3001/api/builds/grant-completed \
  -H "Content-Type: application/json" \
  -d '{"buildId":"da3cce7f-07c7-4459-aafd-992cab7d4c8c","apiKey":"asd"}'

update parameters to your buildId and SRE_API_KEY value

@vercel
Copy link

vercel bot commented Aug 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Project Deployment Preview Comments Updated (UTC)
grants-bg Ready Preview Comment Aug 13, 2025 2:41pm

@Pabl0cks Pabl0cks changed the title Send SRE API call when a grant is marked as completed, to mark the build with bgGrant flag Send SRE API call when a grant is marked as completed, to mark the build in SRE with bgGrant flag Aug 7, 2025
@Pabl0cks Pabl0cks marked this pull request as ready for review August 12, 2025 17:16
@Pabl0cks Pabl0cks requested a review from carletex August 12, 2025 17:16
@Pabl0cks Pabl0cks changed the title Send SRE API call when a grant is marked as completed, to mark the build in SRE with bgGrant flag Mark SRE build as BG-granted when a grant is completed Aug 12, 2025
Copy link
Member

@carletex carletex left a comment

Choose a reason for hiding this comment

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

Thanks Pablo, I'll sleep better tonight haha

Approving, but letting the merge to you (in case you have to configure Vercel env vars or something before)

@Pabl0cks Pabl0cks merged commit 5c7fe61 into main Aug 13, 2025
3 checks passed
@Pabl0cks Pabl0cks deleted the grants-sre-connection branch August 13, 2025 14:54
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.

2 participants