Skip to content

fix(core): support type metadata in edit note - #1472

Merged
phernandez merged 4 commits into
mainfrom
codex/finish-1417-note-type-metadata
Sep 4, 2026
Merged

fix(core): support type metadata in edit note#1472
phernandez merged 4 commits into
mainfrom
codex/finish-1417-note-type-metadata

Conversation

@phernandez

@phernandez phernandez commented Sep 4, 2026

Copy link
Copy Markdown
Member

Summary

  • preserve and integrate the contributor change from fix(core): let edit_note metadata set a note's type #1417 so edit_note can update note type metadata
  • make append/prepend auto-creation honor the requested type as well
  • normalize and validate type values through the canonical NoteType boundary

Why

edit_note(..., metadata={"type": ...}) previously reported success without changing an existing note's type. The contributor fix correctly made type writable, but the complete feature also needs consistent behavior when append/prepend creates a missing note and must prevent invalid type values from entering frontmatter.

Implementation

  • cherry-pick the author's commit with provenance preserved
  • pass metadata type into the Entity used by the auto-create path
  • make explicit metadata type override conflicting type frontmatter during auto-create without corrupting BOM-prefixed notes
  • validate existing-note metadata updates with the same NoteType definition used at API boundaries
  • add explicit integration coverage for append creation, prepend creation, conflicting and BOM-prefixed frontmatter, and invalid blank types

Testing

  • uv run pytest tests/services/test_entity_service_prepare.py test-int/mcp/test_edit_note_integration.py -q (52 passed)
  • uv run pytest test-int/mcp/test_edit_note_integration.py -q (25 passed after review fixes)
  • just fast-check

Attribution

Supersedes #1417 while preserving @samwachtel's original commit, authorship, sign-off, and cherry-pick provenance.

sammywachtel and others added 2 commits September 4, 2026 12:04
_METADATA_IDENTITY_FIELDS drops title, type and permalink from a metadata
merge, on the grounds that all three have dedicated resolution paths in
prepare_edit_entity_content that a merge would race.

That holds for two of the three. A merged title can be overwritten by
reconcile_prepared_edit_title_from_h1, and a merged permalink can come back
suffixed from resolve_permalink, so in both cases the caller's value can
vanish without a word. type has no such second opinion. Its whole "resolution
path" is one line reading the frontmatter back out, and the note_type that
reaches the database comes from re-parsing the merged markdown - so writing
type into frontmatter feeds that path instead of fighting it.

Net effect before this change: edit_note(..., metadata={"type": "decision"})
returned success and changed nothing, with no way for the caller to tell.

Drop type from the exclusion set and leave title and permalink where they
are. Tests cover both halves: type now lands in the file's frontmatter and in
the indexed entity, and title and permalink are still refused.

Signed-off-by: samwachtel <sammy@wachtel.us>
(cherry picked from commit e301d13)
Signed-off-by: phernandez <paul@basicmachines.co>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-04T17:36:45.261776Z 838381c New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 290fb35314

ℹ️ 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".

Comment thread src/basic_memory/mcp/tools/edit_note.py
Signed-off-by: phernandez <paul@basicmachines.co>

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 536c5e64a7

ℹ️ 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".

Comment thread src/basic_memory/mcp/tools/edit_note.py Outdated
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez
phernandez merged commit ecceae5 into main Sep 4, 2026
28 checks passed
@phernandez
phernandez deleted the codex/finish-1417-note-type-metadata branch September 4, 2026 18:08
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