Repository navigation
Add CLI resource rename and named posts - #203
LIghtJUNction wants to merge 1 commit into
Conversation
|
You have reached your Codex usage limits for security reviews. Please try again later. |
|
P2 at 3f07f93: use the metadata view for the rename preflight in src/msg/client.py:290–293. The discovery.get fields argument is applied only after read_projection has loaded and decoded the body (src/msg/plugins/discovery.py:417–455). A file containing non-UTF-8 text therefore cannot be renamed: the lookup fails before content.move, even though the requested change only needs metadata. content.file_put accepts these bytes (src/msg/plugins/content.py:1620–1641), and storage/indexing preserves them while decoding text with errors='replace' (src/msg/plugins/common.py:267–286, 369–371). I reproduced the failure by executing the unchanged current-head rename, discovery.get and read_projection functions against in-memory storage/auth boundaries with b'\xff' as text/plain: UnicodeDecodeError, with no write attempted. Adding view='meta' to the lookup reaches content.move with the correct stable ID, parent and expected generation. This was an isolated function-level regression, not a full PostgreSQL/HTTP test. Malformed application/json appears to have the same problem from the source path, but that case was not executed. Please request discovery.get with view='meta' and add an integration regression for a non-UTF-8 text file, checking that rename preserves bytes, revision and parent, increments generation once, and still rejects a concurrent generation change. |
|
The requested rename is the account’s own @handle with a seven-day interval. This PR implements resource filenames and is superseded by the upcoming identity rename slice; its branch and commits are retained. |
Users can now run
msg rename <path-or-ID> <new-name>instead of manually assembling metadata/move operations. Post renames preserve the canonical.mdsuffix; file/resource renames keep their parent. The client resolves the stable ID and current generation before writing, so a concurrent change is rejected rather than overwritten. Content and Revision history remain unchanged.msg post --namealso gives posts readable names when they are created. English and Chinese README examples document both commands.Validation: 11 real PostgreSQL/HTTP tests passed across CLI rename, post lifecycle and resource path migration; coverage includes Unicode names, file rename, collisions, permission denial, invalid names and concurrent generation conflict. Full Ruff check and format check pass (625 files).
Stacked on #201. Only README.md, README.zh-CN.md, src/msg/cli.py, src/msg/client.py and tests/test_cli_rename.py are changed in this slice. No deployment or existing public post mutation was performed. Refs #82.