fix(account-deletion): durably purge a deleted account's storage without touching live objects by waleedlatif1 · Pull Request #9146 · simstudioai/sim · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor(account-deletion): split the storage reference guard and sha…
…re storage primitives

- keysNamedByUrl also yields a leniently decoded candidate when a stored URL's
  percent-encoding is malformed, so a legacy key holding a literal '%' is kept
- correct the guard's TSDoc: rowless keys stay reachable through key paths under a
  live workspace and object metadata, not only through a row
- move the reference guard to lib/users/storage-reference-guard.ts
- move prefix listing/deletion, the upload-TTL cleanup delay, and the outbox
  deadline margin from lib/projects/files/prefix-cleanup.ts to
  lib/uploads/core/prefix-sweep.ts; drop the projectUploadCleanupAvailableAt alias
- share WORKSPACE_SHARED_FILE_CONTEXTS between member handoff and account cleanup
- isPublicStorageKey replaces the public-prefix lists in the serve route and guard
  • Loading branch information
waleedlatif1 committed Oct 16, 2026
commit f8a8d6498ebc494396ef9490b601daa7068c6dd8
14 changes: 6 additions & 8 deletions apps/sim/app/api/files/serve/[...path]/route.ts
8 changes: 3 additions & 5 deletions apps/sim/lib/projects/files/application/uploads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ import {
prepareProjectFileAccounting,
recordProjectFileWriteEffects,
} from '@/lib/projects/files/application/write-effects'
import {
projectUploadCleanupAvailableAt,
queueRetiredProjectUploadCleanup,
} from '@/lib/projects/files/prefix-cleanup'
import { queueRetiredProjectUploadCleanup } from '@/lib/projects/files/prefix-cleanup'
import { resolveFileFolderTarget } from '@/lib/uploads/contexts/workspace/file-folder-manager'
import {
adoptVerifiedUploadSession,
Expand All @@ -43,6 +40,7 @@ import {
} from '@/lib/uploads/contexts/workspace/file-manager'
import type { WorkspaceFileSecretProvenance } from '@/lib/uploads/contexts/workspace/file-secret-provenance'
import { enqueueWorkspaceFileStorageCleanups } from '@/lib/uploads/contexts/workspace/file-storage-cleanup-outbox'
import { storageCleanupAvailableAt } from '@/lib/uploads/core/prefix-sweep'
import { downloadFile } from '@/lib/uploads/core/storage-service'
import { requestOrigin } from '@/lib/uploads/upload-session/application'
import { assertProjectFileUploadBinding } from '@/lib/uploads/upload-session/project-file-binding'
Expand Down Expand Up @@ -321,7 +319,7 @@ const registerProjectUpload = defineAuthorizedProjectFileUseCase({
await registration.registerFile(file.id)
const cleanupIds = prepared.restored
? await enqueueWorkspaceFileStorageCleanups(tx, [input.session.finalKey], 'project', {
availableAt: projectUploadCleanupAvailableAt(),
availableAt: storageCleanupAvailableAt(),
})
: []
const result = await mapProjectFileResult(tx, context, file)
Expand Down
201 changes: 17 additions & 184 deletions apps/sim/lib/projects/files/prefix-cleanup.ts
Loading
Loading