fix(ci): default memory store --upsert=true to fix store→delete→store UNIQUE violation (#2594)

memory_entries has UNIQUE(namespace, key) that does not exclude soft-deleted rows,
so a store→delete→store cycle reliably hits UNIQUE constraint failed when --upsert
defaults to false. storeEntry() already honors upsert via INSERT OR REPLACE; flipping
the CLI default closes the footgun without touching schema or plumbing.

Co-Authored-By: RuFlo <ruv@ruv.net>
This commit is contained in:
ruv committed 2026-07-07 21:55:19 -04:00
1 parent 12ec7e72dc
commit c36cb4d665
1 file changed
+6 -3
+6 -3
View File
@@ -71,16 +71,19 @@ const storeCommand: Command = {
{
name: 'upsert',
short: 'u',
description: 'Update if key exists (insert or replace)',
// #2594: default true so `store → delete → store` doesn't hit the UNIQUE
// (namespace, key) constraint on the soft-deleted row. Pass --no-upsert
// for strict insert semantics.
description: 'Update if key exists (default; pass --no-upsert for strict insert)',
type: 'boolean',
default: false
default: true
},
DB_PATH_OPTION
],
examples: [
{ command: 'claude-flow memory store -k "api/auth" -v "JWT implementation"', description: 'Store text' },
{ command: 'claude-flow memory store -k "pattern/singleton" --vector', description: 'Store vector' },
{ command: 'claude-flow memory store -k "pattern" -v "updated" --upsert', description: 'Update existing' }
{ command: 'claude-flow memory store -k "pattern" -v "new" --no-upsert', description: 'Strict insert (fail if key exists)' }
],
action: async (ctx: CommandContext): Promise<CommandResult> => {
const key = ctx.flags.key as string;