Skip to content

Add CLI resource rename and named posts - #203

Closed
LIghtJUNction wants to merge 1 commit into
work/issue-usage-integration-20260930from
work/resource-rename-20261001
Closed

LIghtJUNction wants to merge 1 commit into
work/issue-usage-integration-20260930from
work/resource-rename-20261001

Conversation

@LIghtJUNction

Copy link
Copy Markdown
Contributor

Users can now run msg rename <path-or-ID> <new-name> instead of manually assembling metadata/move operations. Post renames preserve the canonical .md suffix; 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 --name also 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.

Copilot AI balanced review requested due to automatic review settings September 30, 2026 16:14
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copy link
Copy Markdown
Contributor Author

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.

@LIghtJUNction

Copy link
Copy Markdown
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants