Skip to content

feat: migrate subgraph provider from Ormi to Goldsky - #1037

Merged
levalleux-ludo merged 2 commits into
mainfrom
migrate-subgraph-to-goldsky
Aug 26, 2026
Merged

levalleux-ludo merged 2 commits into
mainfrom
migrate-subgraph-to-goldsky

Conversation

@levalleux-ludo

@levalleux-ludo levalleux-ludo commented Aug 26, 2026

Copy link
Copy Markdown
Member

Part of #1036 — first slice of the Ormi → Goldsky migration, scoped to the testing environment on Sepolia and Base Sepolia. The other three testing networks, plus staging and production, stay on Ormi for now.

What changes

Query endpointtesting-11155111-0 now points at the Goldsky endpoint in subgraphs.json. The URL is tag-based (.../subgraphs/boson-testing-sepolia/latest/gn), so it stays stable across deployments.
Same change applied to testing-84532-0

New deploy scriptpackages/subgraph/scripts/deploy-on-goldsky.ts replaces the graph deploy + post-deploy-on-ormi.ts pair for these two networks. It drives the Goldsky CLI through the whole sequence:

  1. read the version the latest tag currently points to — before deploying, since moving the tag is what makes that unrecoverable
  2. deploy the new version
  3. optionally wait for it to be synced and healthy
  4. move the latest tag onto the new version
  5. re-read the tag to confirm it moved, then delete the previously tagged version

Goldsky tags are mutable pointers keyed by tag name, so step 4 is a single idempotent write — creating a tag that already exists just repoints it. No intermediate new-latest tag is needed.

post-deploy-on-ormi.ts is untouched, and the deploy:cmd:testing:{sepolia,base} entries are left in place for rollback.

The sync gate — syncing can take hours, so waiting for it is opt-in via GOLDSKY_WAIT_FOR_SYNC:

tag move + old-version delete
unset (default) straight after the deployment — quick local iteration
truthy only once the new version is synced and healthy

If the new version never gets there, the script exits non-zero with latest still on the old version and the old version still present. GOLDSKY_SYNC_TIMEOUT_MINUTES (default 300) and GOLDSKY_SYNC_POLL_SECONDS (default 60) tune the wait.

