C.W.K.
Stream
Lesson 03 of 05 · published

Delete What You Own, Keep What's Shared

~9 min · deletion, shared-cache, reference-counting

Level 0Silent
0 XP0/36 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete
"Deleting a project removes what the project owns. It must never remove audio that history or another project still points at."

Two Kinds of Thing a Project Touches

When you delete a Studio project, it's touched two very different categories of data. There's what the project exclusively owns — its utterances, its take records, its own export directory. And there's what it merely references — content-addressed synthesis jobs and cache entries that may also serve conversation history or another project entirely. Deletion has to tell these apart. Bellows removes the owned things and leaves the shared things exactly where they are.

Shared Audio Outlives the Project That Referenced It

A cache entry is keyed by synthesis identity, not by project. If two projects both used the line "Welcome back," they share one cache entry. Deleting one project must not pull that audio out from under the other — or out from under the conversation history that also references it. So the shared synthesis jobs and content-addressed cache remain reusable after a project is gone. The project's exclusive belongings are deleted; the commons is untouched.

Automatic Cleanup Respects Takes Too

The same reference-awareness governs routine cache eviction. Automatic cache policy cleanup never deletes audio that a Studio take references — that authored production is protected from being swept away by a background cleaner. Only an explicit, deliberate action can remove referenced audio: a per-key delete or a confirmed full clear. The pattern throughout is the same as reference counting: something shared is only truly removable when nothing points at it, and even then only on purpose.

Code

Scope deletion to what's exclusively owned·python
def delete_project(project: StudioProject):
    # Remove what the project EXCLUSIVELY owns:
    remove(project.utterances)          # its lines
    remove(project.takes)               # its take records
    remove(project.export_dir)          # its own export directory

    # Do NOT touch shared audio: a synth job / cache entry may serve history
    # or another project. Deletion is scoped to exclusive ownership, never to
    # content-addressed audio that other references still point at.

# Automatic cache cleanup ALSO refuses to evict audio a take references --
# only an explicit per-key delete or a confirmed full clear can remove it.

External links

Exercise

Find a delete operation in a system you know that could reach shared, deduplicated, or referenced data — deleting a user that owns shared files, removing an album that shares photos, dropping a record other rows point at. Decide what that delete exclusively owns versus what it merely references, and rewrite it to remove only the owned part. Name the data loss the naive cascade would cause.
Hint
Ask of every byte the delete would touch: 'does anything else still point at this?' If yes, it's shared and must survive. Scope the delete to what this thing, and only this thing, owns.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.