Fix memory-service: remove manual id assignment for auto-increment PK

This commit is contained in:
JC Beasley
2026-07-04 17:05:27 -07:00
parent cb5e26b561
commit 93b21a8164
10 changed files with 186 additions and 19 deletions
+4 -16
View File
@@ -55,7 +55,6 @@ class MemoryService {
const payload = {
type: 'correction',
id: correction.id,
pattern: correction.pattern,
exclude_pattern: correction.excludePattern || null,
severity: correction.severity,
@@ -65,9 +64,7 @@ class MemoryService {
auto_detected: correction.autoDetected || true,
manual_entry: correction.manualEntry || false,
hit_count: 0,
context: correction.context || 'unknown',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
context: correction.context || 'unknown'
};
const response = await client.post('/records', payload);
@@ -139,16 +136,13 @@ class MemoryService {
const payload = {
type: 'preference',
id: pref.id,
category: pref.category,
key: pref.key,
value: pref.value,
importance: pref.importance || 5,
confidence: pref.confidence || 1.0,
tags: JSON.stringify(pref.tags || []),
confirmed_count: pref.confirmedCount || 0,
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
confirmed_count: pref.confirmedCount || 0
};
const response = await client.post('/records', payload);
@@ -183,14 +177,12 @@ class MemoryService {
const payload = {
type: 'episode',
id: episode.id,
date: episode.date || new Date().toISOString().split('T')[0],
summary: episode.summary,
details: episode.details,
project: episode.project,
outcomes: JSON.stringify(episode.outcomes || []),
corrections_triggered: JSON.stringify(episode.correctionsTriggered || []),
created_at: new Date().toISOString()
corrections_triggered: JSON.stringify(episode.correctionsTriggered || [])
};
const response = await client.post('/records', payload);
@@ -226,14 +218,12 @@ class MemoryService {
const payload = {
type: 'decision',
id: decision.id,
date: decision.date || new Date().toISOString().split('T')[0],
project: decision.project,
decision: decision.decision,
alternatives: JSON.stringify(decision.alternatives || []),
rationale: decision.rationale,
status: decision.status || 'active',
created_at: new Date().toISOString()
status: decision.status || 'active'
};
const response = await client.post('/records', payload);
@@ -271,9 +261,7 @@ class MemoryService {
const payload = {
type: 'validation',
id: run.id,
session_id: run.sessionId,
timestamp: new Date().toISOString(),
input_length: run.inputLength,
output_length: run.outputLength,
violations_found: run.violationsFound || 0,
-3
View File
@@ -33,7 +33,6 @@ async function test() {
console.log('\n2. Testing correction storage...');
try {
const correction = await memory.storeCorrection({
id: `correction_${Date.now()}`,
pattern: '\\d+\\s*(%|percent)',
severity: 'auto-correct',
message: 'Quantitative claim requires evidence',
@@ -61,7 +60,6 @@ async function test() {
console.log('\n4. Testing preference storage...');
try {
const pref = await memory.storePreference({
id: `pref_${Date.now()}`,
category: 'communication',
key: 'format',
value: 'concise',
@@ -87,7 +85,6 @@ async function test() {
console.log('\n6. Testing validation logging...');
try {
await memory.logValidation({
id: `run_${Date.now()}`,
sessionId: 'test-session',
inputLength: 100,
outputLength: 200,