Repository navigation
feat(init): offer the published localnet versions when none is given - #424
HusseinAdeiza wants to merge 1 commit into
Conversation
Fixes genlayerlabs#164. `genlayer init --localnet-version` defaulted to the hardcoded floor `v0.65.0` and nothing listed what else existed, so the only way to run a newer simulator was to read the release tags off Docker Hub by hand. Resolve the version in InitAction instead: an explicit flag is still honoured unchanged, and with no flag `init` reads the tags of `yeagerai/simulator-jsonrpc` and offers them newest-first. Only plain `vX.Y.Z[-pre]` tags are offered. The registry also carries per-architecture tags (`v0.121.24-amd64`) and per-PR tags (`pr1680-ac0034ff`), which are not valid `LOCALNETVERSION` values. Versions below `localnetCompatibleVersion` are filtered out too. The lookup is best-effort: offline, rate-limited, or an empty list falls back to `localnetCompatibleVersion`, as does a prompt that cannot be answered, so CI and scripted runs are unaffected.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks 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 |
Fixes #164.
Problem
genlayer init --localnet-versiondefaulted to the hardcoded floorv0.65.0, and nothing in the CLI listed what else was published. The only way to run a newer simulator was to read the release tags off Docker Hub by hand.#237 added the minimum-version validation half of this. The discovery half is still missing:
--localnet-versionaccepts an opaque string, so a typo or a version that was never published only surfaces much later as a Docker pull failure.Change
initnow resolves the version itself:--localnet-versionis honoured unchanged, so scripted and CI runs behave exactly as before;yeagerai/simulator-jsonrpc(every simulator image indocker-compose.ymlis published under the sameLOCALNETVERSIONtag, so that repo is a complete index) and offers them newest-first, defaulting to the newest.Only plain
vX.Y.Z[-pre]tags are offered. The registry also carries per-architecture tags (v0.121.24-amd64,v0.121.24-arm64) and per-PR tags (pr1680-ac0034ff,hotfix-1689-660b154e), which are not validLOCALNETVERSIONvalues, so they are dropped. Versions belowlocalnetCompatibleVersionare filtered out as well. The list is capped at 20.Failure handling
The tags API is unauthenticated and rate-limited per IP, so
listAvailableLocalnetVersionsreturns[]on every failure (non-2xx, DNS, timeout, unexpected body) rather than throwing, with a 5s deadline.initthen logs a line and falls back tolocalnetCompatibleVersion. A prompt that cannot be answered (no TTY, no piped stdin) falls back the same way instead of aborting, matching howBaseActionalready treatsExitPromptErrorelsewhere.Verification
Full suite: 826 passed, 1 pre-existing suite failure unrelated to this change (
keychainManager.test.tsneedslibsecret-1.so.0, absent in this environment).New tests were confirmed non-tautological by reverting only the fix bodies and keeping the tests: 5 of the 8
listAvailableLocalnetVersionscases and 3 of the 5InitAction localnet version resolutioncases fail without the fix.The filtering and ordering were also exercised against the live registry:
docs/api-references/environment/init.mdxregenerated withnpm run docs:cli.