Enforce Goldsky subgraph version cap (max 2) + 24h alert - #360
Enforce Goldsky subgraph version cap (max 2) + 24h alert#360Siddharth2207 wants to merge 1 commit into
Conversation
After each network deploy, keep at most two always-on versions and fail when a two-version migration exceeds 24h. Also add a check-only task for scheduled audits (RAI-1962). Co-authored-by: Cursor <cursoragent@cursor.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Reviewed this purely on the cost question: does it stop us paying for versions we do not need? Goldsky bills per running version at roughly $34/month each, so that is the only axis I looked at. Agreed the rainix level is the right home for it, and agreed that two versions with a 24h migration window is the right policy. Everything below was checked against goldsky CLI 13.9.0 against the live 1. The 24h window never closes, so the second version lives foreverTwo separate breakages, and they compound. The per-version detail call the code uses to read a creation date does not exist: That error is swallowed by So every version's age reads as 0, and
Good news is the fix is free. The name-only listing already carries 2. Every version is counted twice, and the first real run deletes a live one
Replaying the deploy path against real-shaped output with three versions present: It deletes a real serving version, then dies on a phantom name. Under The check-only path reports the same inflated number: Related: with every epoch at 0, 3. Any CLI failure silently switches the guard offraw="$(_subgraph_goldsky_cmd subgraph list "$subgraph_name" --filter deployments 2>&1 || true)"A bad token, a rate limit or an API blip produces zero parsed versions, prints 4. The audit only sees names it can derive from the current networks.jsonThat is exactly where the money went last time. Of the 18 versions deleted on 2026-08-22, most were chains that had already left the config, and the survivors include legacy names (
5. Nothing ever reclaims the second versionThe 24h rule does not delete, it only turns a job red, and the scheduled workflow is listed as an optional follow-up. So today the only thing that enforces anything is a manual deploy dispatch. If nobody deploys, nothing is ever reclaimed and we keep paying. Worth making the scheduled job enforce rather than report: same function, drop Not this PR, noted for completeness
|
Summary
subgraph-deployconsumers) get version-budget enforcement without per-repo scripts.subgraph-deploy, callsubgraph_goldsky_enforce_version_capfor${GOLDSKY_SUBGRAPH_NAME}-$network: delete older versions down to a hard cap of 2, fail if more remain, and fail when a 2-version migration has been live for >24h.subgraph-goldsky-version-capcheck-only task for cron/manual audits acrossnetworks.json.parse_versions,versions_to_delete, migration overlap).What the cap means
The limit is 2 always-on Goldsky versions per network subgraph name (e.g.
raindex-base,raindex-ethereum) — not 2 per orderbook.Multiple orderbooks on one chain (e.g. two production orderbooks on Base) are indexed by the same network subgraph and do not each get a separate version budget. The cap only limits side-by-side deployments like:
raindex-base/<addr>-<commit1>raindex-base/<addr>-<commit2>← allowed during migrationraindex-base/<addr>-<commit3>← excess; deleted / fails the checkExactly 2 versions is allowed briefly for migration; staying at 2 for >24h fails so forgotten old versions don't keep double-billing.
Consumer impact (raindex)
raindex deploy-subgraph already runs
subgraph-deploy. After bumping rainix, deploys automatically enforce the cap. Optional follow-up: add a scheduled workflow callingsubgraph-goldsky-version-cap.Test plan
nix develop -c bats test/bats/task/subgraph-goldsky-version-cap.test.bats test/bats/task/subgraph-deploy-version.test.bats