You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rebuilding an installed package currently removes the working database before its replacement has been built. A failed rebuild can therefore leave no usable copy, and concurrent readers or directory watchers can observe an incomplete database.
This also affects the package-refresh work in #117, whose review identified packages disappearing or being advertised with zero sections during replacement.
The behavior is visible at upstream commit 149f112:
buildPackage() unlinks outputPath, opens a database at that same path, then creates the schema, writes metadata and chunks, and rebuilds FTS.
Its finally closes the database, but does not restore the previous package if initialization or a later build step fails.
downloadPackage() already downloads into a temporary file and validates it, but explicitly unlinks the installed destination before renaming the replacement.
Proposed behavior:
Build a replacement in a uniquely named temporary file in the destination directory. Close and validate it before switching the installed path. Preserve the existing package on any failure before replacement, and clean up temporary artifacts. The replacement strategy needs to be tested on supported operating systems, including Windows.
Temporary files should not be discoverable as installed packages. Package-store refresh should happen after a completed replacement, rather than interpreting an unreadable intermediate state as deletion.
Acceptance criteria:
Injected failures during database initialization, chunk insertion, FTS creation, validation, or final replacement leave the previous package readable and unchanged.
A successful rebuild installs the new package and removes its temporary artifacts.
Rebuilding an installed package currently removes the working database before its replacement has been built. A failed rebuild can therefore leave no usable copy, and concurrent readers or directory watchers can observe an incomplete database.
This also affects the package-refresh work in #117, whose review identified packages disappearing or being advertised with zero sections during replacement.
The behavior is visible at upstream commit
149f112:buildPackage()unlinksoutputPath, opens a database at that same path, then creates the schema, writes metadata and chunks, and rebuilds FTS.finallycloses the database, but does not restore the previous package if initialization or a later build step fails.downloadPackage()already downloads into a temporary file and validates it, but explicitly unlinks the installed destination before renaming the replacement.Proposed behavior:
Build a replacement in a uniquely named temporary file in the destination directory. Close and validate it before switching the installed path. Preserve the existing package on any failure before replacement, and clean up temporary artifacts. The replacement strategy needs to be tested on supported operating systems, including Windows.
Temporary files should not be discoverable as installed packages. Package-store refresh should happen after a completed replacement, rather than interpreting an unreadable intermediate state as deletion.
Acceptance criteria:
This issue concerns the package-write lifecycle; #117 can address watcher-specific behavior separately.