Repository navigation
Conversation
Count required local and opt-in network failures without stopping later checks. Keep torch optional and diagnostics credential-safe. Part of InfiniteZeroFoundation#245
|
Reviewed against CI on Claimed: a missing Verified — correct, on the real script: this review worktree has no Claimed: later checks continue after import failures, including Verified — correct: Claimed: with Verified — correct, against live endpoints (
The failure count went up by exactly one in the last three rows compared with the first two. The canonical-quantity regex IPFS, with dincli importable: my real config gives Claimed: diagnostics remain credential-safe. Verified — correct: all three exception-text interpolations were removed: Claimed: the new tests catch the original behaviour (the PR body says 41 expected failures on selected regressions). Verified — break-then-fix, whole file: with Claimed: Verified — correct: the new paragraphs list exactly the conditions that Two observations (updated: the first one is required before merge, see the change-request review):
Not independently re-verified: a real Sepolia RPC or a live Filebase/Kubo upload. The script only calls Every checkable claim held up. Updated: not mergeable as-is. Observation 1 is required before merge (changes requested); observation 2 should go in the same push. The PR body says |
Files changed (3) — as of
|
| Field | Value |
|---|---|
| Change | Modified |
| Lines | +35/-18 |
| Diff (what exactly is in this PR) | _check_node_modules and _check_importable return int, and run() adds them to failures (torch returns 0 via optional=True). _check_rpc returns 1 from its except, and now validates the response: it must be a dict with no error key, and result must match the canonical hex quantity regex. _check_ipfs_config returns 0 only on the three resolved-provider branches and 1 on every other path, including dincli not importable. _network_checks counts a missing RPC URL and moves Path.cwd() inside the .env try. Exception text and the provider name are removed from the warnings. |
| Functionality — how & why | How: each check prints its row and returns 0/1, and main() exits 1 if the sum is non-zero. No check raises, so one failure never hides the rows after it. Network checks still run only with --network, and the chain-ID mismatch still prints [WARN] and returns 0. Why: issue No. 245's pending items. Before this PR, a contributor with no npm ci, a broken venv or a dead RPC got All required checks passed and exit 0, then hit the npx race in forge test or a failure in dincli later. |
Diff vs current develop HEAD |
None — untouched since merge-base. |
| Recommended merge proposal | Merge after the label fix in Pending (required; changes requested). Verified: on the real script, a missing node_modules exits 1 where develop exits 0. With --network local, a live anvil at 1337 is OK, a 31337 mismatch is advisory, and a malformed 0xzz RPC, a closed port and an unset URL each add one failure. A fresh HOME with no IPFS config adds one failure. |
| Actual merge proposal | Merged as-is in e25df81 (GitHub merge commit, umeradl). Review items fixed by the author in e22e360; no reviewer fix commits. |
| Pending proposal | Done in e22e360 (re-review). Failing rows now print [MISSING] via _missing(...), torch and the chain-ID mismatch stay [WARN], and the dincli message is reworded. |
| Local merge conflict | No |
| GitHub merge conflict | No |
tests/test_preflight.py
| Field | Value |
|---|---|
| Change | Modified |
| Lines | +339/-60 |
| Diff (what exactly is in this PR) | 27 test functions, 79 collected with parametrisation (develop has 14 functions). Standalone subprocess fixtures cover a missing node_modules, a failing required import that continues, an import-time OSError and the torch-optional success path. Mocked urlopen/resolve_ipfs_config cases cover invalid RPC responses (non-dict, error key, non-canonical hex), canonical quantities, mismatch-advisory, per-provider IPFS fields, unimportable dincli, .env lookup exceptions, and network failures reaching main()'s exit code. |
| Functionality — how & why | How: runs the script both as a subprocess (real exit codes, stdlib-only bootstrap) and in-process with monkeypatch for network I/O, so no live RPC or IPFS is touched. Why: pins every new exit-1 path, and the sanitised-output guarantees, so a later refactor can't make them advisory again unnoticed. |
Diff vs current develop HEAD |
None — untouched since merge-base. |
| Recommended merge proposal | Merged as-is. Break-then-fix: against develop's script, 56 failed / 23 passed; against the PR's script, 79 passed. Also green in CI Python. |
| Actual merge proposal | Merged as-is in e25df81 (GitHub merge commit, umeradl). Review items fixed by the author in e22e360; no reviewer fix commits. |
| Pending proposal | Done in e22e360 (re-review). Label assertions updated, 79/79 pass. |
| Local merge conflict | No |
| GitHub merge conflict | No |
Documentation/public/getting-started.md
| Field | Value |
|---|---|
| Change | Modified |
| Lines | +9/-1 |
| Diff (what exactly is in this PR) | Replaces "exits 1 on Python version or Foundry failures" with the full list of exit-1 conditions, and adds a paragraph on what --network failures do. |
| Functionality — how & why | How: the text now matches run()/_network_checks() exactly, including torch-optional and mismatch-advisory. Why: the issue's status update asked for this line to change together with the exit code. |
Diff vs current develop HEAD |
None — untouched since merge-base. |
| Recommended merge proposal | Merged as-is. If the _missing fix is applied, the sentence above the table ("prints [OK], [WARN], or [MISSING]") already fits. |
| Actual merge proposal | Merged as-is in e25df81 (GitHub merge commit, umeradl). Review items fixed by the author in e22e360; no reviewer fix commits. |
| Pending proposal | None |
| Local merge conflict | No |
| GitHub merge conflict | No |
Verification
CI on 89dc9cc: CI OK green (Python, Solidity, Docs and Integration paths green; Integration (full GI) skipped by path filter). Locally: break-then-fix of tests/test_preflight.py (56 → 0 failures), plus the real script against a live anvil (two chain IDs), a malformed-RPC server, a closed port, an unset URL, and both a configured and an empty IPFS config. Full detail is in the verification comment above.
Local vs. GitHub agree: both clean.
umeradl
left a comment
There was a problem hiding this comment.
Approved at 89dc9cc: exit-1 paths verified on the real script (missing node_modules; with --network: live anvil, malformed RPC, closed port, unset URL, empty IPFS config); break-then-fix 56 failed -> 79 passed. Optional at merge: print the newly fatal rows as [MISSING] (see the merge-proposal comment).
umeradl
left a comment
There was a problem hiding this comment.
Changing my review: the label fix I called optional is required. The newly fatal checks still print [WARN], the same label as the harmless ones (torch, chain-ID mismatch), so the output doesn't show what failed. That's my mistake: my note on issue No. 245 said "only the exit code changes". Please:
- Use
_missing(...)instead of_warn(...)for the rows that now count as failures:foundry/node_modules, the three core imports, both RPC failure branches, and the IPFS failure branches. Keep[WARN]for torch and the chain-ID mismatch. - Reword
dincli not importable — skipping IPFS config checkto… IPFS config cannot be checked. - Update the
[WARN]assertions intests/test_preflight.pyfor those rows.
Everything else in the PR is verified and fine. I've updated the verification and merge-proposal comments to match.
|
Thanks for the thorough review, @umeradl! Pushed the fixes in The matching assertions are updated, and all 79 preflight tests passed in an isolated environment with mocked network I/O. Fresh CI and your re-review of the new head are still needed. |
|
Re-reviewed the fix commit: Requested 1, Requested 2, reword the dincli-import message. Done: Requested 3, test assertions. Done: Re-ran on a live anvil (
New observation, not blocking this PR: an RPC URL with credentials in it fails preflight even though dincli accepts it. This PR didn't cause it: on Every requested change is in, and every claim holds on |
|
@Santiagocetran approved at Could you click Update branch (merge commit, not rebase) or merge |
Actual outcome: PR No. 303 merged as-isThis supersedes the merge-proposal comment above with what actually happened. One merge commit, on
The reviewer pushed no fix commits. The review items were fixed by the author in Files unchanged from the PR (3 of 3)
Verification
Local vs. GitHub agree: both predicted a clean merge, and it was one. Follow-ups:
|
Part of #245
Preflight currently warns about some unusable environments but still exits 0. This change makes missing
foundry/node_modulesand failed imports ofeth-account,py-multibase, orweb3contribute to exit 1. Later checks continue running after import failures, includingOSError. Torch remains optional.With
--network, missing RPC configuration, unreachable or invalid RPC responses, and unresolved or incomplete IPFS configuration also fail the run. RPC chain-ID results must be valid hexadecimal quantities; a valid but unexpected chain ID remains advisory. IPFS reporting continues after RPC or.envlookup failures, and diagnostics remain credential-safe.Updates the exit-behavior explanation in
Documentation/public/getting-started.md. Preserves the standalone stdlib bootstrap, read-only behavior, plain output, and opt-in network checks.Validation:
git diff --checkand stdlib-only--helppassed.Live RPC/IPFS services and Solidity/full-GI integration checks were not exercised. Ruff was unavailable. Full JSON-RPC envelope validation remains outside scope.