Skip to content

Commit b591b0b

Browse files
authored
Merge pull request #155 from FlowmemoryAI/agent/production-l1-ops
[production-l1] ops implementation snapshot
2 parents 1c49d7f + 7aa17a0 commit b591b0b

38 files changed

Lines changed: 2721 additions & 3 deletions

docs/FLOWCHAIN_OPERATOR_CHECKLIST.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,13 @@ Second-computer readiness check:
3535

3636
```powershell
3737
npm run flowchain:prereq
38+
npm run flowchain:doctor
3839
npm run flowchain:init
39-
npm run flowchain:start
40+
npm run flowchain:node:start -- -MaxBlocks 3 -Wait
41+
npm run flowchain:node:status
4042
npm run flowchain:demo
4143
npm run flowchain:export
44+
npm run flowchain:production-l1:e2e
4245
```
4346

4447
Run `npm run flowchain:full-smoke` when the machine has the full prerequisite set,
@@ -48,6 +51,7 @@ Capped owner pilot preflight:
4851

4952
```powershell
5053
npm run flowchain:real-value-pilot:ops
54+
npm run flowchain:bridge:live:check
5155
```
5256

5357
Do not run live pilot actions until the owner has reviewed
@@ -164,6 +168,7 @@ Run before handoff when dependencies are installed:
164168
```powershell
165169
npm run flowchain:smoke
166170
npm run flowchain:full-smoke
171+
npm run flowchain:production-l1:e2e
167172
git diff --check
168173
```
169174

docs/FLOWCHAIN_SECOND_COMPUTER_SETUP.md

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,20 @@ The final package should provide these root-level commands or documented
210210
equivalents:
211211

