Skip to content

fix: NULL raw_id crash, feedback bloat, and runtime metrics#336

Merged
CalebisGross merged 1 commit intomainfrom
fix/issues-332-333-334
Mar 21, 2026
Merged

fix: NULL raw_id crash, feedback bloat, and runtime metrics#336
CalebisGross merged 1 commit intomainfrom
fix/issues-332-333-334

Conversation

@CalebisGross
Copy link
Copy Markdown
Collaborator

Summary

Fixes three issues discovered during the dashboard work session:

Test plan

  • make build && make test pass
  • NULL raw_id: inserted NULL, verified no crash on /api/v1/memories
  • Runtime metrics: curl /api/v1/health shows heap, goroutines, uptime, DB size
  • Feedback pruning: trigger recall + feedback, verify traversal data nulled out
  • Consolidation TTL: verify records older than 30 days get pruned

Closes #332, closes #333, closes #334.

…, #334)

#334 — Fix scanMemoryFrom crash on NULL raw_id:
- Use sql.NullString for raw_id in scanMemoryFrom (same pattern as all
  other nullable columns). Prevents "converting NULL to string" crash
  when memories have NULL raw_id from consolidation merges or imports.
- Add raw_id fallback in backup import: set raw_id = id if empty.

#333 — Fix retrieval_feedback table bloat:
- Null out traversed_assocs and access_snapshot after feedback is applied
  in HandleFeedback. These fields are only needed for Hebbian adjustment
  and are never read again after.
- Add PruneOldFeedback store method (30-day TTL) called during
  consolidation Step 10. Prevents unbounded table growth.

#332 — Add runtime resource metrics to health API:
- HealthResponse now includes heap_alloc_mb, heap_sys_mb, goroutines,
  gc_pause_total_ms, uptime_seconds, db_size_mb.
- Periodic disk HealthReport includes heap_alloc_mb, goroutines, db_size_mb.
- ServerDeps gains StartTime for uptime calculation.

Closes #332, closes #333, closes #334.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@CalebisGross CalebisGross merged commit 470e207 into main Mar 21, 2026
@CalebisGross CalebisGross deleted the fix/issues-332-333-334 branch March 21, 2026 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant