October 30, 2026
8 pull requests merged across 1 repo
bahdotsh/wrkflw
Problem
Gitea runs GitHub-compatible workflows, but it looks in .gitea/workflows first. In a repository that only has that directory:
wrkflw validatefailed withPath does not exist: .github/workflows.wrkflw list, the TUI andwrkflw watchfound nothing by default.actions/checkoutdropped.giteafrom the workspace, so steps could not read it.${{ gitea.ref }}silently evaluated to an empty value.
An explicit wrkflw validate .gitea/workflows already worked, and the validator already accepted Gitea-style syntax.
Changes
- Discovery: new helpers in
wrkflw-utilsuse Gitea's order,.gitea/workflowsthen.github/workflows. The order comes fromWorkflowDirsin Gitea'smodules/setting/actions.go. validate,listand the TUI: these cover both directories when both exist. Gitea only runs the first, but a repository mirrored to both forges uses both.watch: this takes one directory, so it picks.gitea/workflowsand prints a note naming the skipped one.- Workspace copy: both copy routines now keep
.gitea. - Expressions:
giteais an alias of thegithubcontext. listrefactor: the directory listing moved intolist_workflow_dir, which accounts for most of themain.rsdiff.
Behaviour change
In a repository with both directories, wrkflw watch now defaults to .gitea/workflows, not .github/workflows. Repositories with only .github/workflows are unaffected, except that the list message is reworded when neither directory exists.
Not included
- Absolute-URL actions:
uses: https://gitea.com/actions/checkout@v4passes validation, but at run time the URL is mangled and the step falls back to built-in handling, reporting success. This is listed under "Not yet supported" in the README. - Remote triggering:
triggerstays GitHub and GitLab only. - Forgejo:
.forgejo/workflowsis not discovered.
Testing
cargo test --workspace,cargo clippy --workspace --all-targets -- -D warningsandcargo fmt --checkall pass.- New unit tests cover directory ordering, both workspace copies and the
giteaalias. - I ran the built binary against
.gitea-only, both-directory and neither-directory repositories forvalidateandlist, and startedwatchon the first two. - An emulation run with
actions/checkoutreads.gitea/workflows/co.ymlwith the fix and fails when the engine copy change is reverted. - The TUI, driven through a pseudo-terminal, lists
.gitea/workflows, both directories together, and.github/workflowsalone, and it ran a.giteaworkflow to success. - A workflow using
actions/checkout, a local.giteacomposite action,gitea.*expressions and a reusable.giteaworkflow passes under the emulation and Podman runtimes. Docker was not running, so it was not tested. wrkflw validateexits 1 on an invalid.giteaworkflow, andwrkflw watchtriggers when a.giteaworkflow is edited.
Existing issues found, not caused by this PR
secure-emulationfails the same workflow from.github: a step cannot see checked-out files.wrkflw watchon macOS re-triggers many times after one edit. Unmodifiedmainand this branch both logged about 20 detections in 12 seconds.
Problem
The TUI palette was hard-coded for dark backgrounds. On a light terminal, pale yellow and cyan text was nearly invisible, and the title bar, status bar and selected row stayed near-black.
Changes
- Light palette:
COLORSnow resolves to a dark or light table at runtime, so existing call sites are unchanged. The dark palette keeps its values. - Accents: each Tweaks accent has a light variant. The accent overrides the palette on every frame, so the palette alone would not have fixed it.
- Help overlay: the backdrop uses the theme instead of hard-coded black.
- Theme selection: the theme is chosen once at startup, in this order:
1. --theme auto|dark|light
2. WRKFLW_THEME
3. The terminal's reported background
4. COLORFGBG
5. Dark
Auto-detection suits terminals that change theme by time of day, as in the issue.
Notes for review
- New dependency:
terminal-colorsaurusis added behind thetuifeature. It resolves to 1.0.0 because 1.0.3 conflicts with themioversion required bycrossterm0.28. - Public API:
run_wrkflw_tuigains athemeparameter, which is a breaking change for library users. The READMEs are updated. - Startup delay: a terminal that answers neither color nor device queries delays startup by up to 1 second. Explicit
--theme darkor--theme lightskips the query. - No live switching: changing the terminal theme needs a TUI restart. A live toggle is left out because the log worker caches styles built from the old palette.
- Forced light on a dark terminal: the TUI does not paint the main background, so light text colors are the user's explicit choice there.
Testing
cargo fmt --check,cargo clippy --workspace --all-targets -- -D warningsandcargo test --workspacepass.wrkflwbuilds with--no-default-features.- New unit tests require 4.5:1 contrast for light-theme text on white and on every light background, and for solid chips.
- The real binary was run in a scripted pseudo-terminal, reading the colors it emitted:
- Flag, environment variable, flag precedence and invalid environment values behaved as designed.
- Simulated white and black terminals selected light and dark.
- A silent terminal used
COLORFGBG, then dark. - This has not been checked by eye in a real terminal emulator.
Problem
wrkflw hardcoded ~/.wrkflw/ in three places: the actions/cache store (the one the issue cites), RUNNER_TOOL_CACHE, and the default file secrets provider path.
Changes
| Purpose | Before | Linux | macOS |
|---|---|---|---|
actions/cache store | ~/.wrkflw/cache | $XDG_CACHE_HOME/wrkflw/cache | ~/Library/Caches/wrkflw/cache |
RUNNER_TOOL_CACHE | ~/.wrkflw/tools | $XDG_CACHE_HOME/wrkflw/tools | ~/Library/Caches/wrkflw/tools |
Default file secrets | ~/.wrkflw/secrets | $XDG_CONFIG_HOME/wrkflw/secrets | ~/Library/Application Support/wrkflw/secrets |
Paths come from the dirs crate, which was already a dependency, so $XDG_* is honoured on Linux and macOS and Windows use their native locations. $XDG_* is not read on macOS.
Migration
- Secrets:
~/.wrkflw/secretskeeps being used until the new location exists, so upgrading does not hide anyone's secrets. - Caches: not migrated, because they repopulate on the next run. The old directories are left in place, and
BREAKING_CHANGES.mddocuments how to delete them.
Testing
cargo test --workspaceandcargo clippy --workspace --all-targets -- -D warningspass.- New unit tests cover how the secrets path is chosen (new location, legacy fallback, both present, neither resolvable).
- End-to-end on macOS with an isolated
HOME: an emulation run saved and then restored anactions/cacheentry underLibrary/Caches/wrkflw/cache,RUNNER_TOOL_CACHEpointed atLibrary/Caches/wrkflw/tools, and no~/.wrkflwwas created. - CI passes on Linux, macOS and Windows, but only the macOS paths were exercised end-to-end. The
$XDG_*lookup on Linux relies ondirs.
Docs
The secrets docs described ~/.wrkflw/secrets.yml as if it were picked up automatically, but nothing loads a config file by default. The paths are updated, and the root README now points at the secrets directory the file provider actually reads. crates/secrets/README.md and the secrets demo still describe a config file there and only had their paths changed.
Problem
strategy.matrix.include: ${{ fromJSON(needs.<job>.outputs.<name>) }} is valid GitHub Actions syntax, but wrkflw validate failed with include must be an array of objects. Fixing that message alone wasn't enough, because MatrixConfig couldn't deserialize a string there either.
Changes
wrkflw-matrix:includeandexcludeare nowMatrixEntries, either a literalListor anExpression.MatrixConfig::resolve_expressionsturns expressions into lists.expand_matrixreturns an error if one is still unresolved, rather than silently dropping it.- Include-only matrices: a matrix with
includeand no axes now expands. It used to fail with "Matrix has no valid parameters", and it's a common shape for generated matrices. - Strategy contexts: expressions may use only
github,needs,varsandinputs, and no special functions, matching GitHub'sstrategycontext.wrkflw validateandwrkflw runshare this check.varsis accepted but wrkflw does not resolve it, so it evaluates to empty. - Executor: expressions are resolved after the job's
if:gate. A matrix that can't be computed fails that job, and its dependents are skipped. - Validator and parser: accept a value wrapped in
${{ }}. Plain strings and non-object items are still rejected. - TUI: the matrix pane shows an expansion error for these jobs, because the combinations aren't known until the run.
Behaviour to check
- If the expression doesn't evaluate to an array of objects, the job fails and the rest of the run continues. This includes an empty output, and an include-only matrix that resolves to
[]. Static expansion failures now behave the same way. MatrixConfig.includeand.excludechange type, which is a breaking change to the public API ofwrkflw-matrix.
Not included
- Expressions for the whole matrix (
matrix: ${{ ... }}) are still rejected. - Expressions for a single axis (
os: ${{ ... }}) still pass validation but are treated as a literal value at run time.
Testing
- Added unit tests in
wrkflw-matrixand the validator. - Added
crates/wrkflw/tests/dynamic_matrix_test.rs, which runs merging, include-only, exclude and invalid-result cases end to end through emulation. cargo test --workspaceandcargo clippy --workspace --all-targets -- -D warningspass.- Ran a local workflow with the same shape as the issue's, with
list.pyreplaced by its hard-coded JSON output and the install and setup-node steps removed. It validated and ran 4 combinations.
Problem
On some terminals (reported on iTerm2), entering the alternate screen keeps whatever was on the primary screen. ratatui assumes the terminal starts blank and only writes cells that change between frames, so pre-existing text stayed visible in any region a frame didn't paint — including after switching tabs such as Logs.
Fix
Call terminal.clear() right after constructing the ratatui Terminal. This clears the physical screen and resets ratatui's back buffer, so the first frame is drawn onto a known-empty screen. Resizes are already handled by ratatui's autoresize, which clears too.
Testing
cargo build/cargo clippy/cargo fmt --checkforwrkflw-ui- Not verified interactively in iTerm2
Problem
wrkflw parsed only the top-level .gitlab-ci.yml, as written. Real pipelines like the two in the issue failed:
- rust-json-job-dispatch: hidden
.-prefixed templates were reported as jobs with no script, and everyextendstarget defined in anincluded file showed up asextends undefined job. - ParaView: failed straight away with
deserializing from YAML containing more than one document is not supported, because of itsspec:inputsheader.
Even where validation passed, extends was never applied, so a job that took its script from a template would run with no steps.
Fix
A new gitlab_config module in the parser builds the resolved configuration before it is deserialized into Pipeline:
| Feature | Behaviour |
|---|---|
include | Local includes, given as a string, as local:, or with wildcards. They are deep-merged in order and the including file wins. Cycles are detected, and paths must stay inside the repository. remote/project/template/component are skipped with a warning, since they need network access. |
spec:inputs | Header document plus $[[ inputs.x ]] interpolation in keys and values. Uses defaults and checks type/options/regex. Reports required inputs that are missing and inputs that are unknown. A whole-string placeholder keeps its type (number/bool/array). Supports expand_vars, truncate(a,b) and posix_escape. |
extends | Deep merge, multiple parents applied in order, transitive. Cycle and depth (11) limits. |
!reference | Resolved after extends, nesting limited to 10 levels. Nested script arrays (from anchors or references) are flattened, as GitLab does. |
| Hidden keys | .-prefixed keys are removed once resolved, so they are never treated as jobs. |
Smaller model and schema gaps that the example pipelines hit:
allow_failure: { exit_codes: ... }is now accepted (newAllowFailureenum; the field had no other users).- Jobs with
trigger:and noscriptare accepted by the validators. - The bundled schema now accepts a list for
artifacts:reports:annotationsand null/empty variable values. ParaView uses both and GitLab accepts both. - Schema errors now include the JSON path (e.g.
/job/variables/FOO: ...). The merged config has no line numbers, so without the path these errors were impossible to locate.
Testing
- 12 new unit tests in
gitlab_configand oneparse_pipelineintegration test. They cover merging, overrides, wildcards, skipped includes, cycles, escaping the repository root, typed inputs, input errors,!reference, and anchor flattening. cargo fmt --check,cargo clippy --workspace --all-features -- -D warnings,cargo check --no-default-features,cargo test --workspace --all-featuresall pass locally (853 tests).- Both pipelines from the issue now validate cleanly (
wrkflw validate .gitlab-ci.yml). ParaView resolves to 25 jobs across its include/inputs chain. - End-to-end
wrkflw run --runtime emulationon a fixture with two levels of inputs, includes, multi-parentextendsand!reference. A script asserting the interpolated and inherited values passes, and the same script with a wrong expected value fails.
Known limitations (not in this PR)
rules:onincludeentries are ignored; the file is always included.trigger:jobs run as no-op jobs locally.default:keyword values still aren't applied to jobs (pre-existing).
Follow-up to #126.
Problem
#126 skipped jobs whose needs: did not succeed, but let any job with an explicit if: bypass the gate. That if: was then evaluated by evaluate_job_condition with job_status hardcoded to "success" and an empty needs context. After a failed need:
if: | GitHub Actions | before this PR |
|---|---|---|
failure() | runs | skipped |
success() | skipped | ran |
always() && needs.x.result == 'failure' | runs | skipped (needs.x.result was null) |
github.ref == '…' (no status function) | skipped (implicit success() &&) | ran |
Jobs inside reusable workflows were not gated at all, because run_called_workflow runs its own batch loop.
Change
The gate moves from the execute_github_workflow batch loop into execute_job_with_matrix, after the needs context is built:
- A job with no
if:is evaluated assuccess(). - An
if:that calls none ofsuccess()/failure()/always()/cancelled()is evaluated assuccess() && (<expr>). String literals and property names are ignored when looking for those calls. success()/failure()see the upstream status. It isfailurewhen any transitive ancestor failed, which matches GitHub's documented ancestor rule. It isskippedwhen a direct need was skipped, so both functions are false.needs.<id>.resultandneeds.<id>.outputsare available to the job-levelif:.- - A matrix job's
needs.<id>.resultis the aggregate of its combinations:failureif any failed, otherwisesuccessif any succeeded, otherwiseskipped. It used to be whichever combination was recorded last. A combination that errors withfail-fast: falseis now recorded as failed instead of dropped. - Status-function detection uses the expression tokenizer instead of a separate scanner.
- A need with no recorded result does not block. That only happens for a matrix job that expanded to zero combinations. The old comment blamed
--target-jobplans, which always keep transitive deps.
Because run_called_workflow also runs jobs through execute_job_with_matrix, reusable workflows get the same rules. job_blocked_by_needs is removed, and the skipped JobResult literal is replaced by a JobResult::skipped constructor.
Tests
Unit tests in engine.rs cover status-function detection, implicit success(), the skipped-need case and upstream_status. The existing evaluate_job_condition tests were moved to the new signature unchanged in meaning.
New integration tests in needs_failure_propagation_test.rs:
| test | asserts |
|---|---|
status_functions_see_the_failed_need | if: failure() runs, if: success() skips |
needs_result_is_visible_to_job_if | needs.deploy.result == 'failure' is true |
plain_if_is_still_gated_on_needs | if: ${{ true }} still skips after a failed need |
need_skipped_by_its_own_if_skips_dependents | if: false on a need skips its dependent |
any_failed_need_among_several_skips | one failed need out of two skips |
ancestor_failure_propagates_past_an_always_job | failed grandparent keeps success() false and failure() true |
reusable_workflow_jobs_skip_after_failed_need | inner needs: chain is gated |
matrix_need_with_one_failed_combination_counts_as_failed | plain, failure() and needs.x.result all see a failed matrix |
fail_fast_matrix_need_counts_as_failed | fail-fast-skipped combinations don't mask the failure |
needs_outputs_are_visible_to_job_if | needs.<id>.outputs drives a job if: both ways |
gate_skipped_need_reports_skipped_result | a gate-skipped need reports skipped |
The integration test file is gated off Windows. It runs bash steps through the emulation runtime, and on windows-latest bash is the WSL launcher with no distribution installed, so every step fails. This was already failing on main since #126. The engine's own emulation unit tests use the same gate.
Against main's engine, 5 of these fail. On this branch, cargo fmt --check, cargo clippy --workspace --all-features --tests -- -D warnings, cargo test --workspace --all-features (836 passed) and cargo check --no-default-features --workspace are all clean.
Behaviour change
Jobs with if: expressions that call no status function now skip after a failed need, as they do on GitHub. This is worth a line in the release notes.
Follow-up to #123, addressing the review findings left after merge.
Fixes
- Windows host + docker/podman. The
{0}script path was built withguest_dir.join(name), which produces/github/workflow\wrkflw-<uuid>on a Windows host. A Linux container cannot resolve that. The guest path is now built as a POSIX string, the same way theGITHUB_ENVremap already does it. Windows CI did not catch this because the mock runtime resolves mounts withPath::strip_prefix, which accepts both separators on Windows. - Missing mount under a container runtime. When
github_mountwasNone, the code fell back to usingworking_diras both host and guest path. That is only valid for host-side runtimes. Under docker/podman the step now fails with an explicit message instead of passing the container a host path. It is unreachable today becauseGITHUB_ENVis always seeded, but the invariant is now enforced instead of implied.
Refactor
- The custom-shell setup moved out of
execute_stepintoprepare_custom_shell. It returns aCustomShellScriptguard whoseDropremoves the script file, so cleanup happens on every exit path. - The docker/podman check is now a single
uses_container_runtimehelper, stored onStepContainerContext. It was duplicated betweenexecute_stepandprepare_container_mounts. - The resolved custom shell argv is logged at info level. The previous path was silent outside emulation's verbose logs.
Tests
prepare_custom_shell_uses_posix_guest_path_under_container_runtimeasserts the guest path has no\, the script content is correct, and the file is removed on drop.prepare_custom_shell_fails_without_github_mount_under_container_runtimeasserts the explicit failure and that nothing is written to the host.prepare_custom_shell_rejects_missing_placeholder_without_writingasserts no file is left behind on a validation failure.custom_shell_resolves_relative_command_to_absolute_pathnow uses a tempdir instead of writing its script into the crate directory.
cargo fmt --check, cargo clippy --workspace --all-features -- -D warnings, cargo check --no-default-features --workspace and cargo test --workspace --all-features are clean locally on macOS.
Not in scope
- The
cmdarm still usescmd -c. The real template iscmd /D /E:ON /V:OFF /S /C "CALL "{0}"", but it needs a Windows runner to verify.