a-ludi / a-ludi/tasks-harmony

Server: clean up abandoned blobs after PQ migration

Aberta
#65 0 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
TypeScript
Estrelas
1
Forks
0
Merge médio
9min
PRs com merge (30d)
1

Descrição

## 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.

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.