feat(store,cli): cascade DeleteProject + engram delete session|prompt|project sub-commands#441
Merged
Merged
Conversation
…or sessions and prompts Implements store.DeleteProject (hard/soft, transactional, orphans memory_relations) and three new CLI sub-commands: engram delete session <id>, engram delete prompt <id>, engram delete project <name> [--hard]. Backward-compat: bare engram delete <obs_id> still works. README and ARCHITECTURE CLI reference tables updated. Closes #218 Closes #219
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
store.DeleteProject(name, hardDelete)with atomic cascade in a single transaction: orphansmemory_relationsreferencing project observations, removes observations (soft or hard), removes prompts, and removes sessions (hard only — FK constraint prevents session removal while soft-deleted observations still reference them).ErrProjectNotFoundwhen no entities exist for the project.engram delete:session <id>,prompt <id>,project <name> [--hard]. Reuses the existing soft/--hardflag pattern fromengram delete <id>(feat(cli): add engram delete command to remove observations #209).engram delete <obs_id>still works (dispatcher falls through to observation delete when the second arg is not a recognized keyword).Files
internal/store/store.go,internal/store/store_test.go,cmd/engram/main.go(cmdDelete dispatch + printUsage),cmd/engram/main_test.go,README.md(CLI reference),docs/ARCHITECTURE.md(CLI reference).Test plan
TestDeleteProjectCascadesAllEntities,TestDeleteProjectSoftDeleteObservations,TestDeleteProjectUnknownProjectReturnsError,TestDeleteProjectEmptyNameReturnsError,TestDeleteProjectOrphansMemoryRelations.delete session|prompt|project, missing/invalid arg cases,--hardflag, and backward-compat fordelete <obs_id>.go test ./... && go vet ./... && go build ./...clean.Note
Soft-delete leaves sessions intact:
observations.session_id TEXT NOT NULL REFERENCES sessions(id)blocks session deletion while soft-deleted observation rows still exist. Callers needing full session removal should use--hard, or follow up withengram delete session <id>per session.Closes #218
Closes #219