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
62 changes: 29 additions & 33 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -270,39 +270,34 @@ jobs:
- name: cargo check
run: cargo check --workspace --all-targets

# nix-flake:
# # Build and test under the nix sandbox so packaging-environment bugs
# # surface before a release / nixpkgs maintainer hits them. See #2624 for
# # the canonical example: a unit test that depends on the process CWD
# # being inside a git repo, which fails in the sandbox where source is
# # extracted from a tarball without `.git`.
# #
# # Runs `nix flake check`, which exercises every check defined in
# # flake.nix — in particular `worktrunk-tests`, which runs `cargo test`
# # with default features (lib + bins + integration + doctests; the
# # `shell-integration-tests` feature is intentionally off). Cold builds
# # take ~10-15 min without a binary cache; nightly cadence absorbs it.
# #
# # Temporarily disabled: many sandbox-specific test failures remain
# # (e.g. bare wt_command() inheriting CWD, target/debug-vs-release
# # snapshot hardcoding). Re-enable behind the `nightly` PR label so
# # fixes can iterate without blocking the nightly cron run.
# needs: gate
# if: needs.gate.outputs.run == 'true'
# runs-on: ubuntu-24.04
# steps:
# - name: 📂 Checkout code
# uses: actions/checkout@v6
#
# - name: Install Nix
# uses: cachix/install-nix-action@v31
# with:
# extra_nix_config: |
# experimental-features = nix-command flakes
# access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
#
# - name: nix flake check
# run: nix flake check --print-build-logs --keep-going
nix-flake:
# Build and test under the nix sandbox so packaging-environment bugs
# surface before a release / nixpkgs maintainer hits them. See #2624 for
# the canonical example: a unit test that depends on the process CWD
# being inside a git repo, which fails in the sandbox where source is
# extracted from a tarball without `.git`.
#
# Runs `nix flake check`, which exercises every check defined in
# flake.nix — in particular `worktrunk-tests`, which runs `cargo test`
# with default features (lib + bins + integration + doctests; the
# `shell-integration-tests` feature is intentionally off). Cold builds
# take ~10-15 min without a binary cache; nightly cadence absorbs it.
needs: gate
if: needs.gate.outputs.run == 'true'
runs-on: ubuntu-24.04
steps:
- name: 📂 Checkout code
uses: actions/checkout@v6

- name: Install Nix
uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}

- name: nix flake check
run: nix flake check --print-build-logs --keep-going

create-issue-on-nightly-failure:
needs:
Expand All @@ -311,6 +306,7 @@ jobs:
- benchmarks
- check-unused-dependencies
- minimal-versions
- nix-flake
if: always() && contains(needs.*.result, 'failure') && github.repository_owner == 'max-sixty' && github.event_name == 'schedule'
runs-on: ubuntu-24.04
permissions:
Expand Down
10 changes: 9 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,15 @@
// {
inherit cargoArtifacts;
src = pkgs.lib.cleanSource ./.;
nativeBuildInputs = commonArgs.nativeBuildInputs ++ [ pkgs.git ];
# Tests shell out to a few host tools — `git` for the harness,
# `python3` for argv-quoting and post-start fixtures, `ps`
# (procps) for the pgid invariant test. Without these on PATH
# the sandbox surfaces them as `No such file or directory`.
nativeBuildInputs = commonArgs.nativeBuildInputs ++ [
pkgs.git
pkgs.python3
pkgs.procps
];
}
);
};
Expand Down
22 changes: 14 additions & 8 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -991,13 +991,12 @@ fn setup_snapshot_settings_for_paths_with_home(
"${1}[VERSION]",
);

// Normalize project root paths in "Binary invoked as:" debug output
// Tests run cargo which produces paths like /path/to/worktrunk/target/debug/wt
// Normalize to [PROJECT_ROOT]/target/debug/wt for deterministic snapshots
settings.add_filter(
r"(Binary invoked as: \x1b\[1m)[^\x1b]+/target/(debug|release)/wt(\x1b\[22m)",
"${1}[PROJECT_ROOT]/target/$2/wt$3",
);
// Collapse build-mode (debug|release) so snapshots survive both cargo's
// debug builds and crane/release builds (notably the nightly nix-flake
// sandbox). The pattern is anchored on `/target/.../wt` so it matches
// the bin path in "Invoked as:" / "Binary invoked as:" / diagnostic
// hint output without touching unrelated `target/` paths.
settings.add_filter(r"/target/(debug|release)/wt", "/target/[BUILD_MODE]/wt");
Comment thread
worktrunk-bot marked this conversation as resolved.
Resolved

