Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix(usage): protect render receipts and recovery journals from purge

[._.]/ Adam Eivy6c110964f30c
diff --git a/server/services/dataManager.categories.test.js b/server/services/dataManager.categories.test.js
index 4289d99ab6..db5896e890 100644
--- a/server/services/dataManager.categories.test.js
+++ b/server/services/dataManager.categories.test.js
@@ -163,6 +163,8 @@ describe('dataManager purge scope (#3327)', () => {
const USER_STATE_CATEGORIES = {
messages: 'drafts, the delivery_unknown send audit, triage rules and account config',
review: 'Review Hub todos, pending CoS action requests and security assessment reports',
+ 'image-render-usage': 'historical image accounting and deduplication identities',
+ 'image-render-usage-backfills': 'import plans, preservation fingerprints and recovery journals',
};
it.each(Object.entries(USER_STATE_CATEGORIES))(
'never offers a purge for %s, which holds %s',
@@ -201,9 +203,10 @@ describe('dataManager purge scope (#3327)', () => {
await expect(purgeCategory('beeper', { subPath: 'attachments' })).rejects.toThrow(/is not purgeable/);
await expect(purgeCategory('peer-execution')).rejects.toThrow(/is not purgeable/);
await expect(purgeCategory('peer-execution', { subPath: 'fixture-operation/evidence.json' })).rejects.toThrow(/is not purgeable/);
- for (const options of [undefined, { subPath: 'account' }]) {
- await expect(purgeCategory('messages', options)).rejects.toMatchObject({ status: 403, code: 'CATEGORY_NOT_PURGEABLE' });
- await expect(purgeCategory('review', options)).rejects.toMatchObject({ status: 403, code: 'CATEGORY_NOT_PURGEABLE' });
+ for (const category of Object.keys(USER_STATE_CATEGORIES)) {
+ for (const options of [undefined, { subPath: 'account' }]) {
+ await expect(purgeCategory(category, options)).rejects.toMatchObject({ status: 403, code: 'CATEGORY_NOT_PURGEABLE' });
+ }
}
});
diff --git a/server/services/dataManager.js b/server/services/dataManager.js
index 6b9e1ce7c1..00f412a3ea 100644
--- a/server/services/dataManager.js
+++ b/server/services/dataManager.js
@@ -125,6 +125,8 @@ export const CATEGORIES = {
'games': { label: 'Games', description: 'Game project records and assets', archivable: true, deletable: false },
'health': { label: 'Apple Health', description: 'Daily health JSON snapshots', archivable: true, deletable: false },
'image-clean-tmp': { label: 'Image Cleaner Scratch', description: 'Ephemeral working files for Image Cleaner renders — swept automatically, safe to purge when no render is in flight', archivable: false, deletable: true, purgeScope: 'category', busyCheck: imageCleanTmpBusy },
+ 'image-render-usage': { label: 'Image Render Usage', description: 'Durable image accounting receipts — retain historical usage and deduplication identities', archivable: true, deletable: false },
+ 'image-render-usage-backfills': { label: 'Image Usage Recovery', description: 'Private historical import plans, preservation fingerprints and recovery journals', archivable: true, deletable: false },
'image-refs': { label: 'Image References', description: 'Reference images uploaded for multi-reference edits — still served to existing renders', archivable: true, deletable: false },
'image-to-3d': { label: 'Image to 3D', description: 'Generated GLB meshes — the only copy; records live in Postgres', archivable: false, deletable: false },
'images': { label: 'Images', description: 'Uploaded and generated images — delete individually; gallery, pipeline, and collection records point at these files', archivable: true, deletable: true, purgeScope: 'items' },