Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions docs/src/content/docs/configuration/extends.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ runok distinguishes between mutable and immutable references for caching:

Mutable references (tags, branches) are cached for 24 hours by default. Immutable references (commit SHAs) are cached permanently. See [Environment Variables](/configuration/environment-variables/) for how to configure the cache TTL.

:::caution
runok warns when you use mutable references (tags, branches, or default branch) because they can change over time. For reproducible builds, prefer pinning to a specific commit SHA.
:::

## Resolution Order

When a config file specifies `extends`, runok resolves presets using depth-first traversal:
Expand Down
23 changes: 0 additions & 23 deletions docs/src/content/docs/troubleshooting/common-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,29 +93,6 @@ Look for the `[verbose] No rules matched` message to confirm, then check the fol
warning: Failed to update preset 'github:org/repo', using cached version
```

## Mutable preset reference warnings

**Symptom:** Warning message about mutable preset references appears on every run.

```
warning: Mutable preset reference 'github:org/repo@main'
Consider pinning to a commit SHA for reproducibility
```

**Cause:** The `extends` field uses a branch name, tag, or version without pinning to a specific commit. This is risky because the upstream content can change unexpectedly.

**Solution:** Pin to a commit SHA:

```yaml
# Before
extends:
- 'github:org/repo@main'

# After
extends:
- 'github:org/repo@a1b2c3d4e5f6'
```

## Sandbox errors

**Symptom:** Commands fail with sandbox-related error messages.
Expand Down
37 changes: 0 additions & 37 deletions src/config/preset_remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ impl GitHubVersion {
matches!(self, Self::CommitSha(_))
}

/// Whether this is a mutable reference that should trigger a warning.
pub fn is_mutable(&self) -> bool {
!self.is_immutable()
}

/// Convert to a git ref string for `--branch` or `checkout`.
pub fn as_git_ref(&self) -> Option<&str> {
match self {
Expand Down Expand Up @@ -263,23 +258,6 @@ fn resolve_git_params(reference: &PresetReference) -> GitParams {
}
}

/// Emit a warning to stderr if the reference is mutable.
fn emit_mutable_warning(reference: &PresetReference, original: &str) {
let is_mutable = match reference {
PresetReference::GitHub { version, .. } => version.is_mutable(),
PresetReference::GitUrl { git_ref, .. } => {
git_ref.as_deref().is_none_or(|r| !is_commit_sha(r))
}
PresetReference::Local(_) => false,
};
if is_mutable {
eprintln!(
"warning: Mutable preset reference '{original}'\n \
Consider pinning to a commit SHA for reproducibility"
);
}
}

/// Read a preset config file from a directory.
///
/// When `preset_path` is `None`, reads `runok.yml` (or `runok.yaml`) from the root.
Expand Down Expand Up @@ -356,8 +334,6 @@ pub fn load_remote_preset<G: GitClient>(
git_client: &G,
cache: &PresetCache,
) -> Result<Config, ConfigError> {
emit_mutable_warning(reference, original_reference);

let params = resolve_git_params(reference);
let cache_dir = cache.cache_dir(original_reference);
let preset_path = preset_path_from_reference(reference);
Expand Down Expand Up @@ -653,19 +629,6 @@ mod tests {
assert_eq!(is_commit_sha(input), expected);
}

// === GitHubVersion mutability ===

#[rstest]
#[case::sha_immutable(
GitHubVersion::CommitSha("abc1234def567890abc1234def567890abc12345".into()),
false
)]
#[case::tag_mutable(GitHubVersion::Tag("v1.0.0".into()), true)]
#[case::latest_mutable(GitHubVersion::Latest, true)]
fn version_mutability(#[case] version: GitHubVersion, #[case] expected_mutable: bool) {
assert_eq!(version.is_mutable(), expected_mutable);
}

// === GitHub shorthand → git URL conversion ===

#[rstest]
Expand Down
Loading