feat(history): memory entry history, snapshots, and rollback and test(integration) dual framework tests and docs(api) added API documentation - #1
Merged
Conversation
Add trigger-based history tracking for memory entries, hiveshare
snapshots with restore-to-new-hiveshare, and entry copy for
rollforward merges.
- migration 005: history table with embedding column, trigger on
content/summary/tags/metadata/embedding changes and deletes,
snapshot and snapshot_entries tables
- HistoryStore with rollback, undelete, snapshot CRUD, restore,
copy, and configurable purge (HISTORY_TTL_DAYS, HISTORY_MAX_VERSIONS)
- 9 new API endpoints and 9 new CLI commands
- rollback restores embedding from history when available, only
enqueues re-embed job when history embedding is NULL
Assisted-by: Claude Code / Opus 4.6 (Anthropic)
Ensure pre-migration entries have a baseline history row so they can be rolled back or included in snapshots. Uses WHERE NOT EXISTS guard for idempotency. Assisted-by: Claude Code / Opus 4.6 (Anthropic)
…INER_RUNTIME Add pytest (tests/) and bash/curl (scripts/smoke-test-*.sh) integration tests with equivalent coverage across auth, hiveshare, memory, metrics, history, and infrastructure subsystems. Bash harness auto-discovers smoke-test-*.sh scripts. Both frameworks use unique timestamped users for re-runnability without a fresh database. Add make targets: smoke-test, smoke-test-full, integration-test, and dev-clean. Support CONTAINER_RUNTIME variable (default docker) for podman users. Migrate target falls back to container exec when psql is not installed locally. Assisted-by: Claude Code / Opus 4.6 (Anthropic)
tyraziel
marked this pull request as ready for review
July 24, 2026 15:35
Document all 24 endpoints with inputs, outputs, status codes, and curl examples. Add scripts/test-api-examples.sh to verify every example against the running server (92 checks). Add make psql target for interactive database access. Assisted-by: Claude Code / Opus 4.6 (Anthropic)
tyraziel
force-pushed
the
memory-history-subsystem
branch
from
July 24, 2026 15:42
86843b7 to
be31e92
Compare
Rebase history subsystem onto memory→hive rename (006 migration, /hives routes). Fix copy IDOR, snapshot restore ownership, source_ref conflicts, purge-by-age, and delete-snapshot status codes. Co-authored-by: Cursor <cursoragent@cursor.com>
Owner
|
@tyraziel I like the changes in this PR, added a couple of things based on our upstream. Cheers and thanks for the contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
memory_entries_historytable that captures every content,embedding, and delete mutation on
memory_entries— view counter flushes andreuse increments are excluded
leaving the original untouched
enqueues a re-embed job when the history embedding is NULL
HISTORY_TTL_DAYSandHISTORY_MAX_VERSIONSenv vars(default 0 = keep forever)
subsystems (auth, hiveshare, memory, metrics, history, infrastructure)
smoke-test,smoke-test-full,integration-test,dev-cleanCONTAINER_RUNTIMEvariable (defaultdocker) for podman userspsqlis not installed locallyCLAUDE.mdwith testing and build conventionsAPI.mddocumenting all 24 endpoints with inputs, outputs, status codes,and curl examples
scripts/test-api-examples.shverifying every curl example (92 checks)make psqltarget for interactive database access via containerCLAUDE.mdwith project guidelines, testing tenets, and build conventionsNew endpoints
/hiveshares/{id}/memory/{entryId}/history/hiveshares/{id}/memory/{entryId}/rollback/hiveshares/{id}/memory/undelete/hiveshares/{id}/memory/copy/hiveshares/{id}/snapshots/hiveshares/{id}/snapshots/hiveshares/{id}/snapshots/{snapshotId}/hiveshares/{id}/snapshots/{snapshotId}/restore/hiveshares/{id}/snapshots/{snapshotId}Test plan
make smoke-test— 9 checks, 0 failedmake smoke-test-full— 6 suites, 106 checks, 0 failedmake integration-test— 41 tests, 0 failedHISTORY_TTL_DAYSandHISTORY_MAX_VERSIONSpurge old history rowsCONTAINER_RUNTIME=podman./scripts/test-api-examples.sh— 92 checks, 0 failedGenerated with AI assistance: Claude Code / Opus 4.6 (Anthropic)