Skip to content

Commit 8be2932

Browse files
authored
Merge pull request #81 from KraHsu/feat/r0-1-cli-help-snapshots
test: CLI --help snapshot baseline (ROADMAP §9 PR R0.1)
2 parents 7b229bf + 859657f commit 8be2932

13 files changed

Lines changed: 417 additions & 0 deletions

‎CHANGELOG.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ trajectory so breaking changes can land in any minor release until the 1.0 stabi
88

99
### Added
1010

11+
- `tests/test_cli_help_snapshots.py` + `tests/snapshots/help-*.txt` —
12+
frozen baseline of every Typer command's `--help` output (root, cache,
13+
prof, list, info, play, eval, export, train, project, project new). The
14+
test runs the CLI in a deterministic subprocess (`NO_COLOR=1`,
15+
`TERM=dumb`, `COLUMNS=100`) and asserts byte-equality against the
16+
captured snapshot so the upcoming CLI decomposition (ROADMAP §9 Phase
17+
R4) and domain-owned-parsing refactor (Phase R3) can prove they are
18+
structural moves rather than behavioural edits. Intentional `--help`
19+
changes regenerate via `UPDATE_SNAPSHOTS=1 pytest
20+
tests/test_cli_help_snapshots.py`. Lands as ROADMAP §9 PR R0.1 — the
21+
smallest gate of the refactor chain.
1122
- `genelab train TASK --seeds 1,2,3 --parallel N` — fan-out multi-seed
1223
training. Each comma-separated seed is launched as an independent
1324
`genelab train` subprocess (concurrency capped by `--parallel`), with a

‎tests/snapshots/help-cache.txt‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
Usage: genelab cache [OPTIONS]
3+
4+
Create project-local simulation cache directories.
5+
6+
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮
7+
│ --help Show this message and exit. │
8+
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
9+

‎tests/snapshots/help-eval.txt‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
Usage: genelab eval [OPTIONS] TASK CHECKPOINT
3+
4+
Run a deterministic rollout of TASK against CHECKPOINT and write eval.json.
5+
6+
Reads ``extras['is_success']`` per-env when the task publishes it; otherwise ``success_rate`` in
7+
the output is ``null``.
8+
9+
╭─ Arguments ──────────────────────────────────────────────────────────────────────────────────────╮
10+
│ * task_id TASK Registered task id. [required] │
11+
│ * checkpoint PATH Trained checkpoint path (rsl_rl/skrl: .pt; sb3: .zip). [required] │
12+
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
13+
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮
14+
│ --num-envs,--num_envs INTEGER Parallel envs for the rollout. [default: 64] │
15+
│ --episodes INTEGER Minimum complete episodes to collect. │
16+
│ [default: 100] │
17+
│ --seed INTEGER RNG seed (env-level only; policy is │
18+
│ deterministic). │
19+
│ [default: 0] │
20+
│ --deterministic --stochastic Use deterministic policy (default) or sample │
21+
│ from the distribution. │
22+
│ [default: deterministic] │
23+
│ --out PATH Output JSON path. [default: eval.json] │
24+
│ --max-steps INTEGER Safety cap on rollout steps. │
25+
│ --help Show this message and exit. │
26+
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
27+

‎tests/snapshots/help-export.txt‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
Usage: genelab export [OPTIONS] TASK CHECKPOINT
3+
4+
Export TASK's policy at CHECKPOINT to TorchScript or ONNX.
5+
6+
The exported model takes raw obs in and emits actions; per-term scale/clip are baked in
7+
(deployment side feeds raw, training-shape obs). A sibling <OUTPUT>.metadata.json records the obs
8+
schema.
9+
10+
╭─ Arguments ──────────────────────────────────────────────────────────────────────────────────────╮
11+
│ * task_id TASK Registered task id. [required] │
12+
│ * checkpoint PATH Trained checkpoint path (rsl_rl/skrl: .pt; sb3: .zip). [required] │
13+
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
14+
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮
15+
│ --format -f TEXT Output format. One of ('torchscript', 'onnx'). [default: torchscript] │
16+
│ --out PATH Output file path. [default: policy.ts] │
17+
│ --opset INTEGER ONNX opset version (ignored for torchscript). [default: 17] │
18+
│ --help Show this message and exit. │
19+
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
20+

