Skip to content

feat(init): offer the published localnet versions when none is given - #424

Open
HusseinAdeiza wants to merge 1 commit into
genlayerlabs:v0.40-devfrom
HusseinAdeiza:fix/init-localnet-version-discovery
Open

HusseinAdeiza wants to merge 1 commit into
genlayerlabs:v0.40-devfrom
HusseinAdeiza:fix/init-localnet-version-discovery

Conversation

@HusseinAdeiza

Copy link
Copy Markdown

Fixes #164.

Problem

genlayer init --localnet-version defaulted to the hardcoded floor v0.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-version accepts an opaque string, so a typo or a version that was never published only surfaces much later as a Docker pull failure.

Change

init now resolves the version itself:

  • an explicit --localnet-version is honoured unchanged, so scripted and CI runs behave exactly as before;
  • with no flag, it reads the tags of yeagerai/simulator-jsonrpc (every simulator image in docker-compose.yml is published under the same LOCALNETVERSION tag, 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 valid LOCALNETVERSION values, so they are dropped. Versions below localnetCompatibleVersion are filtered out as well. The list is capped at 20.

Failure handling

The tags API is unauthenticated and rate-limited per IP, so listAvailableLocalnetVersions returns [] on every failure (non-2xx, DNS, timeout, unexpected body) rather than throwing, with a 5s deadline. init then logs a line and falls back to localnetCompatibleVersion. A prompt that cannot be answered (no TTY, no piped stdin) falls back the same way instead of aborting, matching how BaseAction already treats ExitPromptError elsewhere.

Verification

Full suite: 826 passed, 1 pre-existing suite failure unrelated to this change (keychainManager.test.ts needs libsecret-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 listAvailableLocalnetVersions cases and 3 of the 5 InitAction localnet version resolution cases fail without the fix.

The filtering and ordering were also exercised against the live registry:

$ node dist/index.js init --help
  --localnet-version <localnetVersion>  Select a specific localnet version
                                        (minimum: v0.65.0). Omit to pick from
                                        the published versions.
raw tags: 100 | offered: 20
v0.123.0-rc.7
v0.123.0-rc.6
...
v0.121.9

docs/api-references/environment/init.mdx regenerated with npm run docs:cli.

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.
@coderabbitai

coderabbitai Bot commented Oct 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: c0ed1001-2fe4-4cd1-9107-21d615c8afb8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
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.

1 participant