Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
44 changes: 14 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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=<name>.
@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/<name>.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/<SCENARIO>.sh against the headless CLI host, passing ARGS through. Lists scenarios without SCENARIO.
@if [ -z "$(SCENARIO)" ]; then \
echo "Usage: make e2e-cli SCENARIO=<name> [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
Expand Down
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions e2e/cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# End to end scenarios on the headless CLI host

Each `<name>.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 `<name>.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.
21 changes: 12 additions & 9 deletions scripts/battery.sh → e2e/cli/battery.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
24 changes: 10 additions & 14 deletions rust/crates/truapi-host-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions rust/crates/truapi-host-cli/SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/<role>-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
Expand All @@ -1077,7 +1077,7 @@ confirmation being consulted. When `TRUAPI_APPROVALS_LOG` names a file, every
host process appends one `<approved|denied> <action>` 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
Expand Down Expand Up @@ -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`
Expand All @@ -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:

Expand Down
Loading
Loading