raphaelvigee/scratch driver - #403
Draft
raphaelvigee wants to merge 1 commit into
Draft
Conversation
…ctory Adds the declaration half of scratch caching: a target kind that names a mutable, non-hermetic directory persisting across runs, which many targets can share. Nothing mounts, locks or stores anything yet — a declaration is inert on its own, and the engine work that gives it meaning lands on top of this. Declaring it as a target rather than inline at each use site is the point. Settings live in exactly one place, so two consumers cannot disagree about a slot's `access` or `version` — that whole class of error becomes inexpressible rather than something to detect and report. The addr is the cache's identity, so packages give namespacing for free (`//go:cache` and `//rust:cache` need no agreed prefix convention) along with visibility and `heph query revdeps`. It is a builtin driver shaped exactly like `plugingroup`, so no new Starlark global is introduced: `target(driver = "scratch", …)` is the surface, and `#[derive(Spec)]` supplies both the parser and the BUILD-file LSP schema. Two settings are author assertions heph cannot check, and both are documented as such with conservative defaults: - `access = "shared"` says the tool is safe under concurrent access. Go's build cache is the motivating case — forcing it exclusive would serialize a whole Go build. Defaults to `exclusive`. - `platform = "any"` says the contents are portable, which lets one slot serve every machine. It asserts two things, not one: no host dependence *and* no embedded absolute paths. Defaults to `os_arch`, because restoring a host-specific cache onto the wrong host is the one mistake here that is not merely slow. Mount-path validation lives on the declaration rather than at each use, so a bad path is reported once at its source. A mount is a symlink out of the sandbox, so absolute and `..`-escaping paths are rejected; so is mounting at the workspace root, which would replace the consumer's whole tree. Design doc: docs/SCRATCH.md. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FArWjycMDyWeSfHHtpgtoU
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.
Stack created with GitHub Stacks CLI • Give Feedback 💬