[Bug]: WatchStore recovery overwrites its readable backup

Aperta
#7,496 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@123XieC ci sta già lavorando.

Dal 12/11/2026.

  • #7497 di @123XieC — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python
Ambito
backend, database

Direzione di ricerca

Start by locating FileWatchStore.initialize() and its snapshot save and recovery paths; the issue does not name file paths or tests. Trace how the readable backup is used and how the primary is rewritten, then look for tests covering invalid primary JSON and a failed final move. Done means a retry can still recover the watch from the backup after that move fails.

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

Descrizione

Issue Origin

Observed or reproduced in a real environment. The reproduction uses the real local RAGFS backend and on-disk snapshots.

Bug Description

When the primary watch-task snapshot is invalid JSON and the backup is readable, FileWatchStore.initialize() recovers the task rows from the backup. While rewriting the primary, the normal save path rotates the invalid primary over the only readable backup. If installing the recovered primary fails after that rotation, no readable snapshot remains.

Steps to Reproduce
  1. Use a local FileWatchStore and create a watch. Update it once to generate a valid backup.
  2. Write invalid JSON to .watch_tasks.json.
  3. Reopen the store. Inspect the backup after initialization. To exercise a failed restore, reject only the move from the temporary snapshot to the primary and then retry initialization.
Expected Behavior

Restore the primary from the readable backup without rotating the corrupt primary over it. If the final move fails, a retry should still be able to load the watch from the same backup.

Actual Behavior

The backup contains the corrupt primary bytes after both a successful restore and a simulated failure of the final move.

OpenViking Version

Current main at 5043e1f, with the local RAGFS Python binding from the OpenViking 0.5.3 macOS wheel.

Python Version

Python 3.12.

Operating System

macOS arm64.

Additional Context

#7133 and #7086 cover startup when snapshots cannot be read. This reproduction starts from a readable backup and fails during the recovery write. It was investigated and reproduced with AI assistance.

Lingua principale
Python
Stelle
41.8k
Fork
3.4k
Merge medio
19h 29m
PR unite (30g)
500

Preparare l'ambiente

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 volcengine/OpenViking

Tutte le issue di volcengine/OpenViking

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.