Draft
Conversation
Lightweight tool that probes a running Mina Rosetta server with single-request HTTP checks. Subcommands: - network-list — POST /network/list - network-status — POST /network/status (with optional --max-delay tip recency) - network-options — POST /network/options - block — POST /block by --index or --hash - account-balance — POST /account/balance for a B62q... address - mempool — POST /mempool - ready — composite of list/status/options - wait — poll ready until pass or --timeout Designed for k8s exec probes, Docker HEALTHCHECK, and CI smoke tests. Every subcommand supports --json for machine-readable output and follows the single-JSON-record-per-invocation contract from mina-archive-healthcheck. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Bundle the four canonical rosetta-cli configs living under src/app/rosetta/rosetta-cli-config/ into the healthcheck binary at compile time, so operators can extract them without hunting for paths on disk: - config.json - mina.ros - mina-no-delegation-test.ros - mina-with-return-funds.ros The embedding is done by a tiny generator (gen_embedded/) invoked via a dune (rule) that emits embedded_configs.ml exposing the contents as string constants. Using a generator dodges the escaping/delimiter headaches of hand-embedding long JSON/DSL blobs in OCaml string literals. Two new subcommands consume the embedded configs: - show-config [--file NAME] — prints one embedded config to stdout (default: config.json). Useful for `mina-rosetta-healthcheck show-config > config.json`. - export-config --out DIR [--force] — writes all four files into DIR, creating it if missing and refusing to clobber a non-empty dir without --force. Both obey the same JSON contract as the quick probes and flush stderr explicitly before Stdlib.exit so environment errors are visible under Async. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Add an [audit] command group that shells out to an external
[rosetta-cli] binary to run the four canonical exchange-validation
sweeps described in section A of rosetta_exchange_validation.md:
- audit configuration-validate — rosetta-cli configuration:validate CFG
- audit check-spec — rosetta-cli check:spec --all --configuration-file CFG
- audit check-construction — rosetta-cli check:construction --configuration-file CFG
- audit check-data — rosetta-cli check:data --configuration-file CFG
- audit all — run all four; [--continue-on-error] runs
every step and exits with the worst code
Binary resolution: honors ROSETTA_CLI_BIN, then falls back to
[command -v rosetta-cli]; missing binary exits 2 with a clear
message on stderr. Default config path
(/etc/mina/rosetta/rosetta-cli-config/config.json) matches the
in-tree integration-test convention.
Child stdout/stderr is streamed through to the user so long sweeps
are observable live; in --json mode we also emit one summary record
per step: { "step": "check-data", "exit_code": 0, "duration_seconds": … }.
This does NOT reimplement the Construction API round-trip in OCaml;
it delegates to rosetta-cli, which is the tool exchanges are expected
to run.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
- Makefile: add the new executable to the build-rosetta target so CI builds it alongside mina-rosetta and mina-ocaml-signer. - scripts/debian/builder-helpers.sh: copy the binary into /usr/local/bin/mina-rosetta-healthcheck inside the rosetta debian package (build_rosetta_deb), so it ships next to mina-rosetta and can be invoked by k8s probes / Docker HEALTHCHECKs out of the box. The embedded configs still live on disk at /etc/mina/rosetta/rosetta-cli-config/ thanks to the existing copy in build_rosetta_deb; [export-config] and [show-config] give operators a binary-only path that does not depend on those files being present. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Add a usage-focused README next to the source covering: - The command table (quick probes, audit wrappers, config export) and exit codes (0 pass / 1 failed check / 2 environment error). - All flags (--online-uri, --network, --max-delay, --timeout, etc.) with their defaults. - The single-JSON-record-per-invocation contract in --json mode. - Ready-to-copy Kubernetes liveness/readiness probe snippets and a Docker HEALTHCHECK example. - A "Relationship to rosetta-cli" section drawing the line between the fast single-request probes shipped here (for k8s / CI) and the long-running sweeps wrapped under [audit] (for deep audits). Co-Authored-By: Claude Opus 4.7 <[email protected]>
Member
Author
|
!ci-build-me |
Hermetic shell-based smoke tests wired into [dune runtest src/app/mina_rosetta_healthcheck]. Cover only the subcommands that do NOT need a running Rosetta server, so the tests stay fast and CI-safe: - show-config: default file matches bytes of src/app/rosetta/rosetta-cli-config/config.json, --file mina.ros matches mina.ros, --file bogus exits 2 with stderr diagnostic and empty stdout. - export-config: into a fresh (non-existent, nested) dir writes all four files byte-matching originals; into a non-empty dir without --force exits 2 and leaves contents untouched; with --force succeeds and writes alongside. - audit check-spec with ROSETTA_CLI_BIN=/nonexistent/rosetta-cli: text mode exits 2 with stderr mentioning the missing binary and empty stdout; --json mode emits exactly one JSON object on stdout with "ok": false and an "error" field, exit 2. - --help smoke: top-level lists every subcommand (network-list, network-status, network-options, block, account-balance, mempool, ready, wait, audit, show-config, export-config); audit --help lists check-spec, check-construction, check-data, configuration-validate, all. Both exit 0. The HTTP probe subcommands are out of scope here — they need an HTTP fixture to be meaningful; a TODO in smoke.sh calls this out so future work is easy to pick up. The tests/dune rule declares the four config files as deps so dune re-runs the suite whenever the on-disk copies change, guaranteeing "embedded == source-tree" stays true. Co-Authored-By: Claude Opus 4.7 <[email protected]>
- Await child stdout/stderr copy deferreds in `run_rosetta_cli_step` so the tail of output written just before exit is not lost. - Reject `export-config --out <file>` with a clean error (and a single JSON record in --json mode) when the path exists but is not a directory, instead of letting `Core.Unix.mkdir_p` raise. - Treat a `/block` response whose `block_identifier` is present but missing both parseable `index` and `hash` as a failure rather than silently passing with `Null` values. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Member
Author
|
!ci-build-me |
… in devnet/mainnet signs - Add `ppx_version` preprocess + `bisect_ppx` instrumentation clauses to `src/app/mina_rosetta_healthcheck/gen_embedded/dune` to satisfy `scripts/require-ppxs.py` lint. - Add `mina_rosetta_healthcheck.exe` to `build-devnet-sigs` and `build-mainnet-sigs` Makefile targets so the devnet Debian pipeline (which drives those targets via `buildkite/scripts/build-artifact.sh`) builds it before `build_rosetta_deb` tries to copy it. - Assert `mina-rosetta-healthcheck` in `scripts/debian/tests/test_builder_helpers.sh` (and mock the exe in the fixture setup) to catch future regressions in the copy path. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Member
Author
|
!ci-build-me |
2 similar comments
Member
Author
|
!ci-build-me |
Member
Author
|
!ci-build-me |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new lightweight CLI
mina-rosetta-healthcheckfor probing the health of a running Mina Rosetta server. Mirrors the shape ofmina-archive-healthcheck: fast single-request probes for k8s readiness/liveness, CI smoke tests, plus anauditgroup that wrapsrosetta-clifor deep sweeps and ashow-config/export-configpair for extracting the in-treerosetta-cli-configfiles.Commits
6d44cf7a9b- CLI skeleton (quick probes +--json):network-list,network-status,network-options,block,account-balance,mempool,ready,wait.b3887e3cea- Embedrosetta-cli-configfiles (config.json,mina.ros,mina-no-delegation-test.ros,mina-with-return-funds.ros) +export-config/show-config.0c3af00a1a-auditsubcommands wrappingrosetta-cli(configuration-validate,check-spec,check-construction,check-data,all).cd8456a690- Includemina-rosetta-healthcheckin thebuild-rosettaMakefile target and inbuild_rosetta_debinscripts/debian/builder-helpers.sh.dfde294c98- README.Files touched
src/app/mina_rosetta_healthcheck/{dune,mina_rosetta_healthcheck.ml,README.md,gen_embedded/{dune,gen_embedded.ml}}src/dune-project,Makefile(build-rosetta),scripts/debian/builder-helpers.sh(build_rosetta_deb)Test plan
dune build src/app/mina_rosetta_healthcheck/mina_rosetta_healthcheck.exemake build-rosettasucceeds and producesmina-rosetta-healthcheckmina-rosetta-healthcheck network-list --online-uri http://localhost:3087exits 0 against a running Rosetta servermina-rosetta-healthcheck ready --jsonemits a single JSON recordmina-rosetta-healthcheck show-configprints embeddedconfig.jsonmina-rosetta-healthcheck export-config --out /tmp/cfgwrites all four embedded filesmina-rosetta-healthcheck audit all --config /tmp/cfg/config.jsonrunsrosetta-clisweeps end-to-end