Workflowdeploy-testing-subgraph.yaml now deploys only these two networks, with the gate on and the per-network timeout capped at 150 min so two sequential deploys fit inside GitHub's 6h job limit. Three supporting changes came with that:

  • a concurrency group, because a job that pushes to a branch and now runs for hours can otherwise overlap with itself and race on the same subgraph's tags
  • timeout-minutes: 330 on the job
  • the Commit & Push step no longer fails when there is nothing to commit. subgraph.yaml is gitignored, so the logs/* files were the only thing this job ever committed — and Goldsky now records which version is deployed, making them obsolete

publish-alpha.yaml passes the new secret through to the reusable workflow; a required: true secret has to be provided by the caller or the run errors before it starts.

Action required before merge

Create a GOLDSKY_API_KEY_TESTING repo/org secret. The workflow will fail with Missing environment variable 'GOLDSKY_API_KEY' without it. The name follows the ORMI_0x_GRAPH_API_KEY_TESTING convention — rename in both workflow files if you'd prefer something else.

Verification

  • npm run build and npm run lint:fix pass
  • both list-parsing paths were checked against the live Goldsky project (read-only): the tag lookup returns 1.36.0 and the status read returns healthy for both boson-testing-sepolia and boson-testing-base
  • workflows: YAML parses, prettier --check clean, @action-validator/cli schema-clean, actionlint reports only pre-existing findings
  • the deploy itself has not been exercised end-to-end — the first real run will be this workflow

Worth knowing: Goldsky's synced flag is unreliable. Both live deployments are healthy and indexed to head but still report Synced: 100% rather than the check mark, weeks after deployment. A gate keyed on the check mark alone would hang for the full timeout on every run, so the script treats a reported 100% as synced (the CLI rounds to 3 significant digits, so that means ≥ 99.95%).

Pre-existing, not addressed here

actionlint flags actions/{checkout,setup-node,cache}@v3 in this workflow as too old to run. The rest of the repo is already on v4 — the only three holdouts are the testing/staging/prod subgraph deploy workflows. Happy to bump them in a follow-up.

Follow-ups

  • migrate the remaining testing networks, then staging and production
  • publish a new core-sdk version once the endpoints are live

🤖 Generated with Claude Code

Deploy the testing Sepolia and Base Sepolia subgraphs on Goldsky instead of
Ormi, and point the SDK at the Goldsky query endpoint for testing-11155111-0.

Goldsky tags are mutable pointers keyed by tag name, so moving 'latest' onto a
new version is a single idempotent write - no intermediate tag is needed. The
new deploy-on-goldsky.ts script runs the whole sequence through the Goldsky
CLI: read the version 'latest' currently points to (before deploying, as
moving the tag is what makes that unrecoverable), deploy, optionally wait for
the new version to be synced, move the tag, then delete the old version. That
also makes the logs/ files obsolete, as Goldsky now records which version is
deployed.

Syncing can take hours, so waiting for it is opt-in via GOLDSKY_WAIT_FOR_SYNC:
unset, the tag moves straight after the deployment; set, the tag move and the
cleanup only happen once the new version is synced and healthy.

The testing workflow deploys only those two networks for now, with the sync
gate on, and no longer fails when a run has nothing to commit.

Refs #1036

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 26, 2026 12:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces the first slice of the Ormi → Goldsky migration for subgraph deployments, scoped to the testing environment (Sepolia + Base Sepolia), including a new Goldsky-based deploy script and workflow wiring.

Changes:

  • Add a Goldsky-driven deployment script that deploys, optionally waits for sync/health, moves the latest tag, and deletes the previously-tagged version.
  • Update testing deploy workflow(s) to deploy only Sepolia and Base Sepolia via Goldsky and pass through the new Goldsky API key secret.
  • Update the testing Sepolia subgraph query endpoint to Goldsky (but Base Sepolia endpoint is not updated in this PR).

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/subgraph/subgraph.template.yaml Minor manifest template list adjustment.
packages/subgraph/scripts/deploy-on-goldsky.ts New Goldsky deploy/tag-move/cleanup script with optional sync gate.
packages/subgraph/package.json Add Goldsky CLI dependency and new build:subgraph / deploy:goldsky scripts; switch testing sepolia/base deploy scripts to Goldsky path.
packages/common/src/inputs/subgraphs.json Switch testing Sepolia endpoint to Goldsky (Base Sepolia remains on Ormi).
package-lock.json Lockfile updates to include @goldskycom/cli.
.github/workflows/publish-alpha.yaml Pass GOLDSKY_API_KEY_TESTING secret into reusable deploy workflow.
.github/workflows/deploy-testing-subgraph.yaml Add required Goldsky secret, concurrency control, longer timeout, and switch deploy steps to Goldsky.
Suppressed comments (2)

packages/common/src/inputs/subgraphs.json:16

  • The PR description and deploy workflow indicate both Sepolia and Base Sepolia testing subgraphs are migrated to Goldsky, but only testing-11155111-0 was updated here; testing-84532-0 still points at the Ormi/0xgraph endpoint. This will cause the app to keep querying Ormi for Base Sepolia even though the deploy job now deploys/tag-moves on Goldsky for testing_base.
      "https://api.goldsky.com/api/public/project_cmsd7juc4rocz01u5566b9h93/subgraphs/boson-testing-sepolia/latest/gn"
    ],
    "testing-84532-0": [
      "https://api.0xgraph.xyz/api/public/c56471f5-5b1d-4a62-b1de-450044cb7ebc/subgraphs/boson-testing-base/latest/gn"
    ],

.github/workflows/deploy-testing-subgraph.yaml:12

  • workflow_call.secrets still marks Ormi / Graph Studio secrets as required: true, but this workflow no longer uses them after switching both steps to Goldsky. Keeping them required forces every caller to provide secrets that are unused, increasing operational coupling.
        required: true
      ORMI_0x_GRAPH_API_KEY_TESTING:
        required: true
      THE_GRAPH_STUDIO_DEPLOY_KEY:
        required: true

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.73%. Comparing base (1f8bca7) to head (b0ead81).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1037   +/-   ##
=======================================
  Coverage   91.73%   91.73%           
=======================================
  Files         182      182           
  Lines        7766     7766           
  Branches     1514     1514           
=======================================
  Hits         7124     7124           
  Misses        642      642           
Flag Coverage Δ
common 92.73% <ø> (ø)
core-sdk 67.24% <ø> (ø)
e2e 85.10% <ø> (ø)
eth-connect-sdk 95.06% <ø> (ø)
ethers-sdk 74.33% <ø> (ø)
ipfs-storage 91.75% <ø> (ø)
metadata 94.70% <ø> (ø)
unittests 69.84% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@levalleux-ludo
levalleux-ludo merged commit e56d458 into main Aug 26, 2026
11 checks passed
@levalleux-ludo
levalleux-ludo deleted the migrate-subgraph-to-goldsky branch August 26, 2026 13:35
levalleux-ludo added a commit that referenced this pull request Aug 27, 2026
#1039)

* ci: deploy each subgraph in its own parallel job

Each deploy workflow ran every network sequentially in a single job. With
GOLDSKY_WAIT_FOR_SYNC on, a network that indexes slowly ate into the next
one's budget, and all of them had to fit inside GitHub's 6h job limit - so
the per-network wait was capped at 150 minutes and a network that overran
prevented the ones after it from deploying at all.

Replace the sequence of deploy steps with a matrix over networks, so each one
gets its own runner: they run in parallel, each has the full job budget
(GOLDSKY_SYNC_TIMEOUT_MINUTES back up to 300 with timeout-minutes: 350), and
fail-fast: false keeps one network's failure from cancelling the others.

Carry the changes made for testing in #1037 over to staging and production:
deploy:{staging:sepolia,staging:base,production:ethereum,production:base} now
build the subgraph and run deploy-on-goldsky.ts, the workflows deploy only
those networks, and they authenticate with GOLDSKY_API_KEY_{STAGING,
PRODUCTION}. The remaining networks stay on Ormi and are no longer redeployed
by CI, matching the migration scope in #1036.

The 'Commit & Push' steps are dropped. Goldsky records which version is
deployed, subgraph.yaml is gitignored and the logs/ files are no longer
written, so these runs have nothing to commit - and parallel jobs pushing to
main would race. That also makes the 'Set github bot' steps redundant.

The subgraph query URLs in subgraphs.json are deliberately left alone for
staging and production: the Goldsky projects for those environments do not
exist yet, and the endpoints must only be switched once a version has been
deployed and synced there.

Refs #1036

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* ci: promote subgraphs from a schedule instead of waiting for the sync

Waiting for a freshly deployed version to be indexed inside the deploy job
does not hold: boson-testing-base took roughly 6 hours, the job hit its
timeout, and the 'latest' tag stayed on the previous version even though the
new one ended up indexed and healthy.

The wait is now split off from the deployment:

- the deploy job watches the new version for 5 minutes, long enough to catch
  a deployment that cannot index at all, then ends successfully and flags the
  deployed version in a SUBGRAPH_PENDING_<ENV>_<NETWORK> repository variable
- a new 'Promote deployed subgraphs' schedule checks every flagged deployment
  every 30 minutes and, once it is synced and healthy, moves the 'latest' tag
  onto it and deletes the version the tag was pointing to

Nothing holds a runner for hours any more, and no promotion can hit the 6 hour
job limit. A network is flagged, checked and cleared on its own, so a subgraph
that fails to index never affects the others.

'promote-on-goldsky.ts' makes a single check and reports 'promoted', 'pending'
or 'failed' on its 'outcome' step output, which is what clears the flag. A
transient failure - Goldsky unreachable, say - writes no outcome, so the
deployment stays flagged and is retried on the next tick.

The deploy and promote scripts share 'goldsky.ts', and the workflows share a
'setup-subgraph' composite action.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* ci: deploy the subgraph networks from a matrix again

The per-network jobs were only spelled out one by one so that each network's
promotion job could depend on its own deployment. The promotion is a schedule
now, so nothing needs to name a single network's job any more and the three
workflows go back to one matrixed job each.

The network's pending-deployment variable rides along in the matrix rather
than being derived, so the six names stay greppable against the ones the
'Promote deployed subgraphs' schedule reads.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix: reorder entities in subgraph template to generate a new hash

Goldsky keys a deployment on the manifest hash, so a version whose manifest is
byte for byte the one already deployed cannot be redeployed. Reordering the
'entities' lists changes the hash without changing what the manifest declares -
graph-node does not read anything into their order.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix: address the review findings on the subgraph deploy and promote jobs

Three ways the promotion could move or clear the wrong thing:

- a 'Synced:' line the CLI prints in any form this does not recognise was read
  as fully indexed, which moves the 'latest' tag onto a version that is still
  indexing and deletes the one serving traffic. Only '100%' or an explicit
  check mark counts now, and anything else means "not synced yet".
- clearing the flag deleted whatever the variable held. A deployment that
  landed while the promotion was running now keeps its flag instead of being
  dropped silently, never promoted and never reported.
- a tag listing that failed passed for 'no previous version', which reported
  the promotion as done while leaving the old version undeleted. It throws,
  and the flag survives for the next tick.

Nothing bounded a deployment that neither indexed nor failed - a paused
indexer, or a missing GOLDSKY_API_KEY_<ENV> failing the script before it can
report an outcome - so the schedule picked it up every 30 minutes forever. A
deployment now has PROMOTION_DEADLINE_HOURS (24h) to promote, after which the
watch is given up on with an error and the flag is cleared.

Also:

- the production workflow takes the setup action from the ref it is running
  from: its workspace holds the release being deployed, whose '.github' is
  whatever that release shipped - the action may not be in it at all
- the testing workflow falls back to BSNORG_ACTIONS_SECRET when no GH_TOKEN is
  passed, and checks it up front rather than deploying a version it then
  cannot flag, and which nothing would ever promote
- the deployed version reaches 'gh variable set' through the environment, and
  is validated the way the schedule validates it before use
- a variable that does not hold a version annotates and skips that subgraph
  rather than stopping every other network's promotion
- the schedule derives the env key and the variable name from the environment
  and the network instead of carrying them as literal columns
- the promotion installs the subgraph workspace and the root, not all nine
- the '--env' choices move to 'deploy-envs.ts', shared with the Ormi script
- the setup action's 'build' input no longer explains itself with the ./build
  directory, which is not what it produces

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix: update subgraph URLs for testing, staging, and production environments

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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