Skip to content

Removed world artifact mutation support#67

Merged
Tiendil merged 1 commit intomainfrom
feature/remove-world-writing-capability
Mar 30, 2026
Merged

Removed world artifact mutation support#67
Tiendil merged 1 commit intomainfrom
feature/remove-world-writing-capability

Conversation

@Tiendil
Copy link
Copy Markdown
Owner

@Tiendil Tiendil commented Mar 30, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 30, 2026 16:49
@Tiendil Tiendil merged commit 67d29fd into main Mar 30, 2026
3 checks passed
@Tiendil Tiendil deleted the feature/remove-world-writing-capability branch March 30, 2026 16:52
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes Donna’s ability to mutate “world artifacts” (update/copy/move/remove) and strips the related mutability modeling (readonly) from workspace config and world abstractions, aligning implementation with updated CLI/docs.

Changes:

  • Removed artifact mutation APIs (workspace/context helpers, world methods, CLI subcommands/options, and related errors).
  • Removed readonly from world/config models and implementations.
  • Updated documentation/specs and unreleased notes to reflect “read/validate only” artifact behavior.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
donna/workspaces/worlds/python.py Removes readonly field and readonly-related constructor wiring.
donna/workspaces/worlds/filesystem.py Removes artifact mutation methods and readonly gating; keeps session state/journal writing.
donna/workspaces/worlds/base.py Removes readonly field and update/remove abstract methods from the World interface.
donna/workspaces/errors.py Removes WorldReadonly error type.
donna/workspaces/config.py Removes readonly from WorldConfig and default world configs.
donna/workspaces/artifacts.py Removes artifact mutation functions and associated error classes; keeps fetch/extension helpers.
donna/context/artifacts.py Removes context-level update/copy/move/remove methods.
donna/cli/types.py Removes --extension option parsing/types used by the removed CLI mutation command(s).
donna/cli/commands/artifacts.py Removes update/copy/move/remove subcommands and updates CLI help text accordingly.
donna/artifacts/usage/worlds.md Updates spec to clarify Donna only reads/validates artifacts; mutation is external.
donna/artifacts/usage/cli.md Updates CLI docs to remove mutation commands and clarify artifact immutability.
changes/unreleased.md Adds migration/breaking-change notes for removal of artifact mutation support.
Comments suppressed due to low confidence (2)

donna/workspaces/worlds/filesystem.py:266

  • initialize(reset=True) can delete the entire configured world directory via shutil.rmtree(self.path). With readonly removed from the world/config model, there is no longer a config-level guardrail to prevent destructive deletes if a user misconfigures the session world path (e.g., pointing it to a non-workspace directory). Consider adding a safety check before rmtree (e.g., require self.session and/or require the path to be under the workspace’s .donna/ directory, and refuse/reset with a structured error otherwise).
    def initialize(self, reset: bool = False) -> None:
        if self.path.exists() and reset:
            shutil.rmtree(self.path)

        self.path.mkdir(parents=True, exist_ok=True)

donna/workspaces/worlds/filesystem.py:169

  • write_state/journal_reset/journal_add now always perform filesystem writes when session=True, but these methods don’t catch OSError/PermissionError from mkdir, write_bytes, or open. Since unwrap_to_error only converts UnwrapError, these exceptions will propagate and crash the CLI if the session world path is not writable. Consider wrapping the I/O in try/except OSError and returning a domain WorkspaceError (or similar) so the failure is reported as a normal ErrorsList.
    def write_state(self, name: str, content: bytes) -> Result[None, ErrorsList]:
        if not self.session:
            return Err([world_errors.WorldStateStorageUnsupported(world_id=self.id)])

        path = self.path / name
        path.parent.mkdir(parents=True, exist_ok=True)
        path.write_bytes(content)
        return Ok(None)

    def journal_reset(self) -> Result[None, ErrorsList]:
        if not self.session:
            return Err([world_errors.WorldStateStorageUnsupported(world_id=self.id)])

        path = self._journal_path()
        path.parent.mkdir(parents=True, exist_ok=True)
        path.write_bytes(b"")
        return Ok(None)

    def journal_add(self, content: bytes) -> Result[None, ErrorsList]:
        if not self.session:
            return Err([world_errors.WorldStateStorageUnsupported(world_id=self.id)])

        path = self._journal_path()
        path.parent.mkdir(parents=True, exist_ok=True)

        with path.open("ab") as stream:
            stream.write(content.rstrip(b"\n"))
            stream.write(b"\n")

        return Ok(None)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -1,2 +1,16 @@
### Migration

- Update your scripts and specs to use external tools or direct file edits to create, update, move, copy, or delete world artifacts instead using removed Donna commands.
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

The migration note has a grammatical issue that makes it harder to understand. Consider rephrasing to: “...delete world artifacts instead of using the removed Donna commands.”

Suggested change
- Update your scripts and specs to use external tools or direct file edits to create, update, move, copy, or delete world artifacts instead using removed Donna commands.
- Update your scripts and specs to use external tools or direct file edits to create, update, move, copy, or delete world artifacts instead of using the removed Donna commands.

Copilot uses AI. Check for mistakes.
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