Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Harden draft saves against a partial failure

Aperta
#321 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
58/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
backend

Direzione di ricerca

Inizia in src/services/projectStorage.ts, intorno alla logica di readAnalysisShard alle righe 234-241, poi segui saveDraft e l’ordine di shard, envelope ed eliminazione. Conferma il comportamento di scrittura dell’envelope per un insieme di libri in crescita e riesamina la motivazione dell’eliminazione. Il lavoro è completato quando un salvataggio interrotto lascia contenuto obsoleto invece di un libro senza nome, mentre gli shard mancanti vengono conservati invece di essere eliminati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

saveDraft writes every changed shard, then the envelope naming them. A save torn between those two steps leaves a book that this save analyzed for the first time named by no manifest — the old envelope predates it, the new one never landed — so its work is unreachable on reopen.

Writing the envelope with old ∪ new books before the shards would close that: every book stays named throughout, so a torn save yields stale content rather than absent content.

This is safe because a manifest naming a not-yet-written shard is already handled — readAnalysisShard returns readable: false for ENOENT, so the book is held rather than wiped:

https://github.com/sillsdev/interlinearizer-extension/blob/main/src/services/projectStorage.ts#L234-L241

Cost is one extra envelope write, and only when the book set grows.

Field-vs-shard skew is inherent regardless — papi.storage.writeUserData is a plain fs.promises.writeFile, so no single write here is atomic. This only closes the silent-absence case.

Note the delete step's ordering rationale ("deleting only once the envelope has stopped naming the book keeps a failure here from stranding the manifest on a missing shard") would need reworking alongside this, since the envelope would no longer be written exactly once per save.

Raised by @imnasnainaec (drafted by Devin) reviewing #316, and deferred from it as out of scope.

Merged from #322: Revisit the draft save no-retry decision now that a failed save is a partial commit

Before per-book partitioning, the draft was one record: a rejected write was a no-op, leaving the previous draft intact.

Now the analysis spans several records, written before the envelope. A save that fails partway persists a partial state — some books from the new save, the rest from the old one — which stands until the next keystroke triggers another auto-save, and permanently if the user stops editing at that moment.

The next save does repair it: what reached storage is tallied as it lands, so the following save rewrites only the books still missing it. The gap is only that nothing forces a next save to happen.

That makes the documented no-retry decision more expensive than when it was made, which is worth revisiting on its own rather than inside the PR that changed the cost. Options include retrying a failed draft save, or surfacing the failure so the user knows the draft on disk is mixed.

Raised by @imnasnainaec (drafted by Devin) reviewing #316, and deferred from it as out of scope.

Lingua principale
TypeScript
Stelle
2
Fork
0
Merge medio
2g 5h
PR unite (30g)
42

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di sillsdev/interlinearizer-extension

Tutte le issue di sillsdev/interlinearizer-extension

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.