212212
```powershell
213+
npm install
214+
npm install --prefix apps/dashboard
215+
npm install --prefix crypto
213216
npm run flowchain:prereq
217+
npm run flowchain:doctor
214218
npm run flowchain:init
215-
npm run flowchain:start
216-
npm run flowchain:stop
219+
npm run flowchain:node:start
220+
npm run flowchain:node:status
221+
npm run flowchain:node:stop
217222
npm run flowchain:demo
218223
npm run flowchain:smoke
219224
npm run flowchain:full-smoke
220225
npm run flowchain:product-e2e
226+
npm run flowchain:production-l1:e2e
221227
npm run flowchain:real-value-pilot:ops
222228
npm run flowchain:real-value-pilot:emergency-stop
223229
npm run flowchain:real-value-pilot:export
@@ -237,6 +243,10 @@ Current status:
237243
| `npm run flowchain:smoke` | Implemented for current private/local surfaces | Runs service tests, crypto validation, launch candidate, devnet tests, control-plane smoke, deterministic replay, dashboard build, hardware fixture, unsafe-claim scan, and no-secret export scan. |
238244
| `npm run flowchain:full-smoke` | Implemented acceptance gate | Wraps smoke, wallet CLI sign/verify, full-smoke report, no-secret scan, and `git diff --check`. |
239245
| `npm run flowchain:product-e2e` | Implemented product testnet gate | Wraps the full smoke and proves local account funding, token launch, DEX pool/liquidity/swap receipts, bridge-test records, control-plane product queries, workbench product surfaces, and no-secret API boundaries. |
246+
| `npm run flowchain:production-l1:e2e` | Implemented private/local ops wrapper gate | Runs prereq, init, bounded node start/status, wallet, transfer, product, token/DEX, bridge mock, live-readiness refusal, control-plane smoke, dashboard build, export/import, restart recovery, no-secret scan, unsafe-claim scan, and evidence export. |
247+
| `npm run flowchain:bridge:live:check` | Implemented fail-closed readiness check | Checks Base `8453` readiness only when env names are present; prints names, never values, and broadcasts nothing. |
248+
| `npm run flowchain:emergency:stop-local` | Implemented emergency local stop wrapper | Requests node stop and prints/manualizes local service stop commands. |
249+
| `npm run flowchain:emergency:export-evidence` | Implemented secret-scanned evidence export | Writes an ignored local evidence bundle under `devnet/local/production-l1-e2e/evidence/`. |
240250
| `npm run flowchain:real-value-pilot:ops` | Branch-local dry-run pilot ops proof | Parser-checks pilot scripts, proves dry-run needs no RPC or keys, verifies missing live env refusal, checks emergency-stop dry-run, and writes sanitized evidence export. |
241251
| `npm run flowchain:real-value-pilot:emergency-stop` | Branch-local guarded pause wrapper | Routes to the live `Pause` action after explicit acknowledgement, Base `8453` chain check, cap check, lockbox address check, and owner key check. |
242252
| `npm run flowchain:real-value-pilot:export` | Branch-local pilot evidence exporter | Writes a sanitized ignored bundle excluding Git metadata, dependency folders, build targets, local vaults, private-key files, and env files. |
@@ -346,3 +356,36 @@ This setup guide is complete for the HQ/Ops wrapper layer and current
346356
private/local acceptance gate. The next evidence step is running
347357
`npm run flowchain:full-smoke` on a clean second computer and recording the
348358
generated report.
359+
360+
## Current Final Wrapper Path
361+
362+
For the latest ops wrapper proof, use:
363+
364+
```powershell
365+
npm install
366+
npm install --prefix apps/dashboard
367+
npm install --prefix crypto
368+
npm run flowchain:production-l1:e2e
369+
```
370+
371+
The command writes:
372+
373+
```text
374+
devnet/local/production-l1-e2e/flowchain-production-l1-e2e-report.json
375+
devnet/local/production-l1-e2e/flowchain-production-l1-e2e-summary.md
376+
devnet/local/production-l1-e2e/evidence/flowchain-production-l1-evidence.zip
377+
```
378+
379+
For a no-GitHub-login transfer to a second computer, run:
380+
381+
```powershell
382+
npm run flowchain:second-computer:bundle
383+
```
384+
385+
Then move the generated zip from `devnet/local/second-computer/` to the second
386+
machine, extract it, install dependencies, and run:
387+
388+
```powershell
389+
npm run flowchain:second-computer:verify
390+
npm run flowchain:production-l1:e2e
391+
```

docs/FLOWCHAIN_TROUBLESHOOTING.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ From the repo root:
3838

3939
```powershell
4040
npm run flowchain:prereq
41+
npm run flowchain:doctor
4142
```
4243

4344
If that fails, fix the missing prerequisite before running init, demo, smoke,
@@ -64,6 +65,12 @@ or workbench commands.
6465
| Cargo cannot overwrite a Windows `.exe` under `target` | A running node, old test process, or stale shell is locking Cargo build output. | Run `npm run flowchain:node:stop`, close old PowerShell windows, and retry. If the lock remains, reboot before deleting ignored local build output. |
6566
| Existing state blocks init | `devnet/local/state.json` already exists. | Run `npm run flowchain:demo`, or force reset with `powershell -NoProfile -ExecutionPolicy Bypass -File infra/scripts/flowchain-init.ps1 -Force`. |
6667
| Import refuses to overwrite state | Import protects existing local state by default. | Run `npm run flowchain:import -- --BundlePath <zip> -Force`. |
68+
| Final wrapper says dashboard dependencies are missing | Dashboard package dependencies have not been installed. | Run `npm install --prefix apps/dashboard`. |
69+
| Final wrapper says crypto package dependencies are missing | Crypto package dependencies have not been installed. | Run `npm install --prefix crypto`. |
70+
| Final wrapper reports live readiness `blocked` | Live Base pilot env values are intentionally absent. | Run `npm run flowchain:bridge:live:check` after setting the required env names locally. |
71+
| Final wrapper reports missing strict live proof commands | Contracts, bridge, or runtime proof commands have not merged yet. | Read `devnet/local/production-l1-e2e/flowchain-production-l1-e2e-report.json` and the owner rows for issues #133, #138, and #134. |
72+
| Evidence export refuses a path | The export stage found an excluded or secret-shaped file. | Move env, vault, key, seed phrase, mnemonic, RPC credential, API key, or webhook files outside the evidence source and rerun `npm run flowchain:emergency:export-evidence`. |
73+
| Import root mismatch | Restored state does not match the exported root. | Rerun `npm run flowchain:export`, import to a fresh state path, and inspect `devnet/local/production-l1-e2e/export-import-root-compare.json`. |
6774

6875
## Clean Local Reset
6976

@@ -186,6 +193,17 @@ npm run flowchain:real-value-pilot:ops
186193
| Pause or resume cannot broadcast | `cast` is missing, the owner key is missing, or the key is not the lockbox owner. | Install Foundry, verify `$env:FLOWCHAIN_BASE8453_DEPLOYER_PRIVATE_KEY` in the local shell, and rerun the action. |
187194
| Evidence export refuses a file | The evidence directory contains an env file, local vault, private-key file, build output, or secret-named path. | Move that file outside the evidence directory and rerun `npm run flowchain:real-value-pilot:export`. |
188195

196+
Current ops readiness check:
197+
198+
```powershell
199+
npm run flowchain:bridge:live:check
200+
```
201+
202+
This command refuses missing acknowledgement, missing RPC URL, wrong Base chain
203+
ID, missing or malformed lockbox, missing token address when token mode requires
204+
one, missing or oversized caps, unsafe confirmation depth, and broad block
205+
ranges. It prints env names only.
206+
189207
## Smoke Evidence
190208

191209
After a successful smoke run, check:
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Backup Restore Proof
2+
3+
Commands:
4+
5+
```powershell
6+
npm run flowchain:export
7+
npm run flowchain:import -- --BundlePath devnet/local/export/flowchain-local-state.zip -StatePath devnet/local/production-l1-e2e/imported-state.json -Force
8+
npm run flowchain:restart:verify
9+
```
10+
11+
Latest comparison:
12+
13+
```text
14+
Original state root: 0x21be07858c24cc2ecb99fd5d2d0240aa251e13a0910455397855a993b549db6d
15+
Imported state root: 0x21be07858c24cc2ecb99fd5d2d0240aa251e13a0910455397855a993b549db6d
16+
Status: passed
17+
```
18+
19+
Evidence:
20+
21+
- `devnet/local/export/flowchain-local-state.zip`
22+
- `devnet/local/production-l1-e2e/export-import-root-compare.json`
23+
- `devnet/local/node-smoke/one-node-smoke-report.json`
24+
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Base Pilot Gate Proof
2+
3+
Readiness command:
4+
5+
```powershell
6+
npm run flowchain:bridge:live:check
7+
```
8+
9+
Latest readiness status:
10+
11+
```text
12+
status: blocked
13+
baseChainId: 8453
14+
broadcasts: false
15+
printsEnvValues: false
16+
```
17+
18+
Missing env names:
19+
20+
- `FLOWCHAIN_PILOT_OPERATOR_ACK`
21+
- `FLOWCHAIN_BASE8453_RPC_URL`
22+
- `FLOWCHAIN_BASE8453_LOCKBOX_ADDRESS`
23+
- `FLOWCHAIN_BASE8453_FROM_BLOCK`
24+
- `FLOWCHAIN_BASE8453_TO_BLOCK`
25+
- `FLOWCHAIN_PILOT_MAX_DEPOSIT_WEI`
26+
- `FLOWCHAIN_PILOT_TOTAL_CAP_WEI`
27+
- `FLOWCHAIN_BASE8453_CONFIRMATION_DEPTH`
28+
29+
Optional token-mode env names:
30+
31+
- `FLOWCHAIN_BASE8453_TOKEN_MODE`
32+
- `FLOWCHAIN_BASE8453_SUPPORTED_TOKEN`
33+
34+
Refusal rules implemented:
35+
36+
- Missing acknowledgement blocks readiness.
37+
- Missing RPC URL blocks readiness.
38+
- Wrong `eth_chainId` fails readiness; expected Base `8453`.
39+
- Missing or malformed lockbox address blocks or fails readiness.
40+
- Token mode requires a supported token address.
41+
- Missing, zero, negative, or oversized caps fail readiness.
42+
- Missing or unsafe confirmation depth blocks or fails readiness.
43+
- Broad block ranges fail readiness.
44+
- The check never prints live env values.
45+
46+
Strict live pilot proof remains incomplete until these commands exist:
47+
48+
- `npm run flowchain:real-value-pilot:contracts`
49+
- `npm run flowchain:real-value-pilot:bridge`
50+
- `npm run flowchain:real-value-pilot:runtime`
51+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Private/Local Ops Wrapper Checklist
2+
3+
- [x] Read `AGENTS.md`.
4+
- [x] Read `docs/START_HERE.md`.
5+
- [x] Read `docs/FLOWMEMORY_HQ_CONTEXT.md`.
6+
- [x] Read `docs/CURRENT_STATE.md`.
7+
- [x] Read FlowChain second-computer, troubleshooting, and operator docs.
8+
- [x] Read Rootflow, Flow Memory, and launch acceptance docs.
9+
- [x] Inventory existing scripts and root commands.
10+
- [x] Add missing tracking and proof docs.
11+
- [x] Add final `flowchain:production-l1:e2e` command with explicit non-production boundaries.
12+
- [x] Add command aliases for install, lifecycle, wallet, bridge, dashboard, storage, and emergency paths.
13+
- [x] Add parser checks for changed PowerShell scripts.
14+
- [x] Run required gates and record reports.
15+
- [x] Write handoff.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Command Matrix
2+
3+
Boundary: `flowchain:production-l1:e2e` is a private/local ops wrapper command. It does not claim production readiness or live-funds readiness.
4+
5+
| Command | Owner | Subsystem | Latest status | Evidence |
6+
| --- | --- | --- | --- | --- |
7+
| `npm run flowchain:prereq` | installer | install/prereq | passed | final report step `Prerequisite check` |
8+
| `npm run flowchain:doctor` | ops | install/config/status | passed | `devnet/local/doctor/flowchain-doctor-report.json` |
9+
| `npm run flowchain:init` | runtime/storage | local state | passed | final report step `Initialize local state` |
10+
| `npm run flowchain:second-computer:bundle` | ops | offline bundle | command exists | `infra/scripts/flowchain-second-computer-bundle.ps1` |
11+
| `npm run flowchain:second-computer:verify` | ops | second computer | command exists | `infra/scripts/flowchain-second-computer-verify.ps1` |
12+
| `npm run flowchain:node:start` | runtime | node lifecycle | passed in bounded mode | final report step `Node start bounded` |
13+
| `npm run flowchain:node:stop` | runtime | node lifecycle | command exists | existing stop wrapper |
14+
| `npm run flowchain:node:status` | runtime | node lifecycle | passed | final report step `Node status` |
15+
| `npm run flowchain:node:restart` | runtime | node lifecycle | command exists | `infra/scripts/flowchain-node-restart.ps1` |
16+
| `npm run flowchain:node:logs` | runtime/ops | observability | command exists | `infra/scripts/flowchain-node-logs.ps1` |
17+
| `npm run flowchain:wallet:e2e` | wallet/crypto | wallet | passed | `devnet/local/production-l1-e2e/wallet-e2e-report.json` |
18+
| `npm run flowchain:wallet:transfer:e2e` | wallet/runtime | transfer | passed | `devnet/local/production-l1-e2e/wallet-transfer/wallet-transfer-e2e-report.json` |
19+
| `npm run flowchain:product:e2e` | runtime/product | product flow | passed with `-SkipFullSmoke` after baseline | `devnet/local/product-e2e/flowchain-product-e2e-report.json` |
20+
| `npm run flowchain:dex:e2e` | runtime/token-dex | token/DEX | passed | `devnet/local/production-l1-e2e/dex/dex-e2e-report.json` |
21+
| `npm run flowchain:bridge:mock:e2e` | bridge-relayer | mock bridge | passed | final report step `Bridge mock pilot E2E` |
22+
| `npm run flowchain:bridge:live:check` | bridge/ops | Base 8453 readiness | blocked on env | `devnet/local/production-l1-e2e/bridge-live-readiness-report.json` |
23+
| `npm run flowchain:bridge:evidence:export` | ops/security | evidence | passed through emergency alias | `devnet/local/production-l1-e2e/evidence/flowchain-production-l1-evidence-export-report.json` |
24+
| `npm run flowchain:bridge:emergency-stop` | bridge/ops | emergency | command exists | guarded pause wrapper |
25+
| `npm run flowchain:control-plane:smoke` | control-plane | RPC/API | passed | final report step `Control-plane smoke` |
26+
| `npm run flowchain:dashboard:build` | dashboard | workbench | passed | final report step `Dashboard build` |
27+
| `npm run flowchain:dashboard:verify` | dashboard | workbench | command exists | build-backed verification |
28+
| `npm run flowchain:export` | storage | backup/export | passed | final report step `Export local state` |
29+
| `npm run flowchain:import` | storage | restore/import | passed | final report step `Import local state` |
30+
| `npm run flowchain:restart:verify` | runtime/storage | restart recovery | passed | `devnet/local/node-smoke/one-node-smoke-report.json` |
31+
| `npm run flowchain:l1:e2e` | integration | full local gate | passed | `devnet/local/full-smoke/flowchain-full-smoke-report.json` |
32+
| `npm run flowchain:l1-e2e` | integration | compatibility alias | passed | explicit verification run passed |
33+
| `npm run flowchain:real-value-pilot:e2e` | HQ/ops + subsystem owners | live pilot proof | incomplete by design | missing contracts, bridge-relayer, and runtime proof commands |
34+
| `npm run flowchain:production-l1:e2e` | ops | final wrapper | passed with live blockers | `devnet/local/production-l1-e2e/flowchain-production-l1-e2e-report.json` |
35+
| `npm run flowchain:no-secret:scan` | security | secret hygiene | passed | `devnet/local/production-l1-e2e/no-secret-scan-report.json` |
36+
| `npm run flowchain:emergency:stop-local` | ops | emergency | command exists | stop-node plus port stop plan |
37+
| `npm run flowchain:emergency:pause-bridge` | bridge/ops | emergency | command exists | guarded Base 8453 pause wrapper |
38+
| `npm run flowchain:emergency:export-evidence` | ops/security | emergency/evidence | passed | evidence export report |
39+
| `npm run flowchain:emergency:print-recovery` | ops | emergency/recovery | command exists | recovery report script |
40+
41+
Missing strict live-pilot proof commands:
42+
43+
- `flowchain:real-value-pilot:contracts`, owner `contracts`, reason: chain ID, lockbox, caps, pause, release/recovery, and replay proof; GitHub issue #133.
44+
- `flowchain:real-value-pilot:bridge`, owner `bridge-relayer`, reason: Base observation, deterministic credit, duplicate handling, and withdrawal/release evidence; GitHub issue #138.
45+
- `flowchain:real-value-pilot:runtime`, owner `chain-runtime`, reason: credit-once, restart, export/import preservation; GitHub issue #134.
46+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Emergency Drill Proof
2+
3+
Drill command set:
4+
5+
```powershell
6+
npm run flowchain:emergency:stop-local
7+
npm run flowchain:bridge:emergency-stop
8+
npm run flowchain:emergency:export-evidence
9+
npm run flowchain:emergency:print-recovery
10+
```
11+
12+
Local stop behavior:
13+
14+
- Requests the local node stop file through the runtime wrapper.
15+
- Lists control-plane/dashboard process stop commands for ports `8787` and `5173`.
16+
- Can stop known port processes when the underlying script is run with `-StopKnownPorts`.
17+
18+
Bridge pause behavior:
19+
20+
- Routes through `flowchain-real-value-pilot-emergency-stop.ps1`.
21+
- Live mode requires Base 8453 env, acknowledgement, caps, lockbox, and owner key.
22+
- Dry-run mode is covered by `npm run flowchain:real-value-pilot:ops`.
23+
24+
Evidence:
25+
26+
- Final evidence export passed.
27+
- Recovery commands are printed by `npm run flowchain:emergency:print-recovery`.
28+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Emergency Proof
2+
3+
Emergency command family:
4+
5+
```powershell
6+
npm run flowchain:emergency:stop-local
7+
npm run flowchain:bridge:emergency-stop
8+
npm run flowchain:emergency:pause-bridge
9+
npm run flowchain:emergency:export-evidence
10+
npm run flowchain:emergency:print-recovery
11+
```
12+
13+
What each command does:
14+
15+
- `flowchain:emergency:stop-local`: requests local node stop and prints/manualizes control-plane and dashboard port stop commands unless `-StopKnownPorts` is explicitly passed to the script.
16+
- `flowchain:bridge:emergency-stop`: routes to the guarded Base 8453 pause action.
17+
- `flowchain:emergency:pause-bridge`: same guarded pause path.
18+
- `flowchain:emergency:export-evidence`: writes a secret-scanned evidence bundle.
19+
- `flowchain:emergency:print-recovery`: writes and prints recovery commands.
20+
21+
Latest evidence export:
22+
23+
```text
24+
Bundle: devnet/local/production-l1-e2e/evidence/flowchain-production-l1-evidence.zip
25+
Status: passed
26+
SHA256: 45295F89EDAAA1BFDCE7EE4A1E16AF285554CD12B2166682F456A353333B79FD
27+
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Private/Local Ops Wrapper Experiments
2+
3+
This file records commands run while building the `flowchain:production-l1:e2e` ops wrapper. The wrapper is a private/local gate and does not claim production readiness.
4+
5+
| Time | Command | Result | Notes |
6+
| --- | --- | --- | --- |
7+
| 2026-05-14 | `npm install`; `npm install --prefix apps/dashboard`; `npm install --prefix crypto` | passed | Installed local dependencies needed for strict smoke and dashboard build. |
8+
| 2026-05-14 | PowerShell parser checks for changed scripts | passed | Parser checked new/changed ops scripts. |
9+
| 2026-05-14 | `npm run flowchain:wallet:transfer:e2e` | passed | Local test-unit transfer recorded in devnet state. |
10+
| 2026-05-14 | `npm run flowchain:dex:e2e` | passed | Product smoke proved token and DEX records. |
11+
| 2026-05-14 | `npm run flowchain:production-l1:e2e` | passed with live blockers | Mock path passed; live Base pilot blocked on env and missing proof commands. |
12+
| 2026-05-14 | `npm run flowchain:l1-e2e` | passed | Explicit compatibility alias verification. |
13+
| 2026-05-14 | `npm run flowchain:real-value-pilot:e2e` | incomplete | Strict live pilot gate blocked by missing contracts, bridge, and runtime proof commands. |
14+
| 2026-05-14 | `node infra/scripts/check-unsafe-claims.mjs` | passed | Claim scan clean. |
15+
| 2026-05-14 | `git diff --check` | passed | Whitespace check clean. |

0 commit comments

Comments
 (0)