Plan: Refactor foc-devnet: agent-first, legible, footgun-free
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 重构
- 描述清晰度
- 需要澄清
- 活跃度
- 冷清
- 技术栈
- docker, rust
- 领域
- cli, devops, documentation, testing
调研方向
这是一个涵盖 CLI 生命周期、Docker 恢复、输出契约、场景和文档的广泛计划。首先运行当前的 foc-devnet --help 和生命周期命令,然后阅读 README、README_ADVANCED、scenarios/run.py 以及提议的 SYSTEM-CONTEXT.md 和 AGENTS.md。完成的标准是:已实现并验证所列出的恢复、引导、可读性、生命周期、测试和文档行为。
由索引模型根据 Issue 内容生成。
描述
Why
foc-devnet is likely to be increasingly driven by AI agents so a command's stdout should be viewed as the primary interface. This also obviously benefits humans arriving cold. Today the stdout interface is poor: output is unstructured trace spam, failures are opaque (clean can die with a bare PermissionDenied on Docker's own root-owned files), and the init->build->start lifecycle isn't discoverable from --help. The code has also drifted into 12 startup steps spread across 83 files, which makes it slow to change. This issue tracks making the CLI clear, recoverable, and easier to move forward on.
Guiding principle: every command's output is agent context. Say what happened, name the paths that matter, state what phase we're in, point at the next command, and be honest about damage and edges.
User-facing changes
Recovery / self-service
cleanself-heals the root-owned files Docker leaves behind instead of failing opaquely; lifecycle commands become retry-safe; poison is explained and cleared predictably.- New
doctorcommand: checks Docker,host.docker.internal, basedir ownership, ports, disk, poison, and binaries, with--fixfor the safe repairs.
Orientation
- New
foc-devnet system-contextprints a compact primer (what the devnet is, components, protocol, footguns) so a cold agent gets competent before acting;--helppoints to it.
Legible output
statusgains a phase line (built / running+run_id / poisoned) with source refs and the suggested next command.--output jsonwith a stable errorkindand a stable exit-code contract, so agents and CI can branch deterministically.- Each run writes a
run-summary.jsonhandoff so the next agent resumes from one artifact.
Fewer lifecycle surprises
--helpordered init->build->start->..., with honest command and flag descriptions.startrefuses to clobber a running cluster (opt-in override). Breaking.- Portainer becomes opt-in and is torn down by
stop. - Artifact-preserving reinit (keep proof params, binaries, builder cache).
Testing ergonomics
- Scenarios can run against a local Synapse worktree without patching the harness.
fund-user/ larger default deposit to unblock piece-heavy tests.
Documentation
- Consolidate the split README / README_ADVANCED into one README, plus a self-contained
SYSTEM-CONTEXT.md(the primer the command prints) and a checked-inAGENTS.md, each readable from a bare clone.
What it looks like
Illustrative target output, not current behavior.
--help (lifecycle-ordered, self-describing)
$ foc-devnet --help
Local Filecoin devnet for FOC integration testing.
Lifecycle: init -> build -> start -> stop/clean
Re-initializing requires `clean` first. State lives under
$FOC_DEVNET_BASEDIR (default ~/.foc-devnet).
Commands:
init Clone repos, generate keys, stage proof params, build Docker images
build Compile Lotus or Curio from the configured sources
start Bring up the cluster (5-10 min); writes devnet-info.json
status Show phase, run_id, sources, and the next command
doctor Check environment and known sharp edges; --fix repairs safe ones
system-context Print the primer: what the devnet is and how the pieces fit
stop Stop containers, keep state on disk
clean Remove run state (self-heals Docker-owned files; keeps config + images)
version Show build/version info
config Show resolved configuration
requirements Check/set up Docker prerequisites
Options:
--output <human|json> Output format (default: human)
-h, --help
A cold agent recovers and reaches a working devnet
$ foc-devnet status
Phase: poisoned (a prior command failed mid-run)
Basedir: /mnt/nvme2/foc-devnet
Recover: foc-devnet clean (clears poison, self-heals Docker-owned files)
$ foc-devnet doctor
ok Docker reachable, user in docker group
ok host.docker.internal present
FAIL Basedir has root-owned files: docker/volumes/cache/foc-builder
fix -> foc-devnet doctor --fix (or `clean`, which self-heals)
ok Ports 5700-5800 free
ok Free disk 812 GiB
warn Poison present -> `clean` clears it
ok Required binaries present in bin/
$ foc-devnet clean
Cleaned run state. Kept config.toml and cached images.
Self-healed 3 root-owned paths under docker/volumes/cache.
Cleared poison.
Next: foc-devnet start
$ foc-devnet start
[step 7/12] deploy FOC contracts ... done (128s)
...
Phase: running (run_id=20260701T1042_TizzyMoo)
devnet-info: /mnt/nvme2/foc-devnet/state/latest/devnet-info.json
run-summary: /mnt/nvme2/foc-devnet/state/latest/run-summary.json
Next: python3 scenarios/run.py or foc-devnet status
The same, machine-readable (--output json)
Agents branch on kind and exit code instead of grepping prose.
$ foc-devnet start --output json # transient chain error, exit 5
{"command":"start","status":"error","phase":"multicall3_deploy",
"kind":"chain_actor_unavailable","error":"actor not found: validation failure",
"advice":"f4 activation delay; retry in ~5s","logs":".../run/<id>/setup.log"}
$ foc-devnet start --output json # cluster already up, exit 3
{"command":"start","status":"error","kind":"cluster_running",
"run_id":"20260701T1042_TizzyMoo",
"advice":"stop it, use a different FOC_DEVNET_BASEDIR, or pass --force"}
start no longer silently clobbers a running cluster
$ foc-devnet start
Error: a cluster is already running (run_id=20260701T1042_TizzyMoo).
Stop it: foc-devnet stop
Isolate: FOC_DEVNET_BASEDIR=/mnt/nvme2/other foc-devnet start
Override: foc-devnet start --force (tears down the running cluster)
Internal cleanup (not user-facing)
Collapse the step-module sprawl, delete dead code, and unify the sequential/parallel step DAG, which also fixes a live bug: the default start currently skips the prerequisites check that --parallel runs.
- 主要语言
- Rust
- 星标
- 4
- 派生
- 6
- 平均合并
- 9 小时 6 分钟
- 30 天内合并 PR
- 12
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
FilOzone/foc-devnet 的其他 Issue
-
Use the global Filecoin proof parameter cache可能已有人在做 @galargh 于 64 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 62/100
FilOzone/foc-devnet#181 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 45/100
FilOzone/foc-devnet#127 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 38/100
FilOzone/foc-devnet#126 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 52/100
FilOzone/foc-devnet#125 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 25/100
FilOzone/foc-devnet#60 ·
维护者通常 1 天内回复
查看 FilOzone/foc-devnet 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
datafusion-contrib/StreamFusion#653 ·
维护者通常 1 天内回复
-
bug CLI exec session
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
tursodatabase/turso#11734 ·
维护者通常 1 天内回复
-
quality testing
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
compatibility
难度 1/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复