Skip to content

🧹 feat: Bound Managed Environment Storage - #289

Merged
danny-avila merged 1 commit into
mainfrom
danny-avila/environment-storage-lifecycle
Oct 2, 2026
Merged

danny-avila merged 1 commit into
mainfrom
danny-avila/environment-storage-lifecycle

Conversation

@danny-avila

@danny-avila danny-avila commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Dependency reuse without a lifecycle still accumulates old versions, and low disk can interrupt installation before the worker persists its recovery state. Add opt-in snapshot retention/count/byte budgets and a free-space admission floor for managed preparation, including workers without snapshot support.

Behavior

  • Low space starts no setup command. Ready checkouts can still perform their normal readiness check.
  • Cleanup touches only reproducible, privately owned snapshots with valid worker manifests. Active/current keys, unknown data and all source worktrees remain intact.
  • An explicit operator command previews by default; --apply performs maintenance without restarting the worker.
  • A full cache does not turn successful preparation into a failed/quarantined checkout. Skip publication with a diagnostic when nothing safe can be evicted.
per-key preparation lock ── install / restore / readiness
              │
              └─ short maintenance lock
                    ├─ bounded inventory + worker manifests
                    ├─ try-lock inactive LRU entries / abandoned staging
                    └─ budget check + atomic publication

Kernel try-locks are non-blocking and do not mask cleanup errors as contention. Budget checking and publication share the maintenance lock, while installations for independent keys remain concurrent. Abandoned staging needs both a manifest and a free owner-key lock.

Stacked on #288. All settings are opt-in; existing environment definitions retain their behavior. Budgets count logical snapshot payload, not reflink physical allocation or working checkout copies. Free-space checks are soft admission, not disk reservations or arbitrary shell-write quotas. This deliberately does not delete .verification, source worktrees, dirty/unpushed changes, unknown installs or shared mutable npm/uv caches; those need their own ownership/usage lifecycle. Hard containment requires deployment filesystem quotas and separate control-state storage.

Verification

  • Worker TypeScript build passed.
  • 52 focused tests passed, including real native-SRT/APFS preparation and restore, shared resources, hardlink rejection, changed-input eviction, kernel-lock crash recovery, preserved active keys and source, dry-run/apply CLI, low-space no-dispatch and abandoned-staging recovery.
  • git diff --check passed.

No live worker, deployment, filesystem quota or production cleanup was changed.

@danny-avila
danny-avila force-pushed the danny-avila/environment-storage-lifecycle branch from d850f99 to 39a7893 Compare October 2, 2026 02:57
@danny-avila
danny-avila added this pull request to stack #290 October 2, 2026 03:06
@danny-avila
danny-avila force-pushed the danny-avila/dependency-snapshots branch from ea00213 to 94e7069 Compare October 2, 2026 03:11
@danny-avila
danny-avila force-pushed the danny-avila/environment-storage-lifecycle branch from 39a7893 to 5a2a42b Compare October 2, 2026 03:11
@danny-avila
danny-avila removed this pull request from stack #290 October 2, 2026 03:13
@danny-avila
danny-avila force-pushed the danny-avila/dependency-snapshots branch from 94e7069 to 491f3f3 Compare October 2, 2026 03:23
@danny-avila
danny-avila force-pushed the danny-avila/environment-storage-lifecycle branch from 5a2a42b to 1b22ce3 Compare October 2, 2026 03:23
@danny-avila
danny-avila added this pull request to stack #292 October 2, 2026 11:23
@danny-avila
danny-avila force-pushed the danny-avila/dependency-snapshots branch from 491f3f3 to 7241de1 Compare October 2, 2026 11:28
@danny-avila
danny-avila force-pushed the danny-avila/environment-storage-lifecycle branch from 1b22ce3 to f9818dd Compare October 2, 2026 11:28
@danny-avila
danny-avila removed this pull request from stack #292 October 2, 2026 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant