Skip to content

Fix project creation overwriting existing documents#6

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-feee
Draft

Fix project creation overwriting existing documents#6
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-feee

Conversation

@cursor

@cursor cursor Bot commented Jun 9, 2026

Copy link
Copy Markdown

Bug and impact

project_create only checked _index.json for duplicate project IDs, then unconditionally wrote projects/{id}/document.md. If an agent/user had already created that document through project_write or workspace files before metadata existed, a later project_create silently replaced the real content with the default stub or initialDocument, causing data loss.

Root cause

Project existence was defined solely by metadata in workspace/projects/_index.json; the backing document path was not checked before creation wrote to disk.

Fix

  • Treat an existing projects/{id}/document.md as user data during create_project.
  • Adopt the existing document into the index when no initialDocument is supplied.
  • Refuse creation with initialDocument when the document already exists, directing replacement through project_write instead.
  • Added regression tests for preserving an unindexed document and refusing an explicit overwrite.

Validation

  • cargo +stable test --locked --manifest-path src-tauri/Cargo.toml projects::tests -- --nocapture
  • cargo +stable test --locked --manifest-path src-tauri/Cargo.toml
  • npm run build
Open in Web View Automation 

Co-authored-by: g00sifer Development Lab <g00siferdev-py@users.noreply.github.com>
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