Skip to content

Caching Workspace Broken #85

@markovejnovic

Description

@markovejnovic

As part of an investigation on the harmont behavior, we have identified the following bug:

Bug 2 — Stale workspace in cached snapshots (vm.rs:75-88)

Workspace (source archive) is only injected at the root step (when parent_snapshot.is_none()). All child steps inherit via COW

snapshot. If the root step (apt-base) is cached, the snapshot contains the old project files. So even if you add packageManager to

package.json and re-run hm run:

  1. apt-base — cache hit → snapshot with OLD package.json (no packageManager)
  2. install — inherits old snapshot
  3. pnpm — corepack enable pnpm (forever cache, no version)
  4. deps — pnpm install → corepack sees no packageManager in the stale package.json → downloads latest (11.5.2)

Your packageManager edit never reaches the container.

Why the minimumReleaseAge error specifically: pnpm 11.x enables supply-chain policy by default. Corepack grabs 11.5.2 (latest), which

rejects recently-published packages in your lockfile. pnpm 10.x doesn't have this policy.

The architectural root cause (stale workspace in cached layers) is deeper and affects more than just corepack — any step that reads

project files from a cached parent snapshot sees stale data. But for this specific issue, passing the version explicitly to corepack

in the command string is the targeted fix.

We need to fix this issue pronto. This is likely a large, architectural issue, so this task involves doing the research necessary to investigate and address the problem, as well as potentially re-architecting the way we inject the workspace. My guess is that the workspace should be cached through COW filesystems, layered, and bound-mount to the containers.

This is not a trivial change, so spending a large amount of time to design a future-proof system, as well as potentially making breaking changes, is very much a good idea.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingproposed

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions