Skip to content

refactor(test-suite): replace fhevm bash cli with lean Bun TS#2134

Open
Eikix wants to merge 48 commits intomainfrom
elias/fhevm-cli-clean
Open

refactor(test-suite): replace fhevm bash cli with lean Bun TS#2134
Eikix wants to merge 48 commits intomainfrom
elias/fhevm-cli-clean

Conversation

@Eikix
Copy link
Copy Markdown
Contributor

@Eikix Eikix commented Mar 19, 2026

Closes https://github.com/zama-ai/fhevm-internal/issues/1042

Supersedes #2066.

#2066 keeps the iteration history and design exploration. This PR is the same final direction with a clean atomic history for review.

Summary

Replace the legacy test-suite/fhevm/fhevm-cli bash flow with a lean Bun/TypeScript CLI.

The new CLI makes target resolution, runtime generation, scenarios, local overrides, resume, upgrade, and test execution explicit instead of spreading that behavior across bash scripts and CI glue.

What changed

  • replace the bash CLI/runtime scripts with a Bun/TS implementation under test-suite/fhevm/src
  • move tracked runtime inputs into clearer buckets:
    • docker-compose/
    • templates/
    • static/
    • profiles/
    • scenarios/
  • keep generated runtime state under .fhevm/ with a hard split between:
    • .fhevm/state
    • .fhevm/runtime
  • support explicit targets:
    • latest-supported
    • latest-main
    • sha --sha <git-sha>
    • devnet
    • testnet
    • mainnet
  • support local overrides and scenario-driven coprocessor topologies
  • keep deploy as an alias for up
  • replace doctor with up --dry-run

CI contract

  • direct PR e2e boots latest-main --build with the checked-in two-of-two scenario
  • PR e2e now runs the bundled ./fhevm-cli test light suite instead of copying those steps in YAML
  • orchestrated merge-queue/release validation calls the reusable e2e workflow with build=false
  • the reusable e2e workflow is explicitly told when it is running in orchestrated mode
  • the workflow now also gates the CLI itself with:
    • bun run check
    • bun test src

Validation

Verified locally on this branch:

  • cd test-suite/fhevm && bun run check
  • cd test-suite/fhevm && bun test src
  • focused live-stack and CI-path validation during the original review cycle

Notes

  • latest-supported is now a tracked maintained profile
  • latest-main is the moving baseline for local and PR validation
  • two-of-two is the canonical checked-in multicopro scenario preset

@Eikix Eikix requested review from a team as code owners March 19, 2026 14:49
@cla-bot cla-bot bot added the cla-signed label Mar 19, 2026
@Eikix Eikix marked this pull request as draft March 19, 2026 14:51
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 19, 2026

Changed Lines Coverage

Coverage of added/modified lines: N/A

@Eikix Eikix marked this pull request as ready for review March 20, 2026 10:24
Copy link
Copy Markdown
Contributor Author

@Eikix Eikix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AUTOMATED]

Code Review Summary

Reviewed for bugs, guideline compliance, and error handling across all 39 changed files.

Findings

Category Count Severity
Bug 1 High — CI correctness
Naming (guideline) 3 Nit
Error handling 3 Medium

The BUILD env var issue in the e2e workflow is the most impactful finding — it causes unnecessary image rebuilds in the orchestrated CI path. The naming and error handling items are non-blocking improvement suggestions.

Overall the PR is well-structured: the compose path migration is consistent, the CI consolidation is clean, and the documentation is thorough.

@Eikix Eikix force-pushed the elias/fhevm-cli-clean branch from 9dd6023 to a2e4ba6 Compare March 24, 2026 09:11
@zama-ai zama-ai deleted a comment from claude bot Mar 25, 2026
Copy link
Copy Markdown
Contributor Author

@Eikix Eikix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AUTOMATED]

Code Review

Reviewed for bugs, security issues, guideline compliance, and error handling.

Result: 1 issue found (error handling). No bugs or security issues detected.

The CLI is well-structured with thorough input validation, proper async/await patterns, correct shell escaping for sh -lc commands, and a solid typed error hierarchy. The 15-step boot pipeline, state persistence, and resume logic all look correct.

@Eikix
Copy link
Copy Markdown
Contributor Author

Eikix commented Mar 25, 2026

Mob review comment: print each version of the stack at start

@Eikix Eikix added the e2e When set on a PR, will enable & trigger a run of e2e tests. label Mar 25, 2026
PanGan21
PanGan21 previously approved these changes Mar 26, 2026
@Eikix Eikix added the e2e orchestrate test Run the test-suite-orchestrate-e2e-tests on a PR (instead of merge-queue) label Mar 26, 2026
PanGan21
PanGan21 previously approved these changes Mar 26, 2026
Eikix and others added 25 commits March 26, 2026 14:20
* feat(test-suite): add multi-chain with option for mutli-copro e2e testing support

* feat(test-suite): add multi-chain host topology with imrpoved orchestration

* refactor(test-suite): address PR review, harden multi-chain topology model

* refactor(test-suite): centralize primary host key and eliminate ad-hoc string

* fix(test-suite): use per-chain contract addresses in multi-chain tests

* refactor(test-suite): make chain keys slug-native and remove naming/API smells
Pause test profiles (paused-host-contracts, paused-gateway-contracts)
now handle their own pause/unpause wrapping inside runProfile instead
of relying on runStandardSuite to set up contract state. This makes
standalone `fhevm-cli test paused-gateway-contracts` work correctly
instead of silently running against an unpaused stack.
Adds label-based trigger so the full orchestrate pipeline can be
exercised on a regular PR before merge queue.
Docker Desktop for Mac has a race condition where `docker compose up -d`
can create a network, assign it to a container, then find the network
gone by the time the container starts. This happens especially during
rapid teardown/recreate cycles.

Fix: pre-create the project network with correct compose labels before
the first `composeUp` call. Also explicitly sweep stale networks in
`down()` after component teardown, matching the cleanup the no-state
path already does.
…chdog

Instead of blanking GATEWAY_RPC_URL to disable the ConsensusWatchdog
during the ciphertext-drift test, pass EXPECT_CIPHERTEXT_DIVERGENCE=true
so both detection layers run and confirm the injected divergence.

Also fix the orchestrate label trigger to match the actual GitHub label.
…ft test

After the gw-listener confirms the drift warning, query the gateway
chain for AddCiphertextMaterial events and verify the two coprocessor
submissions produced distinct ciphertext digests.

Reverts the earlier ConsensusWatchdog changes — the watchdog is a
safety net for normal tests, not the right place for intentional
drift assertions.
The resolve step during normal boot only printed the lock name
(e.g. latest-main-73e9e30.json) without the individual component
versions. The dry-run path already printed the detailed breakdown.
Now both paths print the full version matrix so CI logs always show
exactly which image tags were used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed e2e orchestrate test Run the test-suite-orchestrate-e2e-tests on a PR (instead of merge-queue) e2e When set on a PR, will enable & trigger a run of e2e tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants