Repository navigation
Stores: Compact, a job with its steps and what it freed - #38
Merged
Merged
Conversation
A Store's ⋯ menu gets Compact… (SQLite and PostgreSQL). It asks first, then runs LayerFS store.compact as a storage job, like push and backup: the job panel shows "Compacting <store> · Step 2 of 4 · building" from the call's on_progress events and ends with "freed 121 MB" or "nothing to reclaim". Host - POST /api/stores/:name/compact starts the job (storage.compact). One attempt: nothing here runs it again; Retry is a new run the person starts. - The job names its steps before the run, by Store family (mark, build, verify, install; PostgreSQL: mark, build, swap, cleanup), so the step count is right from the first event. - A runtime without store.compact: the view says compact: false, the menu row is not drawn and the route refuses Unsupported before any call. A runtime whose store.compact takes no on_progress runs the job without steps. - A compaction's failure keeps the SDK's own code; the transfer rule "stopped in install means unknown" does not apply to it. Client - The row is disabled with its reason for a SQLite Store on another machine (LayerFS compacts a file only where it is) and for a Store that is not idle. - The confirm dialog can be plain: Compact removes nothing, so its button is not the danger one. - stepsOf keeps a job's named steps in order; jobs that name none (push, pull, move, backup, restore) are unchanged. Tests: routes.test.mjs (the job over a fake SDK: steps, phases, report, PostgreSQL steps, a refusal, no on_progress, no store.compact), the new storage-jobs-model.test.mjs (steps, words, where it may start), call-table.test.mjs (store.compact is gated), logs-classify.test.mjs (the four GC calls are writes). Checked on a side server (port 3097, private home, LayerFS built from d74c015894): a 526 MB Store with one deleted project went marking, building, then "freed 121 MB" and 405 MB; a second run said "nothing to reclaim". Not checked in the browser: a PostgreSQL Store, a failed run and the disabled row. Not on 3080: its runtime has no store.compact yet. node --test test/*.test.mjs: 693 tests, 691 pass, 1 fail, 1 skipped. The failure, "every pinned CLI call is classified as its kind" (home.init), also fails on layerfs_v2_0_0 at dd444cf. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Compact to a Store's menu on the Stores tab, as a job that shows its steps and what it freed.
Depends on Ephemeral-AI-Lab/layerfs#735 for the step-by-step progress. Without it the plugin still works:
store.compact(the one installed today,2.0.0-cc7be6ab0f70): the menu item is hidden, and the route refuses withUnsupported.store.compactbut noon_progress: the job runs and shows its result, without steps.What changes
POST /api/stores/:name/compactstarts acompactjob. The host reads the pinned CLI's call table to learn whetherstore.compactexists and whether it declareson_progress, and passes the option only when declared. The job carries its named steps:mark, build, verify, installfor SQLite andmark, build, swap, cleanupfor PostgreSQL.docs/specs/homes.mdnames compact jobs.17 files, +257 −25.
Checks
test/routes.test.mjs, the job wording and steps intest/storage-jobs-model.test.mjs, a gate rule forstore.compactintest/call-table.test.mjs, and the four GC calls classified as writes intest/logs-classify.test.mjs.DSH_LAYERFS_DEV_DIR, a LayerFS CLI built from the branch in the pull request above): a 526 MB SQLite Store with one deleted project showed "Step 1 of 4 · marking", "Step 2 of 4 · building", then "Compacted · freed 121 MB". A second run showed "nothing to reclaim".Not checked
logs-classify"every pinned CLI call is classified as its kind" fails onhome.init. It fails the same way onlayerfs_v2_0_0without this change and is left alone here.🤖 Generated with Claude Code