From 8d278948c25f9a620ed1a810720f8f66dafa1ac8 Mon Sep 17 00:00:00 2001 From: Nidish Date: Wed, 21 Oct 2026 16:16:41 +0530 Subject: [PATCH] test(e2e): run the CLI e2e scenarios from e2e/cli through one make target The CLI e2e scripts move from scripts/ to e2e/cli/, one script per scenario, and the seven one-line Makefile targets that wrapped them become a single `make e2e-cli SCENARIO= [ARGS=...]` that discovers e2e/cli/*.sh. A new scenario is a new file, not a new target. Closes #1462 --- AGENTS.md | 7 ++- Makefile | 44 ++++++------------- README.md | 24 +++++----- e2e/cli/README.md | 22 ++++++++++ {scripts => e2e/cli}/battery.sh | 21 +++++---- .../cli/chain-head-failure-cause.sh | 2 +- .../cli/cross-product-ringvrf-context.sh | 2 +- .../cli/cross-product-ringvrf.sh | 4 +- .../cli/cross-product-signing.sh | 4 +- .../cli/cross-product-statement-proof.sh | 2 +- .../cli/cross-product-storage.sh | 2 +- .../cli/preimage-submit-prompt.sh | 2 +- .../cli/trusted-device-permission.sh | 2 +- .../src/testing/diagnosis-reports.test.ts | 2 +- rust/crates/truapi-host-cli/README.md | 24 +++++----- rust/crates/truapi-host-cli/SPEC.md | 8 ++-- .../truapi-host-cli/js/auto-signing-e2e.ts | 2 +- .../js/chain-head-failure-cause-e2e.ts | 2 +- .../js/chain-head-failure-cause-proxy.ts | 2 +- .../js/cross-product-ringvrf-context-e2e.ts | 2 +- .../js/cross-product-ringvrf-e2e.ts | 2 +- .../js/cross-product-signing-e2e.ts | 2 +- .../js/cross-product-statement-proof-e2e.ts | 2 +- .../js/cross-product-storage-e2e.ts | 2 +- rust/crates/truapi-host-cli/js/funding-e2e.ts | 2 +- rust/crates/truapi-host-cli/js/pocket-e2e.ts | 2 +- .../js/preimage-submit-prompt-e2e.ts | 4 +- .../js/scripts/chat-battery.ts | 2 +- .../js/scripts/funding-battery.ts | 2 +- .../js/scripts/pocket-battery.ts | 2 +- .../js/trusted-device-permission-e2e.ts | 4 +- rust/crates/truapi/tests/wire_result_shape.rs | 2 +- 32 files changed, 109 insertions(+), 99 deletions(-) create mode 100644 e2e/cli/README.md rename {scripts => e2e/cli}/battery.sh (95%) rename scripts/chain-head-failure-cause-e2e.sh => e2e/cli/chain-head-failure-cause.sh (96%) rename scripts/cross-product-ringvrf-context-e2e.sh => e2e/cli/cross-product-ringvrf-context.sh (97%) rename scripts/cross-product-ringvrf-e2e.sh => e2e/cli/cross-product-ringvrf.sh (95%) rename scripts/cross-product-signing-e2e.sh => e2e/cli/cross-product-signing.sh (94%) rename scripts/cross-product-statement-proof-e2e.sh => e2e/cli/cross-product-statement-proof.sh (95%) rename scripts/cross-product-storage-e2e.sh => e2e/cli/cross-product-storage.sh (97%) rename scripts/preimage-submit-prompt-e2e.sh => e2e/cli/preimage-submit-prompt.sh (96%) rename scripts/trusted-device-permission-e2e.sh => e2e/cli/trusted-device-permission.sh (96%) diff --git a/AGENTS.md b/AGENTS.md index 7c0e0dc407..a2ff100c70 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -78,8 +78,11 @@ hosts/imports.json source repository and imported revision per host, hosts/dotli/ dotli submodule docs/ design docs, RFCs, feature proposals scripts/codegen.sh regenerate the TS client from the Rust crate -scripts/battery.sh run the generated battery against both headless CLI host roles, - plus the Pocket phase a Worker execution serves +e2e/cli/ end to end scenarios against the headless CLI host, one script + each (battery.sh runs the generated battery); `make e2e-cli` + lists and runs them. Add a scenario as a file here, not as a + new Makefile target +e2e/host-playground/ host-playground suite run inside the native host apps scripts/bundle-size.mjs measure the JS/WASM of the asset groups given (raw, gzip, brotli); .github/actions/bundle-size takes them as `assets`, stores main's snapshot and comments the comparison on PRs diff --git a/Makefile b/Makefile index aec5c2b222..0e4f03a6b5 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # Run `make help` for the list of targets. .DEFAULT_GOAL := help -.PHONY: help setup build codegen test check fmt fmt-check check-generated clean playground wasm wasm-crypto-test uniffi uniffi-kotlin android-check provider-android-check ios-build ios-run ios-chat-run ios-chat-host-playground-run ios-chat-all android-jni android-publish-local dotli-link dev dev-cli dev-bootstrap debugger dev-link-check e2e-dotli e2e-cli-diagnosis e2e-signing-cli e2e-pairing-cli e2e-chat-cli e2e-pocket-cli e2e-cross-product e2e-preimage-submit-prompt e2e-trusted-device-permission e2e-chain-head-failure-cause e2e-cli-update e2e-host-playground-android e2e-host-playground-ios headless install cli-runner cli-dist matrix explorer xcframework android-chat-playground-run e2e-funding-cli +.PHONY: help setup build codegen test check fmt fmt-check check-generated clean playground wasm wasm-crypto-test uniffi uniffi-kotlin android-check provider-android-check ios-build ios-run ios-chat-run ios-chat-host-playground-run ios-chat-all android-jni android-publish-local dotli-link dev dev-cli dev-bootstrap debugger dev-link-check e2e-dotli e2e-cli-diagnosis e2e-cli e2e-cli-update e2e-host-playground-android e2e-host-playground-ios headless install cli-runner cli-dist matrix explorer xcframework android-chat-playground-run CARGO ?= cargo # The dated nightly CI runs; see nightly-toolchain. @@ -468,35 +468,19 @@ e2e-cli-diagnosis: cli-runner ## Full playground diagnosis in a plain browser ta cargo build --release -p truapi-host-cli cd $(PLAYGROUND) && TRUAPI_HOST_BIN="$(abspath target/release/truapi-host)" bun tests/e2e/cli-diagnosis.ts -e2e-signing-cli: ## Run the generated battery against the direct signing-host CLI. - scripts/battery.sh --signing-host - -e2e-pairing-cli: ## Run the generated battery against the paired pairing-host CLI. - scripts/battery.sh --pairing-host - -e2e-chat-cli: ## Run the Chat content-screening battery against a chat signing-host CLI. - scripts/battery.sh --chat-host - -e2e-pocket-cli: ## Run the Pocket protocol battery against a Pocket signing-host CLI. - scripts/battery.sh --pocket-host - -e2e-funding-cli: ## Run the funding battery against a scripted funding signing-host CLI. - scripts/battery.sh --funding-host - -CROSS_PRODUCT_SCENARIOS := $(patsubst scripts/cross-product-%-e2e.sh,%,$(wildcard scripts/cross-product-*-e2e.sh)) - -e2e-cross-product: ## One product uses another's storage, keys or accounts on the signing-host CLI. Pick a scenario with SCENARIO=. - @test -x scripts/cross-product-$(SCENARIO)-e2e.sh || { echo "SCENARIO must be one of: $(CROSS_PRODUCT_SCENARIOS)" >&2; exit 1; } - scripts/cross-product-$(SCENARIO)-e2e.sh - -e2e-preimage-submit-prompt: ## Upload preimages under a PreimageSubmit grant on the signing-host CLI with no per-upload confirmation. - scripts/preimage-submit-prompt-e2e.sh - -e2e-trusted-device-permission: ## Send a notification as a trusted product on the signing-host CLI with no device permission prompt. - scripts/trusted-device-permission-e2e.sh - -e2e-chain-head-failure-cause: ## Cut the chain connection under a chain-head call on the signing-host CLI; both failures must name their cause. - scripts/chain-head-failure-cause-e2e.sh +# Every e2e/cli/.sh is a scenario; add one by adding a file, not a target. +# See e2e/cli/README.md. +E2E_CLI_SCENARIOS := $(sort $(patsubst e2e/cli/%.sh,%,$(wildcard e2e/cli/*.sh))) + +e2e-cli: ## Run e2e/cli/.sh against the headless CLI host, passing ARGS through. Lists scenarios without SCENARIO. + @if [ -z "$(SCENARIO)" ]; then \ + echo "Usage: make e2e-cli SCENARIO= [ARGS=...]"; echo; echo "Scenarios:"; \ + printf ' %s\n' $(E2E_CLI_SCENARIOS); \ + elif [ -n "$(filter $(SCENARIO),$(E2E_CLI_SCENARIOS))" ]; then \ + echo "e2e/cli/$(SCENARIO).sh $(ARGS)"; "e2e/cli/$(SCENARIO).sh" $(ARGS); \ + else \ + echo "SCENARIO must be one of: $(E2E_CLI_SCENARIOS)" >&2; exit 1; \ + fi e2e-cli-update: cli-dist ## Install the packaged truapi-host from a fake release and self-update it, with no network. node scripts/e2e-cli-update.mjs diff --git a/README.md b/README.md index 272bda4e99..c306c5904e 100644 --- a/README.md +++ b/README.md @@ -143,8 +143,8 @@ docs/ Design docs, RFCs, feature proposals scripts/codegen.sh Regenerate the TS client from the Rust source scripts/refresh-host-import.sh Refresh a vendored host tree from its source repository -scripts/battery.sh Run the generated battery against both headless CLI host roles, - plus the Pocket phase a Worker execution serves +e2e/cli/ End to end scenarios against the headless CLI host, one script each, + including the generated battery; see its README scripts/bundle-size.mjs Measure the JS and WASM the truapi-* packages ship, against a baseline scripts/ci-gates.py Evaluate .github/hosts.json, what each host is built from, into the ci.yml change gates @@ -361,23 +361,25 @@ CLI reserved identities follow the selected network's dotNS suffix. Old account and pairing stores are left unused as the CLI starts fresh under its [versioned state directory](rust/crates/truapi-host-cli/README.md#state-directory). -`scripts/battery.sh` drives that CLI from source over every code-generated +`e2e/cli/battery.sh` drives that CLI from source over every code-generated example and writes both committed compatibility reports: `explorer/diagnosis-reports/spa/signing-host-cli.md` from a direct signing-host run, and `spa/pairing-host-cli.md` from a pairing host that the script pairs with a signing host it starts itself. ```bash -scripts/battery.sh # both phases -scripts/battery.sh --signing-host # direct phase only -scripts/battery.sh --pairing-host # paired phase only -make e2e-signing-cli # same direct signing-host phase -make e2e-pairing-cli # same paired pairing-host phase -make e2e-chat-cli # chat content screening against a chat signing-host -make e2e-pocket-cli # Pocket protocol check against a Pocket signing-host -make e2e-funding-cli # funding requests and statuses against a scripted funding host +e2e/cli/battery.sh # both phases +e2e/cli/battery.sh --signing-host # direct phase only +e2e/cli/battery.sh --pairing-host # paired phase only +e2e/cli/battery.sh --chat-host # chat content screening against a chat signing-host +e2e/cli/battery.sh --pocket-host # Pocket protocol check against a Pocket signing-host +e2e/cli/battery.sh --funding-host # funding requests and statuses against a scripted funding host +make e2e-cli SCENARIO=battery ARGS=--signing-host # same, through make ``` +The battery is one of the scenarios in [`e2e/cli/`](e2e/cli/README.md); `make e2e-cli` +lists them all. + The Pocket phase runs its product as a Worker execution, the only execution Pocket is served to. It seeds the CLI's in-memory Pocket host from `TRUAPI_POCKET_CARDS` (`loyalty,humanity:privileged`), which is what makes one diff --git a/e2e/cli/README.md b/e2e/cli/README.md new file mode 100644 index 0000000000..4303d26e87 --- /dev/null +++ b/e2e/cli/README.md @@ -0,0 +1,22 @@ +# End to end scenarios on the headless CLI host + +Each `.sh` here is one scenario: it builds `truapi-host` from the checkout, runs it with the product script and fixtures it needs from `rust/crates/truapi-host-cli/js/`, and exits non-zero when the scenario fails. Every script runs from anywhere and explains at its top what it proves and which environment variables it reads. + +Run one directly, or through make: + +```bash +e2e/cli/cross-product-storage.sh +make e2e-cli SCENARIO=cross-product-storage +make e2e-cli SCENARIO=battery ARGS=--signing-host # ARGS go to the script +make e2e-cli # list the scenarios +``` + +- `battery.sh`: the generated full-surface battery, with a phase per host role (`--signing-host`, `--pairing-host`, `--chat-host`, `--pocket-host`, `--funding-host`). The signing and pairing phases write the committed reports under `explorer/diagnosis-reports/spa/`. `--help` lists its options. +- `cross-product-*.sh`: one product uses another's storage, keys or accounts under a manifest grant. +- `preimage-submit-prompt.sh`: preimage uploads under a `PreimageSubmit` grant ask for no per-upload confirmation. +- `trusted-device-permission.sh`: a trusted product sends a notification with no device permission prompt. +- `chain-head-failure-cause.sh`: a chain-head call and follow cut by a closed connection both name their cause. + +## Adding a scenario + +Add an executable `.sh` here, and put the TypeScript it drives in `rust/crates/truapi-host-cli/js/`. `make e2e-cli` picks it up by its file name, so it needs no Makefile target. Only an end to end check that depends on another make target, such as `e2e-cli-update` on `cli-dist`, gets a target of its own. diff --git a/scripts/battery.sh b/e2e/cli/battery.sh similarity index 95% rename from scripts/battery.sh rename to e2e/cli/battery.sh index 7afcfb8c32..ab78408a63 100755 --- a/scripts/battery.sh +++ b/e2e/cli/battery.sh @@ -7,13 +7,15 @@ # signing host this script starts # # Usage: -# scripts/battery.sh # both phases -# scripts/battery.sh --signing-host # direct phase only -# scripts/battery.sh --pairing-host # paired phase only -# scripts/battery.sh --pocket-host # Pocket phase only -# scripts/battery.sh --funding-host # funding phase only, on a test-host build -# scripts/battery.sh --release # build and run the release binary -# scripts/battery.sh -- --network foo # arguments after `--` go to every host process +# e2e/cli/battery.sh # both phases +# e2e/cli/battery.sh --signing-host # direct phase only +# e2e/cli/battery.sh --pairing-host # paired phase only +# e2e/cli/battery.sh --chat-host # Chat content-screening phase only +# e2e/cli/battery.sh --pocket-host # Pocket phase only +# e2e/cli/battery.sh --funding-host # funding phase only, on a test-host build +# e2e/cli/battery.sh --release # build and run the release binary +# e2e/cli/battery.sh --product-id # serve another product (default truapi-playground.dot) +# e2e/cli/battery.sh -- --network foo # arguments after `--` go to every host process # # Environment: # E2E_LIVE_CHAIN=1 widen routing to endpoints the preset carries @@ -39,7 +41,8 @@ set -euo pipefail -ROOT="$(cd "$(dirname "$0")/.." && pwd)" +ROOT="$(cd "$(dirname "$0")/../.." && pwd)" +SELF="$ROOT/e2e/cli/$(basename "$0")" cd "$ROOT" # Homebrew LLVM on DYLD_LIBRARY_PATH makes rustc and rustdoc load a mismatched @@ -66,7 +69,7 @@ RUN_POCKET=0 RUN_FUNDING=0 usage() { - awk 'NR == 1 { next } /^#/ { sub(/^# ?/, ""); print; next } { exit }' "$0" + awk 'NR == 1 { next } /^#/ { sub(/^# ?/, ""); print; next } { exit }' "$SELF" } while [ $# -gt 0 ]; do diff --git a/scripts/chain-head-failure-cause-e2e.sh b/e2e/cli/chain-head-failure-cause.sh similarity index 96% rename from scripts/chain-head-failure-cause-e2e.sh rename to e2e/cli/chain-head-failure-cause.sh index 8463afbff4..cc522d8c92 100755 --- a/scripts/chain-head-failure-cause-e2e.sh +++ b/e2e/cli/chain-head-failure-cause.sh @@ -6,7 +6,7 @@ # Read-only; nothing is written on chain. set -euo pipefail -repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" cd "$repo_root" script="rust/crates/truapi-host-cli/js/chain-head-failure-cause-e2e.ts" diff --git a/scripts/cross-product-ringvrf-context-e2e.sh b/e2e/cli/cross-product-ringvrf-context.sh similarity index 97% rename from scripts/cross-product-ringvrf-context-e2e.sh rename to e2e/cli/cross-product-ringvrf-context.sh index 31f333a00d..4f9716a63d 100755 --- a/scripts/cross-product-ringvrf-context-e2e.sh +++ b/e2e/cli/cross-product-ringvrf-context.sh @@ -18,7 +18,7 @@ # proves with was registered by a process that has already exited. set -euo pipefail -repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" cd "$repo_root" fixtures="rust/crates/truapi-host-cli/js/fixtures/ringvrf-context" diff --git a/scripts/cross-product-ringvrf-e2e.sh b/e2e/cli/cross-product-ringvrf.sh similarity index 95% rename from scripts/cross-product-ringvrf-e2e.sh rename to e2e/cli/cross-product-ringvrf.sh index fe7131a254..55a6f543fd 100755 --- a/scripts/cross-product-ringvrf-e2e.sh +++ b/e2e/cli/cross-product-ringvrf.sh @@ -4,7 +4,7 @@ # # One product signs with another product's registered ring-VRF key; only the # `context` grant in `peopl.paseo`'s local product config permits that. The -# sibling of `cross-product-storage-e2e.sh`, and the first end-to-end run in +# sibling of `cross-product-storage.sh`, and the first end-to-end run in # which a cross-product ring-VRF call is *granted* rather than refused. # # Unlike the storage sibling this reaches a chain: registering a ring-VRF key @@ -16,7 +16,7 @@ # registered by a process that has already exited. set -euo pipefail -repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" cd "$repo_root" fixtures="rust/crates/truapi-host-cli/js/fixtures" diff --git a/scripts/cross-product-signing-e2e.sh b/e2e/cli/cross-product-signing.sh similarity index 94% rename from scripts/cross-product-signing-e2e.sh rename to e2e/cli/cross-product-signing.sh index 58b675cdee..d0184f40e5 100755 --- a/scripts/cross-product-signing-e2e.sh +++ b/e2e/cli/cross-product-signing.sh @@ -4,7 +4,7 @@ # # One product signs with another product's account; only the manifest grant in # `peopl.paseo`'s local product config permits that. The sibling of -# `cross-product-ringvrf-e2e.sh`, for the same `context` scope on the signing +# `cross-product-ringvrf.sh`, for the same `context` scope on the signing # methods rather than on a ring-VRF key. # # Chain-free. Every manifest a phase resolves is seeded by `--product-config`, @@ -17,7 +17,7 @@ # parked by a process that has already exited. set -euo pipefail -repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" cd "$repo_root" fixtures="rust/crates/truapi-host-cli/js/fixtures" diff --git a/scripts/cross-product-statement-proof-e2e.sh b/e2e/cli/cross-product-statement-proof.sh similarity index 95% rename from scripts/cross-product-statement-proof-e2e.sh rename to e2e/cli/cross-product-statement-proof.sh index 2a4be56e8f..90d10480c0 100755 --- a/scripts/cross-product-statement-proof-e2e.sh +++ b/e2e/cli/cross-product-statement-proof.sh @@ -11,7 +11,7 @@ # locally, so nothing is submitted. set -euo pipefail -repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" cd "$repo_root" fixtures="rust/crates/truapi-host-cli/js/fixtures" diff --git a/scripts/cross-product-storage-e2e.sh b/e2e/cli/cross-product-storage.sh similarity index 97% rename from scripts/cross-product-storage-e2e.sh rename to e2e/cli/cross-product-storage.sh index 609b84b151..08422642c9 100755 --- a/scripts/cross-product-storage-e2e.sh +++ b/e2e/cli/cross-product-storage.sh @@ -14,7 +14,7 @@ # phases return was written by a process that has already exited. set -euo pipefail -repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" cd "$repo_root" fixtures="rust/crates/truapi-host-cli/js/fixtures" diff --git a/scripts/preimage-submit-prompt-e2e.sh b/e2e/cli/preimage-submit-prompt.sh similarity index 96% rename from scripts/preimage-submit-prompt-e2e.sh rename to e2e/cli/preimage-submit-prompt.sh index 4fd2130d1d..0bfad1babe 100755 --- a/scripts/preimage-submit-prompt-e2e.sh +++ b/e2e/cli/preimage-submit-prompt.sh @@ -12,7 +12,7 @@ # Bulletin submissions. set -euo pipefail -repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" cd "$repo_root" script="rust/crates/truapi-host-cli/js/preimage-submit-prompt-e2e.ts" diff --git a/scripts/trusted-device-permission-e2e.sh b/e2e/cli/trusted-device-permission.sh similarity index 96% rename from scripts/trusted-device-permission-e2e.sh rename to e2e/cli/trusted-device-permission.sh index 0e35cf2715..e8e031d087 100755 --- a/scripts/trusted-device-permission-e2e.sh +++ b/e2e/cli/trusted-device-permission.sh @@ -10,7 +10,7 @@ # front of it rather than whatever binary is installed. set -euo pipefail -repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" cd "$repo_root" script="rust/crates/truapi-host-cli/js/trusted-device-permission-e2e.ts" diff --git a/js/packages/truapi-host/src/testing/diagnosis-reports.test.ts b/js/packages/truapi-host/src/testing/diagnosis-reports.test.ts index 5b2a66160f..6225b915d5 100644 --- a/js/packages/truapi-host/src/testing/diagnosis-reports.test.ts +++ b/js/packages/truapi-host/src/testing/diagnosis-reports.test.ts @@ -7,7 +7,7 @@ import { fileURLToPath } from "node:url"; * `explorer/diagnosis-reports/spa/`, method by method. * * Both are written by the same generated battery -- the CLI's by - * `scripts/battery.sh`, the mock's by `scripts/fidelity-report.ts` -- so the + * `e2e/cli/battery.sh`, the mock's by `scripts/fidelity-report.ts` -- so the * rows line up and a difference means the two hosts answered differently on * the runs that produced them. * diff --git a/rust/crates/truapi-host-cli/README.md b/rust/crates/truapi-host-cli/README.md index 8717ea254e..e9d7961e95 100644 --- a/rust/crates/truapi-host-cli/README.md +++ b/rust/crates/truapi-host-cli/README.md @@ -730,12 +730,12 @@ Scripts under `js/scripts/` include: On top of the generated examples it runs one hand-written `Resource Allocation/auto_signing_e2e` case: allocate `AutoSigning`, then prove through the hosts' consulted-approval transcript - (`TRUAPI_APPROVALS_LOG`, exported per phase by `scripts/battery.sh`) that the + (`TRUAPI_APPROVALS_LOG`, exported per phase by `e2e/cli/battery.sh`) that the calls the grant covers — `sign_vrf`, `sign_raw`, `sign_payload` and `create_transaction` — run for the granting product without a confirmation prompt. - `scripts/battery.sh` at the repo root is the supported entry point. It + `e2e/cli/battery.sh` at the repo root is the supported entry point. It prepares the codegen output and playground dependencies the battery imports, builds the host from source, and produces both reports in one invocation: the direct signing-host phase, then the paired phase, where it starts a pairing @@ -744,18 +744,14 @@ Scripts under `js/scripts/` include: host flags so the battery can complete: ```bash - scripts/battery.sh # both phases - scripts/battery.sh --signing-host # direct phase only - scripts/battery.sh --pairing-host # paired phase only - make e2e-signing-cli # direct phase only - make e2e-pairing-cli # paired phase only - make e2e-chat-cli # chat phase only - scripts/battery.sh --pocket-host # Pocket phase only - make e2e-pocket-cli # Pocket phase only - scripts/battery.sh --funding-host # funding phase only, on a test-host build - make e2e-funding-cli # funding phase only - scripts/battery.sh --release # release binary - scripts/battery.sh -- --network foo # arguments after `--` go to every host process + e2e/cli/battery.sh # both phases + e2e/cli/battery.sh --signing-host # direct phase only + e2e/cli/battery.sh --pairing-host # paired phase only + e2e/cli/battery.sh --chat-host # chat phase only + e2e/cli/battery.sh --pocket-host # Pocket phase only + e2e/cli/battery.sh --funding-host # funding phase only, on a test-host build + e2e/cli/battery.sh --release # release binary + e2e/cli/battery.sh -- --network foo # arguments after `--` go to every host process ``` `BATTERY_PHASE_TIMEOUT` (default 900s) bounds each phase and diff --git a/rust/crates/truapi-host-cli/SPEC.md b/rust/crates/truapi-host-cli/SPEC.md index 8d25be4a88..069e87622b 100644 --- a/rust/crates/truapi-host-cli/SPEC.md +++ b/rust/crates/truapi-host-cli/SPEC.md @@ -1061,7 +1061,7 @@ The top-level `--script` option does not update remembered `/script` state. | `chat-battery.ts` | Run host-backed Chat screening diagnostics and write a report. | `battery.ts` writes to `explorer/diagnosis-reports/spa/-cli.md` unless -`TRUAPI_BATTERY_REPORT_PATH` overrides the destination. `scripts/battery.sh` in +`TRUAPI_BATTERY_REPORT_PATH` overrides the destination. `e2e/cli/battery.sh` in the repository root produces both reports in one invocation: it runs the direct signing-host phase, then starts a pairing host and answers its emitted link with a second signing host using the same product id and forwarded host flags @@ -1077,7 +1077,7 @@ confirmation being consulted. When `TRUAPI_APPROVALS_LOG` names a file, every host process appends one ` ` line per decided confirmation there before the confirmation resolves; the case reads the file to prove the prompt-free window (and is reported as skipped when the variable -is unset). `scripts/battery.sh` exports the variable for each phase, sharing +is unset). `e2e/cli/battery.sh` exports the variable for each phase, sharing one file across both paired-phase host processes. ## 11. Pairing lifecycle @@ -2295,7 +2295,7 @@ The implementation is covered by: - `truapi` runtime, protocol, cryptographic vector, and integration tests; - shared container, script-runner/Bun diagnosis and packaged-runtime tests; -- paired and direct `battery.ts` runs, both driven by `scripts/battery.sh`; and +- paired and direct `battery.ts` runs, both driven by `e2e/cli/battery.sh`; and - checked-in compatibility reports: - `explorer/diagnosis-reports/spa/pairing-host-cli.md` - `explorer/diagnosis-reports/spa/signing-host-cli.md` @@ -2312,7 +2312,7 @@ lists 45 methods and predates later additions to the surface, and only the signing-host report carries measured `Unsupported` Coin Payment details — the pairing-host report still records the older `HostFailure` shape, because the pairing phase needs a personhood ring member before it runs any method. It -refreshes on the next `make e2e-pairing-cli` run from such a signer. +refreshes on the next `e2e/cli/battery.sh --pairing-host` run from such a signer. Recommended local verification after CLI changes: diff --git a/rust/crates/truapi-host-cli/js/auto-signing-e2e.ts b/rust/crates/truapi-host-cli/js/auto-signing-e2e.ts index 55cbbecd94..5e5af4e4d4 100644 --- a/rust/crates/truapi-host-cli/js/auto-signing-e2e.ts +++ b/rust/crates/truapi-host-cli/js/auto-signing-e2e.ts @@ -3,7 +3,7 @@ // without consulting the host's confirmation prompt. // // The host CLI appends one ` ` line per decided -// confirmation to `TRUAPI_APPROVALS_LOG` (`scripts/battery.sh` exports it, and +// confirmation to `TRUAPI_APPROVALS_LOG` (`e2e/cli/battery.sh` exports it, and // in the paired phase both host processes inherit and share the file). A line // is written before the confirmation resolves, so any prompt a product call // consulted is on disk by the time the call returns: an empty `sign_vrf` diff --git a/rust/crates/truapi-host-cli/js/chain-head-failure-cause-e2e.ts b/rust/crates/truapi-host-cli/js/chain-head-failure-cause-e2e.ts index 882aa5246d..670e92a824 100644 --- a/rust/crates/truapi-host-cli/js/chain-head-failure-cause-e2e.ts +++ b/rust/crates/truapi-host-cli/js/chain-head-failure-cause-e2e.ts @@ -1,4 +1,4 @@ -// Product script for `scripts/chain-head-failure-cause-e2e.sh`, which describes +// Product script for `e2e/cli/chain-head-failure-cause.sh`, which describes // the check. const STORAGE_METHOD = "remote_chain_head_storage"; diff --git a/rust/crates/truapi-host-cli/js/chain-head-failure-cause-proxy.ts b/rust/crates/truapi-host-cli/js/chain-head-failure-cause-proxy.ts index c2207d20d2..ffb2dd49ca 100644 --- a/rust/crates/truapi-host-cli/js/chain-head-failure-cause-proxy.ts +++ b/rust/crates/truapi-host-cli/js/chain-head-failure-cause-proxy.ts @@ -1,4 +1,4 @@ -// WebSocket proxy for `scripts/chain-head-failure-cause-e2e.sh`. It closes the +// WebSocket proxy for `e2e/cli/chain-head-failure-cause.sh`. It closes the // connection when the host sends `chainHead_v1_storage` instead of forwarding // it, so the call is always in flight when its transport closes. // Usage: bun chain-head-failure-cause-proxy.ts diff --git a/rust/crates/truapi-host-cli/js/cross-product-ringvrf-context-e2e.ts b/rust/crates/truapi-host-cli/js/cross-product-ringvrf-context-e2e.ts index e6aea7b403..ec260dc2c5 100644 --- a/rust/crates/truapi-host-cli/js/cross-product-ringvrf-context-e2e.ts +++ b/rust/crates/truapi-host-cli/js/cross-product-ringvrf-context-e2e.ts @@ -1,5 +1,5 @@ // A ring-VRF proof in a third product's context, for -// paritytech/platform-bugs#99. Run by `scripts/cross-product-ringvrf-context-e2e.sh`, +// paritytech/platform-bugs#99. Run by `e2e/cli/cross-product-ringvrf-context.sh`, // once per phase, with the grants from local product configs: // // peopl.paseo grants dim2next `context`: the key grant. diff --git a/rust/crates/truapi-host-cli/js/cross-product-ringvrf-e2e.ts b/rust/crates/truapi-host-cli/js/cross-product-ringvrf-e2e.ts index e332c6926a..a5fd21ead2 100644 --- a/rust/crates/truapi-host-cli/js/cross-product-ringvrf-e2e.ts +++ b/rust/crates/truapi-host-cli/js/cross-product-ringvrf-e2e.ts @@ -17,7 +17,7 @@ // key resolves a ring on the People chain. // // The runner serves one product per host process, so -// `scripts/cross-product-ringvrf-e2e.sh` invokes this once per phase with +// `e2e/cli/cross-product-ringvrf.sh` invokes this once per phase with // `E2E_PHASE` set, pointing every run at the same `--base-path` so the key // registered in one is there for the next. // diff --git a/rust/crates/truapi-host-cli/js/cross-product-signing-e2e.ts b/rust/crates/truapi-host-cli/js/cross-product-signing-e2e.ts index 35886e7d01..cba87e42a8 100644 --- a/rust/crates/truapi-host-cli/js/cross-product-signing-e2e.ts +++ b/rust/crates/truapi-host-cli/js/cross-product-signing-e2e.ts @@ -20,7 +20,7 @@ // against a derived keypair. // // The runner serves one product per host process, so -// `scripts/cross-product-signing-e2e.sh` invokes this once per phase with +// `e2e/cli/cross-product-signing.sh` invokes this once per phase with // `E2E_PHASE` set, pointing every run at the same `--base-path` so the key // parked in one is there for the next. // diff --git a/rust/crates/truapi-host-cli/js/cross-product-statement-proof-e2e.ts b/rust/crates/truapi-host-cli/js/cross-product-statement-proof-e2e.ts index e1999013db..88913e30d6 100644 --- a/rust/crates/truapi-host-cli/js/cross-product-statement-proof-e2e.ts +++ b/rust/crates/truapi-host-cli/js/cross-product-statement-proof-e2e.ts @@ -9,7 +9,7 @@ // // The CLI appends one line per consulted confirmation to // `TRUAPI_APPROVALS_LOG`, and this counts the `sign statement proof` lines. -// `scripts/cross-product-statement-proof-e2e.sh` runs it as `dim2next.paseo`, +// `e2e/cli/cross-product-statement-proof.sh` runs it as `dim2next.paseo`, // which `dim2.paseo`'s local product config grants `context`. Neither label // is one the host trusts outright, which would skip the confirmation. diff --git a/rust/crates/truapi-host-cli/js/cross-product-storage-e2e.ts b/rust/crates/truapi-host-cli/js/cross-product-storage-e2e.ts index 94a0615e80..9d6245967e 100644 --- a/rust/crates/truapi-host-cli/js/cross-product-storage-e2e.ts +++ b/rust/crates/truapi-host-cli/js/cross-product-storage-e2e.ts @@ -10,7 +10,7 @@ // on Asset Hub before refusing, so the `read-missing` phase does reach the // network. // -// The runner serves one product per host process, so `scripts/cross-product-storage-e2e.sh` +// The runner serves one product per host process, so `e2e/cli/cross-product-storage.sh` // invokes this once per phase with `E2E_PHASE` set, pointing every run at the // same `--base-path` so the storage written in one is there for the next. // diff --git a/rust/crates/truapi-host-cli/js/funding-e2e.ts b/rust/crates/truapi-host-cli/js/funding-e2e.ts index dcbb8e76b0..04e7081792 100644 --- a/rust/crates/truapi-host-cli/js/funding-e2e.ts +++ b/rust/crates/truapi-host-cli/js/funding-e2e.ts @@ -15,7 +15,7 @@ import type { import type { HostFundingStatusSubscribeItem } from "../../../../js/packages/truapi/src/generated/types.ts"; import type { DiagnosisRow } from "./diagnosis.ts"; -// The cases make their requests in the order `scripts/battery.sh` scripts the +// The cases make their requests in the order `e2e/cli/battery.sh` scripts the // host's outcomes: deliver:900, release:500, fail, dismiss. const WAIT_MS = 15_000; diff --git a/rust/crates/truapi-host-cli/js/pocket-e2e.ts b/rust/crates/truapi-host-cli/js/pocket-e2e.ts index b1dc080931..f91e42dfe9 100644 --- a/rust/crates/truapi-host-cli/js/pocket-e2e.ts +++ b/rust/crates/truapi-host-cli/js/pocket-e2e.ts @@ -14,7 +14,7 @@ import type { import type { HostPocketListSubscribeItem } from "../../../../js/packages/truapi/src/generated/types.ts"; import type { DiagnosisRow } from "./diagnosis.ts"; -/** Cards the battery seeds the host with; see `scripts/battery.sh`. */ +/** Cards the battery seeds the host with; see `e2e/cli/battery.sh`. */ export const SEEDED_CARDS = { removable: "loyalty", privileged: "humanity" }; const WAIT_MS = 15_000; diff --git a/rust/crates/truapi-host-cli/js/preimage-submit-prompt-e2e.ts b/rust/crates/truapi-host-cli/js/preimage-submit-prompt-e2e.ts index 9b49a0a038..9f85adfe4e 100644 --- a/rust/crates/truapi-host-cli/js/preimage-submit-prompt-e2e.ts +++ b/rust/crates/truapi-host-cli/js/preimage-submit-prompt-e2e.ts @@ -6,7 +6,7 @@ // the fix the host asked the user to approve each upload as well, so a // background backup prompted on every run. // -// `scripts/preimage-submit-prompt-e2e.sh` runs the host with `--auto-accept` +// `e2e/cli/preimage-submit-prompt.sh` runs the host with `--auto-accept` // and `TRUAPI_APPROVALS_LOG`, so every prompt the host raised is a line in that // file by the time the call that raised it resolves. // @@ -21,7 +21,7 @@ const PERMISSION_PROMPT = "approved remote permission"; const log = process.env.TRUAPI_APPROVALS_LOG; assert( log, - "TRUAPI_APPROVALS_LOG is not set; run scripts/preimage-submit-prompt-e2e.sh", + "TRUAPI_APPROVALS_LOG is not set; run e2e/cli/preimage-submit-prompt.sh", ); const transcript = () => existsSync(log) diff --git a/rust/crates/truapi-host-cli/js/scripts/chat-battery.ts b/rust/crates/truapi-host-cli/js/scripts/chat-battery.ts index ecd9414537..540e8c81e1 100644 --- a/rust/crates/truapi-host-cli/js/scripts/chat-battery.ts +++ b/rust/crates/truapi-host-cli/js/scripts/chat-battery.ts @@ -2,7 +2,7 @@ // Chat content screening against a real host, over the real wire. // // Run via: -// scripts/battery.sh --chat-host +// e2e/cli/battery.sh --chat-host // // which starts a signing host with `--execution-kind worker`, so the product // connection opens as a Worker execution and the CLI's in-memory chat host is diff --git a/rust/crates/truapi-host-cli/js/scripts/funding-battery.ts b/rust/crates/truapi-host-cli/js/scripts/funding-battery.ts index d911321d99..b0ea8a1caa 100644 --- a/rust/crates/truapi-host-cli/js/scripts/funding-battery.ts +++ b/rust/crates/truapi-host-cli/js/scripts/funding-battery.ts @@ -2,7 +2,7 @@ // Funding protocol check against a real host, over the real wire. // // Run via: -// scripts/battery.sh --funding-host +// e2e/cli/battery.sh --funding-host // // which builds the CLI with `--features test-host` and starts a signing host // with a scripted funding overlay, so a product's requests are shown, started diff --git a/rust/crates/truapi-host-cli/js/scripts/pocket-battery.ts b/rust/crates/truapi-host-cli/js/scripts/pocket-battery.ts index 850e2f0b0b..8d85ec72d2 100644 --- a/rust/crates/truapi-host-cli/js/scripts/pocket-battery.ts +++ b/rust/crates/truapi-host-cli/js/scripts/pocket-battery.ts @@ -2,7 +2,7 @@ // Pocket protocol check against a real host, over the real wire. // // Run via: -// scripts/battery.sh --pocket-host +// e2e/cli/battery.sh --pocket-host // // which starts a signing host with `--execution-kind worker` and a seeded card // set, so the product connection opens as a Worker execution and the CLI's diff --git a/rust/crates/truapi-host-cli/js/trusted-device-permission-e2e.ts b/rust/crates/truapi-host-cli/js/trusted-device-permission-e2e.ts index d004ccec0c..d589c7f187 100644 --- a/rust/crates/truapi-host-cli/js/trusted-device-permission-e2e.ts +++ b/rust/crates/truapi-host-cli/js/trusted-device-permission-e2e.ts @@ -2,7 +2,7 @@ // check for paritytech/platform-bugs#82. // // A trusted product gets device permissions without a prompt. Any other -// product is asked once. `scripts/trusted-device-permission-e2e.sh` runs this +// product is asked once. `e2e/cli/trusted-device-permission.sh` runs this // as one product of each kind, with `--auto-accept` and `TRUAPI_APPROVALS_LOG`, // so every prompt the host raised is a line in that file by the time the call // that raised it resolves. @@ -17,7 +17,7 @@ const DEVICE_PROMPT = "approved device permission"; const log = process.env.TRUAPI_APPROVALS_LOG; assert( log, - "TRUAPI_APPROVALS_LOG is not set; run scripts/trusted-device-permission-e2e.sh", + "TRUAPI_APPROVALS_LOG is not set; run e2e/cli/trusted-device-permission.sh", ); const trusted = process.env.E2E_TRUSTED === "1"; const transcript = () => diff --git a/rust/crates/truapi/tests/wire_result_shape.rs b/rust/crates/truapi/tests/wire_result_shape.rs index 8c1e49ed82..30888c515d 100644 --- a/rust/crates/truapi/tests/wire_result_shape.rs +++ b/rust/crates/truapi/tests/wire_result_shape.rs @@ -319,7 +319,7 @@ fn foreign_account_proof_encodes_a_domain_refusal() { // assertion would race the dispatch. That the grant is what refuses a // foreign handle is asserted in // `runtime::signing_host::tests::a_foreign_proof_is_refused_when_the_owner_granted_nothing` - // and end to end by `make e2e-cross-product SCENARIO=ringvrf`. + // and end to end by `make e2e-cli SCENARIO=cross-product-ringvrf`. let expected = versioned_result_err_payload(truapi::versioned::account::HostAccountCreateProofError::V1( v01::HostAccountCreateProofError::Rejected,