Skip to content

fix: build no Muse Code session map in read-only mode - #62

Open
leninworld wants to merge 1 commit into
Graphicle-AI:mainfrom
leninworld:fix-read-only-muse-pack
Open

leninworld wants to merge 1 commit into
Graphicle-AI:mainfrom
leninworld:fix-read-only-muse-pack

Conversation

@leninworld

Copy link
Copy Markdown
Contributor

Summary

  • docs/configuration.md says --read-only (or GRAPHICLE_READ_ONLY=1) opens the data folder without changing it. Muse Code's session map build did not check the mode: graphicle --read-only hook muse pack --project <id>, which a Muse Code session start runs detached (and which gets GRAPHICLE_READ_ONLY=1 since fix: pass --read-only on to the processes graphicle starts itself #59), created muse-code-packs/ with its .lock and the <project>-<tokens>.md pack in the data folder. This was the leftover named in fix: pass --read-only on to the processes graphicle starts itself #59.
  • muse_code::build_pack now returns the read-only refusal (db::READ_ONLY_REFUSAL) before it opens the session or touches the folder. The hook drops the error as before, so it still exits 0 and prints nothing.
  • docs/configuration.md: Muse Code's session map is added to what read-only mode does not write.

Not changed:

  • session_pack still starts the detached build when no fresh pack is kept; in read-only mode that build is now refused at once. Skipping the start in read-only mode would save a process per session start; I kept this to one check.
  • A pack already in the folder is still read and served in read-only mode.

Test plan

  • New read_only::a_read_only_muse_pack_build_writes_nothing (tests/it/read_only.rs): two data folders after a normal sync. The plain hook muse pack --project <id> writes one pack holding price_with_tax into the first (so the command reaches the build). On the second, --read-only pack answers (the store opens read-only), then --read-only hook muse pack and the same hook with GRAPHICLE_READ_ONLY=1 leave every file and folder unchanged byte for byte. On main it fails with "the muse pack build changed the read-only data folder".
  • cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings, cargo clippy --locked --all-targets --features local-inference -- -D warnings and cargo test --locked --all-targets in crates/graphicle (lib 557 passed; it 576 passed, 3 ignored; extension 27 passed; Rust 1.95.0, macOS). Linux and Windows run in CI.

`build_pack` wrote muse-code-packs/ (folder, lock and pack) into the data
folder even under --read-only or GRAPHICLE_READ_ONLY=1, which promise to
leave the data folder unchanged. It now returns the read-only refusal
before it touches the folder.

Signed-off-by: Lenin Mookiah <2639584+leninworld@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

1 participant