Skip to content

Commit 5274c86

Browse files
committed
Require an explicit choice between entity_id and one_off, so forgetting entity_id is a loud error instead of a silent untracked page
1 parent 53ffda9 commit 5274c86

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

connectors/notion/tools.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,20 @@ async function appendIndexEntry({ entity_id, page_id, url }) {
9191
// marker + index-recording behavior per item, mirroring how mem/tools.js's
9292
// mem0_add and mem0_add_batch share logic. Returns a plain result object
9393
// instead of an MCP content block -- callers format the response.
94-
async function doCreatePage({ parent_id, parent_type, title, content, entity_id, status, relations }) {
94+
// 2026-07-18: NOT a hard entity_id requirement -- forcing entity_id on
95+
// every page would pollute the index with genuine scratch/one-off content
96+
// (test pages, quick notes) that was never meant to be deduped or tracked,
97+
// which defeats the index's purpose and doesn't match the same tradeoff
98+
// mem0_add already makes (entity_id optional there too, for the same
99+
// reason). Instead: require an EXPLICIT choice. Omitting entity_id AND
100+
// one_off is the actual failure mode worth catching -- someone forgetting
101+
// to track a thing that should be tracked -- so that case now throws
102+
// instead of silently creating an untracked page. Passing one_off: true is
103+
// the deliberate opt-out for real one-offs.
104+
async function doCreatePage({ parent_id, parent_type, title, content, entity_id, status, relations, one_off }) {
105+
if (!entity_id && !one_off) {
106+
throw new Error(`Refusing to create "${title}" without a tracking decision -- pass either entity_id (if this represents an ongoing/stable thing that should be deduped and indexed) or one_off: true (if it's genuinely disposable, e.g. a scratch note or test page). This is a deliberate choice, not a bug -- see notion_create_page's entity_id and one_off param descriptions.`);
107+
}
95108
if (entity_id) {
96109
const existing = await findPageByEntityId(entity_id);
97110
if (existing) {

0 commit comments

Comments
 (0)