Repository navigation
Every argparse entry point under yeto/ takes full option names only; fewer look-alike hints; quoted preflight command - #925
Merged
Conversation
The command run up's dry run prints was joined with spaces; an argument with a space or a shell character (an inventory path, say) did not paste back as one word. It is shlex.join'ed now, as the launch gate already does. The customer K3.1 dry runs print the same line (nothing there needs quotes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0.6 offered look-alikes: --rl-max named --rl-image (0.78) next to the --rl-max-* options it is a prefix of. 0.8 keeps typos such as --modle (--model, 0.86) and --rl-imgae (--rl-image, 0.9). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The command tree, the NC pool tool and the Miles island moved to ExactArgumentParser in #904; the module entry points did not. The 62 modules that build a parser (node-side ones whose argv the launcher renders: engine sampler, init_from_release, tape_upload, store_dispense, role_switch, controller, health readers, spot watchdog, ssh_harness, learners, exporters, ...) now build an ExactArgumentParser; their sub-parsers inherit it. weights_sync.py and preflight/bench.py run as single files on a node (no yeto package there): they keep argparse and set allow_abbrev=False on the parser and, through parser_class, on every subcommand. Tests: every parser under yeto/ is exact (a plain ArgumentParser fails), the two standalone tools refuse a prefix in a subcommand, and error() replaces argparse's "unrecognized arguments" message only (another error, a caller's look-alike message and parse_known_args stay as they were); look-alike options are not offered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ked pack) PACK_FETCH_PY puts the pack's yeto/ files on sys.path and imports yeto.codepack before the tree is unpacked and verified; its contract (test_rl_ssh_resident's tiny pack of __init__.py + codepack.py) is a module with no top-level yeto import. It keeps argparse and sets allow_abbrev=False on the parser and its subcommands, like the two tools shipped alone to a node; the coverage test names it with them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… switch, #910) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
michaellchung
added a commit
that referenced
this pull request
Nov 26, 2026
…verage test) (#927) yeto/node/smoke.py (#894) built a plain argparse.ArgumentParser and landed after #925, whose coverage test requires every parser under yeto/ to be an ExactArgumentParser. The smoke runs as `python -m yeto.node.smoke` inside the adopted image with the yeto tree (it imports yeto.rl.engine.engine_sampler_entry), so it takes the exact parser. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #904. That PR moved the
yetocommand tree, the NC pool tool and the Miles island toExactArgumentParser. This one moves every other argparse entry point underyeto/, tightens the spelling hints, and quotes one printed command.1. Every module entry point takes full option names only
argparse.ArgumentParsernow build anExactArgumentParser. This includesdashboard/fleet_store.py, whosemergeCLI landed in fleet.jsonl: learner id as island_id, chunked copy into the run store #910 after the first switch. Their sub-parsers inherit it. They include:engine_sampler(_entry),init_from_release,tape_upload,store_dispense,role_switch,controller,health/*,spot/watchdog,ssh_harness,hw/node_health,node/relay_proxy;allow_abbrev=Falseon the parser and, throughparser_class, on every subcommand (a plainadd_subparserswould not inherit it):launch/weights_sync.pyandlaunch/preflight/bench.pyare shipped to the nodes as single files.weights_synceven runs underpython3 -I;codepack.pyis imported by a node from a partly unpacked pack (PACK_FETCH_PY) before the tree is verified. Its contract test packs only__init__.pyandcodepack.py. A first draft that importedyeto.exact_argparsethere broke that test, which is how this case was found.Who relied on abbreviations
I checked this three ways with one-off local scripts, none committed:
Full suite on main with an audit hook. The hook logs any long option that argparse resolved only by prefix, for every parser including all 65 entry points. Result: 0 hits.
Real rendered commands. On this branch I ran the full suite with a second hook. It parses each command at the point where it is rendered, using the target module's own parser. It hooks:
init_release_block,syncer_tape_sidecar,ssh_weights.sync_argv/node_script,nc.ssh_sampler.sampler_command,node.launch.process_argv/container_argv;subprocess.run/Popen/check_outputargv that runs-m yeto.<entry point>.Result: 91 rendered commands across 6 entry points, all parsed. Those entry points are
engine_sampler(36),init_from_release(39),weights_sync(9),hw/node_health(4),remote_code_prewarm(2) andstore_dispense(1). No test renders thetape_upload followline ofsyncer_tape_sidecar, so I parsed that template separately, along with thestore_dispense statuscall ofrun up. Both parse with no extras.Written command lines. Every place a command line for one of these modules is written down: renderers in the source, docs, examples, tests, scripts and tools. Every
--optiontoken was checked against that module's parser. Result: no token relies on a prefix. The three candidates the scan flagged were option names of other parsers on the same lines.2. Hints: fewer look-alikes; only argparse's message is replaced
--rl-maxoffered--rl-image(similarity 0.78) next to the--rl-max-*options it is a prefix of. At 0.8, typos are still offered:--modlegives--model(0.86),--rl-imgaegives--rl-image(0.9).error():unrecognized argumentsmessage for the extras of the last parse gains the hints, and its first line is kept verbatim;expected one argument);parse_known_argsstill returns the extras and never errors.3. run up: the dry run's preflight command is printed quoted
run up --dry-runprinted the trainer's cluster preflight command joined with spaces. An argument with a space did not paste back as one word. It now usesshlex.join, as the launch gate already did. The customer K3.1 bare-metal dry run prints the same line, because none of its arguments needs quoting.test_k31_baremetal_run_up_dry_runcompares that dry run line for line with main and passes.Tests and gates
tests/test_exact_option_names.pygains these tests:ArgumentParser(underyeto/is anExactArgumentParser. A plain one fails the test, as does afrom argparse import ArgumentParsercall. The three self-contained modules must setallow_abbrev=Falseon the parser and the subcommands, and must have no top-level yeto import;sync --workfor--workers,ports --peerfor--peers,verify --di);error()behavior and the look-alike cutoff described in section 2.tests/test_preflight_gate.py: a dry run with an inventory path that contains a space prints it as one shell word.from argparse import ArgumentParserparser;allow_abbrev=False;parser_class(weights_sync, codepack);codepack.py;error()replacing any message;allow_abbrevon by default;" ".joininstead ofshlex.join.run up --dry-runfor everyexamples/k31/run*.jsonand the pool--dry-run, compared line by line with origin/main. 5 outputs were compared.--shard i/4) on the final head: 18,477 passed, 0 failed. The same run carried the render hook described in section 1.🤖 Generated with Claude Code