Skip to content

Add ctx.actions.copy: a content-link action distinct from symlink - #3

Closed
thesayyn wants to merge 5 commits into
masterfrom
claude/path-mapping-support-i63hlk
Closed

Add ctx.actions.copy: a content-link action distinct from symlink#3
thesayyn wants to merge 5 commits into
masterfrom
claude/path-mapping-support-i63hlk

Conversation

@thesayyn

@thesayyn thesayyn commented Jul 21, 2026

Copy link
Copy Markdown
Owner

No description provided.

Introduces LinkAction, a sibling to SymlinkAction that declares an output
to be a content link of its input -- the same content re-addressed at a
second exec path, sharing the input's digest, with no byte copy and no
spawn. Unlike a symlink, a content link's contract is that it is realized
as content (hard link, copy, reflink, or remote digest reuse) rather than a
followable symbolic link, so its realpath is stable within the consuming
tree (which tools such as Node.js require).

Laydown remains the execution strategy's decision: the action only declares
the relation and leaves a resolvable backing. Strategies that cannot
materialize content (a purely symlinking sandbox, non-sandboxed local) do
not honor the contract; that is an accepted limitation.

Exposes ctx.actions.link(output, target_file). SymlinkAction is unchanged;
the shared metadata-forwarding helper is reused.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017mFt5KqnN5CxwQVvHGC4zR
claude added 4 commits July 21, 2026 03:05
The producer/materialization design was the wrong vehicle. File relocation
belongs in the path-mapping mechanism (PathMapper), where the action declares
an exec-path rewrite and the execution strategy resolves the mapped path to
content -- not in an action that materializes an output. Reverting to a clean
baseline before rebuilding on PathMapper.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017mFt5KqnN5CxwQVvHGC4zR
Reworks ctx.actions.link on top of the existing resolved-path metadata
mechanism instead of a producer action that materializes.

- FileArtifactValue: add a materializeAsContent() hint (default false) and a
  createForContentLink() factory. Ordinary symlinks keep producing plain
  resolved-symlink values (flag false), so symlink behavior is unchanged. The
  hint is exactly what getResolvedPath()'s contract already permits ("an output
  service is free to materialize the artifact in some other way").
- LinkAction: a declaration-only action -- no spawn, no filesystem write. It
  only injects the output's metadata as a content-link value pointing at the
  input's content. How the content is placed (hard link/copy/reflink/digest) is
  left entirely to the execution strategy, as with path mapping.
- ctx.actions.link(output, target_file) exposes it.
- AbstractActionInputPrefetcher: never plant a content link as a followable
  symlink; materialize its content at its own path instead.

Content is realized wherever a strategy can materialize it; a purely symlinking
sandbox or non-sandboxed local execution is an accepted non-goal.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017mFt5KqnN5CxwQVvHGC4zR
Names the observable semantic (a content-identical file at a second path)
rather than a laydown mechanism. "link"/"copy"/"clone" each overcommit to a
mechanism or imply byte cost; "duplicate" describes what you get and leaves the
(free) realization to the execution strategy. Renames LinkAction ->
DuplicateAction and the actions/duplicate_action library accordingly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017mFt5KqnN5CxwQVvHGC4zR
Settles on copy: it reads cleanly ("copy src to out"), names the observable
result, and aligns with the actions.copy direction in bazelbuild/proposals#396
rather than forking terminology. Renames DuplicateAction -> CopyAction and the
actions/copy_action library.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017mFt5KqnN5CxwQVvHGC4zR
@thesayyn thesayyn changed the title Add ctx.actions.link: a content-link action distinct from symlink Add ctx.actions.copy: a content-link action distinct from symlink Jul 27, 2026
@thesayyn thesayyn closed this Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants