Foundry.Context.LockFile (Foundry v0.3.0)

Copy Markdown View Source

Manages the context lock file (.foundry/context.lock) which tracks whether the cached project context is fresh.

The lock file stores a SHA256 hash of the target's source files. If any of them change, the hash becomes stale.

Umbrellas are hashed through apps/*

An umbrella has no lib/ at its root, so hashing only the root globs matched zero files and produced the hash of the empty string -- a constant. The lock could then never go stale, and a Studio that trusts it would serve a cached context for a project the person had been editing all day. The apps/* globs are what make the freshness check mean anything for Axonn.

Summary

Functions

check(project_root)

@spec check(String.t()) :: :ok | {:error, :stale | :missing}

compute_hash(project_root)

@spec compute_hash(String.t()) :: String.t()

write(project_root)

@spec write(String.t()) :: :ok