a-ludi / a-ludi/tasks-harmony

Server: clean up abandoned blobs after PQ migration

Abierto
#65 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
1
Forks
0
Merge medio
9 min
PR fusionados (30 d)
1

Descripción

## Background

As part of the PQ sync-auth migration (asymmetric key bundle replacing the AES sync key), each device that migrates generates a new blob path and pushes to it, leaving its old `${syncToken}.enc` blob in place on the server. The old blob must remain reachable during the migration window so that other devices can do a final pull before re-keying.

Once all devices have migrated, the old blobs are permanently unreachable — no client holds the old syncToken anymore, and the old auth protocol has no way to claim them. They will accumulate on disk and count against the server's quota.

## What needs to be decided

The definition of "abandoned" is still to be determined. Candidates:

- **Age-based:** blobs not accessed (GET or PUT) for N days are considered abandoned and eligible for eviction.
- **Format-based:** blobs that don't start with the `0x02` version byte (i.e. old AES-GCM format) are legacy and can be evicted after a grace period.
- **Auth-based:** blobs whose syncToken no longer maps to any active session and haven't been accessed in N days.
- **Combination:** old-format blobs that haven't been accessed in N days (conservative version of format-based).

## What needs to be built

- A server-side cleanup job (cron or on-demand) that evicts abandoned blobs.
- An operator-configurable grace period (e.g. `SYNC_BLOB_ABANDONED_DAYS=90`).
- Logging/metrics so operators can see how many blobs were evicted and why.
- Documentation in `docs/DEPLOYMENT.md` covering the cleanup behaviour and how to tune it.

## Notes

- The existing LRU eviction in `sync-server/handlers/blob.ts` handles quota pressure but is not the right tool here — it evicts the oldest blobs globally, not specifically abandoned ones.
- This issue is a follow-up to the PQ sync-auth redesign. It can be addressed after the migration is shipped and operational experience informs what "abandoned" should mean in practice.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.