‎tests/snapshots/help-info.txt‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
Usage: genelab info [OPTIONS] NAME
3+
4+
Show detail for one registered task, env, or robot.
5+
6+
╭─ Arguments ──────────────────────────────────────────────────────────────────────────────────────╮
7+
│ * name TEXT Registered task, env, or robot name. [required] │
8+
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
9+
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮
10+
│ --help Show this message and exit. │
11+
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
12+

‎tests/snapshots/help-list.txt‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
Usage: genelab list [OPTIONS] KIND:{robots|envs|tasks}
3+
4+
List registered robots, envs, or tasks.
5+
6+
╭─ Arguments ──────────────────────────────────────────────────────────────────────────────────────╮
7+
│ * kind KIND:{robots|envs|tasks} Registry kind to list. [required] │
8+
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
9+
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮
10+
│ --help Show this message and exit. │
11+
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
12+

‎tests/snapshots/help-play.txt‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
2+
Usage: genelab play [OPTIONS] [TASK]
3+
4+
Run a registered task.
5+
6+
Shorthand flags rewritten into env overrides:
7+
8+
9+
-v, --vis Enable the Genesis viewer (env.simulation.vis=true).
10+
--gpu Use the GPU backend (env.simulation.gpu=true).
11+
--steps N Run for N steps. Play: env.simulation.steps=N.
12+
Train: alias for --max_iterations N.
13+
--dt SECONDS Override the sim timestep (env.simulation.dt=SECONDS).
14+
--a.b.c VALUE Set any dotted cfg path.
15+
16+
Runner flags (used when an RL runner is engaged):
17+
18+
19+
--num_envs N Total parallel environments across all ranks.
20+
Must divide evenly by --gpus when both are set.
21+
--num_envs_per_gpu N Per-rank parallel environments. Mutually exclusive
22+
with --num_envs.
23+
--agent KIND one of: zero, random, trained (play only).
24+
--checkpoint PATH Resume from a checkpoint.
25+
--seed N RNG seed.
26+
--log_dir PATH Override the log directory.
27+
--max_iterations N Cap training iterations (train only).
28+
--gpus N Distributed training across N GPUs (train only).
29+
--eval_every K Run a deterministic eval every K iters and save
30+
best_model.<ext> on improvement (train only).
31+
--eval_episodes N Episodes to roll out per eval (train only, default 10).
32+
--eval_num_envs N Envs used during eval (train only, default = train num).
33+
--eval_seed N Seed for the eval rollout (train only, default 0).
34+
--seeds 1,2,3 Fan out into N independent train runs, one per seed
35+
(train only). Each child gets --log_dir <parent>/seed_<S>.
36+
--parallel N Cap concurrent multi-seed train workers (train only,
37+
default 1). Ignored unless --seeds is set.
38+
39+
Profiling flags (forwarded to torch.profiler; rank-0 only):
40+
41+
42+
--prof Enable the profiler (overrides GENELAB_PROFILE).
43+
--prof-out PATH TensorBoard trace directory (GENELAB_PROFILE_OUT).
44+
--prof-wait N Schedule wait steps (GENELAB_PROFILE_WAIT, default 10).
45+
--prof-warmup N Schedule warmup steps (GENELAB_PROFILE_WARMUP, default 5).
46+
--prof-active N Schedule active steps (GENELAB_PROFILE_ACTIVE, default 10).
47+
--prof-repeat N Schedule cycles (GENELAB_PROFILE_REPEAT, default 2).
48+
--prof-record-shapes Record tensor shapes for op input attribution.
49+
--prof-with-stack Capture Python stack traces (high overhead).
50+
51+
Use `genelab info TASK` to see the full overridable path list for a task.
52+
Use `genelab prof open [DIR]` to launch TensorBoard against a trace directory.
53+
54+
╭─ Arguments ──────────────────────────────────────────────────────────────────────────────────────╮
55+
│ task_id [TASK] Registered task id (omit for an interactive picker). │
56+
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
57+
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮
58+
│ --help Show this message and exit. │
59+
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
60+

0 commit comments

Comments
 (0)