// Normalize shell probe binary paths
// Shell probe reports the actual binary location which varies by system
Expand Down Expand Up @@ -1209,7 +1208,14 @@ pub fn add_pty_binary_path_filters(settings: &mut insta::Settings) {
// cargo-affected (`affected/build/`, max-sixty/cargo-affected#12), and
// cross-target builds (e.g. `target/x86_64-unknown-linux-musl/debug/wt`
// from the nightly `release-target` matrix).
settings.add_filter(r"[^\s]+/target/(?:[^/\s]+/)*(?:debug|release)/wt", "[BIN]");
//
// Include the literal `[BUILD_MODE]` placeholder so this filter still
// collapses to `[BIN]` when the prelude's `target/(debug|release)/wt`
// → `target/[BUILD_MODE]/wt` rewrite has already run.
settings.add_filter(
r"[^\s]+/target/(?:[^/\s]+/)*(?:debug|release|\[BUILD_MODE\])/wt",
"[BIN]",
);
}

// =============================================================================
Expand Down
6 changes: 5 additions & 1 deletion tests/integration_tests/config_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ fn test_config_init_already_exists(temp_home: TempDir) {
settings.bind(|| {
let mut cmd = wt_command();
cmd.arg("config").arg("create");
// Run from a directory with no project config so the hint is
// deterministic — bare wt_command() otherwise inherits the
// worktrunk repo's CWD and would pick up `.config/wt.toml`.
cmd.current_dir(temp_home.path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());

Expand All @@ -33,7 +37,7 @@ fn test_config_init_already_exists(temp_home: TempDir) {

----- stderr -----
○ User config already exists: ~/.config/worktrunk/config.toml
↳ To view both user and project configs, run wt config show
↳ To view, run wt config show. To create a project config, run wt config create --project
");
});
}
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ fn normalize_report(content: &str) -> String {
.unwrap()
.replace_all(
&result,
"**Command:** `[PROJECT_ROOT]/target/debug/wt list -vv`",
"**Command:** `[PROJECT_ROOT]/target/[BUILD_MODE]/wt list -vv`",
)
.to_string();

Expand Down
8 changes: 7 additions & 1 deletion tests/integration_tests/post_start_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,12 @@ fn test_post_create_script_reads_json(repo: TestRepo) {
let scripts_dir = repo.root_path().join("scripts");
fs::create_dir_all(&scripts_dir).unwrap();

let script_content = r#"#!/usr/bin/env python3
// Resolve `python3` on PATH and bake the absolute path into the shebang.
// `#!/usr/bin/env python3` doesn't work in the nix sandbox where
// `/usr/bin/env` doesn't exist; the kernel runs the literal interpreter
// path, so shebang resolution can't piggyback on PATH directly.
let python = which::which("python3").expect("python3 in PATH for test");
let script_body = r#"
import json
import sys

Expand All @@ -596,6 +601,7 @@ with open('hook_output.txt', 'w') as f:
f.write(f"hook_type={ctx['hook_type']}\n")
f.write(f"hook_name={ctx.get('hook_name', 'unnamed')}\n")
"#;
let script_content = format!("#!{}{}", python.display(), script_body);
let script_path = scripts_dir.join("setup.py");
fs::write(&script_path, script_content).unwrap();
fs::set_permissions(&script_path, fs::Permissions::from_mode(0o755)).unwrap();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
source: tests/integration_tests/config_show.rs
assertion_line: 885
info:
program: wt
args:
Expand Down Expand Up @@ -61,7 +60,7 @@ exit_code: 0

SHELL INTEGRATION
▲ Shell integration not active
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt
  $SHELL: /bin/bash

○ bash: Already configured shell extension & completions @ ~/.bashrc:2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ exit_code: 0
SHELL INTEGRATION
▲ Shell integration not configured
↳ To configure, run wt config shell install
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt

CLAUDE CODE
↳ Plugin not installed. To install, run wt config plugins claude install
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ exit_code: 0
SHELL INTEGRATION
▲ Shell integration not configured
↳ To configure, run wt config shell install
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt

OTHER
○ wt: [VERSION]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ exit_code: 0
SHELL INTEGRATION
▲ Shell integration not configured
↳ To configure, run wt config shell install
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt

OTHER
○ wt: [VERSION]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ exit_code: 0
SHELL INTEGRATION
▲ Shell integration not configured
↳ To configure, run wt config shell install
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt

OTHER
○ wt: [VERSION]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ exit_code: 0
SHELL INTEGRATION
▲ Shell integration not configured
↳ To configure, run wt config shell install
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt

OTHER
○ wt: [VERSION]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ exit_code: 0
SHELL INTEGRATION
▲ Shell integration not configured
↳ To configure, run wt config shell install
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt

OTHER
○ wt: [VERSION]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ exit_code: 0
SHELL INTEGRATION
▲ Shell integration not configured
↳ To configure, run wt config shell install
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt

OTHER
○ wt: [VERSION]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ exit_code: 0
SHELL INTEGRATION
▲ Shell integration not configured
↳ To configure, run wt config shell install
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt

OTHER
○ wt: [VERSION]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ exit_code: 0
SHELL INTEGRATION
▲ Shell integration not configured
↳ To configure, run wt config shell install
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt

OTHER
○ wt: [VERSION]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ exit_code: 0

SHELL INTEGRATION
▲ Shell integration not active
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt

▲ fish: Outdated shell extension @ ~/.config/fish/functions/wt.fish
↳ To update, run wt config shell install fish
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ exit_code: 0

SHELL INTEGRATION
▲ Shell integration not active
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt

○ fish: Already configured shell extension @ ~/.config/fish/functions/wt.fish:7
  command wt config shell init fish | source
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ exit_code: 0

SHELL INTEGRATION
▲ Shell integration not active
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt

○ fish: Already configured shell extension @ ~/.config/fish/functions/wt.fish:7
  command wt config shell init fish | source
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ exit_code: 0
SHELL INTEGRATION
▲ Shell integration not configured
↳ To configure, run wt config shell install
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt

OTHER
○ wt: [VERSION]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ info:
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
WORKTRUNK_TEST_FISH_INSTALLED: "0"
WORKTRUNK_TEST_LATEST_VERSION: 0.47.0
WORKTRUNK_TEST_LATEST_VERSION: 0.48.0
WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
Expand All @@ -66,7 +66,7 @@ exit_code: 0
SHELL INTEGRATION
▲ Shell integration not configured
↳ To configure, run wt config shell install
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt

DIAGNOSTICS
↳ CI status requires GitHub or GitLab remote
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ info:
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
WORKTRUNK_TEST_FISH_INSTALLED: "0"
WORKTRUNK_TEST_LATEST_VERSION: 0.47.0
WORKTRUNK_TEST_LATEST_VERSION: 0.48.0
WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
Expand All @@ -63,7 +63,7 @@ exit_code: 0
SHELL INTEGRATION
▲ Shell integration not configured
↳ To configure, run wt config shell install
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt

DIAGNOSTICS
↳ CI status requires GitHub or GitLab remote
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ exit_code: 0
SHELL INTEGRATION
▲ Shell integration not configured
↳ To configure, run wt config shell install
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt

DIAGNOSTICS
↳ CI status requires GitHub or GitLab remote
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ exit_code: 0
SHELL INTEGRATION
▲ Shell integration not configured
↳ To configure, run wt config shell install
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt

DIAGNOSTICS
↳ CI status requires GitHub or GitLab remote
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ exit_code: 0
SHELL INTEGRATION
▲ Shell integration not configured
↳ To configure, run wt config shell install
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt

OTHER
○ wt: [VERSION]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ exit_code: 0
SHELL INTEGRATION
▲ Shell integration not configured
↳ To configure, run wt config shell install
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt

OTHER
○ wt: [VERSION]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ exit_code: 0
SHELL INTEGRATION
▲ Shell integration not configured
↳ To configure, run wt config shell install
  Invoked as: [PROJECT_ROOT]/target/debug/wt
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt

OTHER
○ wt: [VERSION]
Expand Down
Loading
Loading