diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-07 01:17:29 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-07 01:17:29 +0200 |
| commit | 435f54b382004de28196aa44c9b1d2c7368ae212 (patch) | |
| tree | 7cb177304de9acba08813fdbc8611742254d357d /packages/meshbay-node/tests/test_cli_dispatch.py | |
| parent | 2d3cbdec301c592daa2faff8e1ca1cab155ebb58 (diff) | |
| download | meshbay-435f54b382004de28196aa44c9b1d2c7368ae212.tar.gz | |
fix(node): remove --upload-dir rather than document it
Caught in review, and the review was right. The previous commit documented the
flag as deprecated so that `--help` and the man page would agree. That solved
the wrong problem: the flag contradicts the model this whole refactor exists to
establish, and the coherent answer was to delete it.
It wrote `upload_dir` into a *brand-new* `[[groups]]` block, and
`GroupConfig.__post_init__` reads that key by forcing every other root
read-only and appending that path as the one writable one. So
`group add --dir X --writable --upload-dir Y` silently made X read-only — two
mechanisms deciding which directories accept uploads, one of them invisible, in
a group created after the model that replaced it.
Gone from the CLI, from `ops.attach_group`, from the loopback API and from the
MNP `group_attach` payload, which now carries `writable` instead. The *read*
path in `config.py` is deliberately untouched: an existing node.toml using
`upload_dir` must keep working, and that is the only legitimate use left. The
man page says so under the config key, and no longer lists an option.
The test that guarded the deprecation wording now guards its absence — and
earned itself immediately by finding a `group add` usage string still offering
the flag.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011pvMdvLBG92jyhvD5pD6us
Diffstat (limited to 'packages/meshbay-node/tests/test_cli_dispatch.py')
| -rw-r--r-- | packages/meshbay-node/tests/test_cli_dispatch.py | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/packages/meshbay-node/tests/test_cli_dispatch.py b/packages/meshbay-node/tests/test_cli_dispatch.py index 1a01eba..cf91564 100644 --- a/packages/meshbay-node/tests/test_cli_dispatch.py +++ b/packages/meshbay-node/tests/test_cli_dispatch.py @@ -261,18 +261,32 @@ def test_a_removed_verb_says_what_replaced_it(): "the message does not name what replaced it") -def test_the_help_does_not_offer_the_old_upload_directory_as_current(): +def test_there_is_no_way_to_create_a_group_in_the_old_shape(): """ - `--upload-dir` still works — an existing script passing it keeps working — - but the help has to say it is the old spelling, or it reads as the way to - do this. + `--upload-dir` is gone, and documenting it as deprecated was the wrong + answer — which is what it got at first. + + It wrote `upload_dir` into a brand-new `[[groups]]` block, and + `GroupConfig.__post_init__` reads that by forcing *every other root + read-only* and appending that path as the one writable one. So + `group add --dir X --writable --upload-dir Y` silently made X read-only: + two mechanisms deciding which directories accept uploads, one of them + invisible, in a group created after the model that replaced it. + + Reading it stays — an existing node.toml must keep working, and that is the + only legitimate use. Writing it does not. """ import inspect source = inspect.getsource(daemon_mod.main) - # The whole call, not just its first string: an adjacent-literal help text - # is several strings, and matching only the first is how a test passes over - # the half that carries the meaning. - start = source.index('"--upload-dir"') - call = source[start:source.index("parser.add_argument", start + 1)] - assert "deprecated" in call.lower() - assert "root add" in call, "it does not name the replacement" + assert "--upload-dir" not in source, ( + "the CLI can still create a group in the pre-RO/RW shape") + + from meshbay_node import ops + params = inspect.signature(ops.attach_group).parameters + assert "upload_dir" not in params, ( + "attach_group still writes the legacy key") + + # The read path is deliberately untouched. + from meshbay_node.config import GroupConfig + assert "upload_dir" in inspect.getsource(GroupConfig), ( + "an existing node.toml using upload_dir would stop working") |