feat(enterprise): guard trace cleanup with leases#94
Closed
Gracker wants to merge 1 commit intofeature/enterprise-multi-tenant-tp-supervisorfrom
Closed
feat(enterprise): guard trace cleanup with leases#94Gracker wants to merge 1 commit intofeature/enterprise-multi-tenant-tp-supervisorfrom
Gracker wants to merge 1 commit intofeature/enterprise-multi-tenant-tp-supervisorfrom
Conversation
Owner
Author
yun571
pushed a commit
to yun571/SmartPerfetto
that referenced
this pull request
May 11, 2026
Land Plan 44 (Spark Gracker#94, Gracker#95) — project / world memory plus the feedback → case → skill draft pipeline. Critical invariant: this contract does NOT modify the existing session-scope `analysisPatternMemory.ts`. Plan 44 introduces an independent project + world store at runtime (`backend/src/agentv3/projectMemory.ts`, landed in D-phase). The existing 200-entry session store, weighted Jaccard matching, and supersede integration stay untouched. Types added to `backend/src/types/sparkContracts.ts`: - `ProjectMemoryStatus` — 5-state status machine inlined to keep `backend/src/types/` independent of `backend/src/agentv3/`. Mirrors agentv3's PatternStatus including `disputed_late`. Doc note flags that the two unions must stay in sync; if agentv3 changes, mirror the change here. - `ProjectMemoryEntry` — one entry. Carries optional `promotionPolicy`; the Plan 44 service layer (`projectMemory.saveProjectMemoryEntry`) enforces that a `'world'`-scope entry MUST have a policy. Schema itself keeps it optional so older snapshots remain readable. - `FeedbackPipelineEntry` — feedback pipeline state. Uses the shared `CaseRef` from C0 base types so this contract does NOT depend on Plan 54's CaseNode shape, breaking the Gracker#44 ↔ Gracker#54 schema cycle that Codex flagged in round 1. - `MemoryRagSelfImprovementContract` — service surface bundling entries + pipeline + recent RAG retrievals. Storage location for project + world entries: `backend/logs/analysis_project_memory.json` with shape `{entries: ProjectMemoryEntry[], promotionAudit: ...}`. Audit log schema is finalized in §4.3 of the design doc. Five new test cases in `__tests__/sparkContracts.test.ts` cover: - ProjectMemoryStatus matches the 5-state machine, no `auto_inferred` - project entry can omit promotionPolicy - world entry carries promotionPolicy with reviewer for audit - FeedbackPipelineEntry uses CaseRef shape, not CaseNode - contract bundles entries + pipeline + recent retrievals Test count: 55 (was 50). Test tier: contract / type-only. `npx tsc --noEmit` clean, sparkContracts.test.ts passes 55/55. Trace regression intentionally not run per the tiered policy in commit d8529e1. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
/api/traces/cleanupadmin-only viatrace:delete_anytrace_cleanup_blockedandtrace_cleanup_completedaudit eventsVerification
cd backend && PATH="$HOME/.nvm/versions/node/v24.15.0/bin:$PATH" npx jest --runInBand src/routes/__tests__/enterpriseTraceMetadataRoutes.test.ts src/services/__tests__/traceProcessorService.test.tscd backend && PATH="$HOME/.nvm/versions/node/v24.15.0/bin:$PATH" npm run typecheckcd backend && PATH="$HOME/.nvm/versions/node/v24.15.0/bin:$PATH" npm run test:corecd backend && PATH="$HOME/.nvm/versions/node/v24.15.0/bin:$PATH" npm run test:scene-trace-regressionPATH="$HOME/.nvm/versions/node/v24.15.0/bin:$PATH" npm run verify:prgit diff --check