Repository navigation
feat(core): enforce one-way locked notes in mutation APIs - #1486
Conversation
Signed-off-by: phernandez <paul@basicmachines.co>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1dc2803af7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: phernandez <paul@basicmachines.co>
|
@codex review Please review head 26c8050 against the clarified scope in the PR description. API note edits/overwrites/deletes and API directory deletion respect locked: true. Imports and direct filesystem edits/deletions are intentionally outside the contract; do not add import synchronization or filesystem access control. The directory offline-lock finding is fixed with a read-only preflight. Both prior threads have replies and are resolved. All 16 real locked-note integration tests pass on SQLite and PostgreSQL, plus 14 existing MCP/CLI deletion integration tests; pre-push local review found no actionable regressions. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 26c80506a8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Head remains 26c8050. Replied to and resolved the unindexed-file thread with the deletion-set evidence: this endpoint only deletes indexed Entity snapshots and never performs recursive directory removal. Unindexed raw files are not deletion targets and remain untouched. The lock must protect every note the API would mutate/delete; untouched unindexed files are outside this API contract, not a veto over sibling note deletion. Please keep filesystem discovery expansion out of scope. Imports/raw filesystem edits and deletions remain intentionally unrestricted as confirmed by the maintainer. |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Why
Implements the v0.24.0 locked-note scope agreed in #993: agents may set
locked: true, but cannot use Basic Memory note APIs to edit, overwrite, delete, or unlock that note afterward. Direct filesystem edits are explicitly outside the contract.Scope Clarification
locked: trueis a one-way guard for the note-mutation API, not filesystem security.delete_noteand API directory deletion are explicitly bound by the lock. These filesystem exceptions do not apply to note API operations.What Changed
locked: true.docs/LOCKED_NOTES.md.Implementation Details
The accepted mutation runner reads the existing
NoteContentbefore preparing the proposed replacement or edit. Incoming metadata, body frontmatter, or find/replace operations never authorize an unlock. Checks reuse the existing canonical mutation fence; no new database locks, identity system, privileged unlock route, or audit machinery were introduced. The local freshener reconciles direct file edits before individual note mutations.The directory path checks accepted Markdown before any deletion. A local read-only preflight also inspects current Markdown files before accepting the bulk delete, so an offline lock does not require waiting for the watcher. Hosted runtimes retain the accepted-content check. No new locks or file-write machinery were added. Importer and FileService behavior are unchanged from the base branch.
Testing
just fast-check: passed.uv run pytest test-int/test_locked_notes.py --no-cov -q: 16 passed on SQLite.uv run pytest tests/indexing/test_accepted_note_mutation_runner.py tests/indexing/test_directory_delete_runner.py tests/importers/test_importer_base.py --no-cov -q: 64 passed.uv run pytest test-int/mcp/test_delete_directory_integration.py test-int/cli/test_cli_tool_delete_note_integration.py --no-cov -q: 14 passed.BASIC_MEMORY_TEST_POSTGRES=1 uv run pytest test-int/test_locked_notes.py --no-cov -q: 16 passed against real PostgreSQL.codex review --uncommitted: no actionable regressions; reviewer independently passed all 16 locked-note integration tests before the follow-up push.just doctor: passed.Risks / Follow-ups