Skip to content

build(tasks): rewrite scripted mise tasks in nu - #65

Merged
sweepies merged 1 commit into
mainfrom
chore/nu-tasks
Oct 28, 2026
Merged

sweepies merged 1 commit into
mainfrom
chore/nu-tasks

Conversation

@sweepies

@sweepies sweepies commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Replaces #63 (xtask, which Sweepy rejected). Every task with real logic is now a nu file task that works on nu's structured data. The trivial ones, and every other inline task, now live in a root tasks.toml that mise.toml includes through [task_config] includes = ["tasks.toml", "mise-tasks"], so mise.toml holds only tools, env and that include. nu 0.116.1 is pinned in mise.toml and mise.lock.

Where each task went

Line counts are the old script, then the new file or tasks.toml entry (plus its tools table).

Task Before After
test:unit bash, 12 tasks.toml entry, 8 (usage choices plus a Tera if for --part)
test:tools bash, 18 tasks.toml entry, 3 + 13 tools
docs:cli bash, 15 nu, 27
benchmarks:summary bash, 11 tasks.toml entry, 4
cache:usage bash, 6 tasks.toml entry, 4
ci bash, 21 nu, 23
ci:changes bash, 38 nu, 51
cache:prune (also used by the PR cache cleanup) bash, 62 nu, 48
test:stress bash, 32 nu, 37
corpus:report bash + jq, 26 nu, 52
release:package bash + jq, 38 nu, 49
conformance:inspect bun, 28 nu, 45
conformance:logs bun, 19 nu, 34
registry:update bun, 5 nu, 7
server:replay bun, 25 nu, 41
cc, ar bash, 13 and 3 stay bash (cc gains -mcpu=baseline, see below)

No task was renamed. jq is gone: corpus:report and release:package read JSON with from json, and ci:changes uses gh api --paginate --slurp | from json instead of gh's --jq. External failures stop a nu script, so there's no set -euo pipefail to forget. Where a failure should only warn (a failed gh cache delete), the script says so with try.

HMAC for server:replay. The signature is HMAC-SHA256 written in nu, using hash sha256 --binary and bits xor over the 64-byte pads, about ten lines. I chose this over openssl because the secret never appears on a command line (openssl dgst -hmac takes the key as an argument) and there's nothing extra to install. It matches Python's hmac for a 100-byte key, which exercises the key-hashing path. A signature-verifying listener accepted it from both a secret value and a secret file, and rejected a wrong secret with 401.

Checked against the old scripts

  • ci:changes: identical GITHUB_OUTPUT to the bash script on the last 50 PRs, and on a push.
  • registry:update: byte-identical registry.json to the bun script.
  • conformance:logs and conformance:inspect: byte-identical output to the bun scripts on the conformance fixtures, across every mode (buckets, warnings, a manager, a manager with a limit).
  • corpus:report: identical Markdown summary to the bash and jq script, using a stub PATCHULA_BIN that covers warnings, a non-string warning, null reasons and an error branch. It exits 1 on an error branch, and on a failing corpus:check.
  • ci: checked with a stub mise. It keeps each stage's log and stops at the first failure with the same test result: FAILED; stage=…; failing-tests=a::c,d,; full-log=… line.
  • release:package x86_64-unknown-linux-musl: produced the same archive layout.
  • cache:prune: listed the same entries as the bash script on a PR ref.

cc and ar stay bash

nu's startup is what makes the difference.

Measurement bash wrapper nu wrapper
Wrapper startup, zig stubbed out 1.3 ms per call 6.9 ms per call
Real zig cc -c of a small file (direct: 15–20 ms) 15.8–20.4 ms 23.5–25.5 ms
Clean cargo test --workspace --no-run (126 cc calls), two rounds 43.8 s, 35.8 s 56.1 s, 37.6 s

That's about 5 ms more per compile or link, and 2 to 12 s more per clean build, for wrappers that only rewrite two arguments. So they stay bash.

cc fix: -mcpu=baseline

The first CI run failed in Corpus: lookup with Illegal instruction (core dumped), twice. rustc passes no target when it links a host binary, so Zig built its own runtime (sort.block, debug.writeCurrentStackTrace, chacha20) for the build runner's CPU. The debug binary from that run had about 4,000 AVX-512 instructions in Zig's code. The corpus job runs that binary on another runner, which lacked AVX-512.

This bug is already on main; whether it hits depends on which CPU each job lands on. With -mcpu=baseline, only the code that picks AVX-512 at run time keeps it (aws-lc's AES-GCM, crc32fast), and the corpus job passed. Release builds were never affected, because they link with an explicit -target.

CI timing

The baseline is a no-op control PR on current main (#64, two runs), plus #61's PR runs where #64 skipped a job. "After" is this PR's two runs; the first had the corpus failure above.

Job Before After
Changed paths 6 s, 6 s (#61: 5–8 s) 12 s, 10 s (installing nu: 4 s)
Cache: prune superseded entries 4 s (bash, same run; 9 s on main) 12 s (nu, same run)
Cache cleanup on PR close 8 s not run; same steps as prune, so about 12 s
Lint: rustfmt, clippy 112 s, 134 s 103 s, 107 s
Lint: workflows 32 s, 36 s 68 s, 36 s
Build: workspace, fixture secret scan 129 s, 146 s 108 s, 139 s
Tests: unit (update) 145 s, 170 s 191 s, 116 s
Tests: unit (others) 272 s, 253 s 244 s, 239 s
Tests: real lockfile tools 151 s, 130 s 151 s, 137 s
Docs: build skipped (#61: 27–62 s) 39 s, 44 s
Corpus: lookup 99 s, 105 s 37 s (SIGILL), 93 s

A third run, at the final head 408a389, took: Changed paths 10 s, Lint 85 s, Build 133 s, unit (update) 178 s, unit (others) 253 s, real tools 117 s, Docs 34 s, Corpus 101 s.

Installing nu costs Changed paths, prune and cleanup about 4 to 8 s each, because those jobs used to install nothing. Changed paths gates every pull request, so that's about 5 s added to every run's critical path. The other jobs are within run-to-run noise.

Tests: unit (others): the slowdown seen on #63 comes from main. On unchanged main (#64) it took 272 s and 253 s, with compile at 2m18s and the same 275 hits and 55 misses, which matches #63 and this PR.

Bun

The conformance harness installs Renovate with mise exec -- aube --dir <tmp> install --ignore-scripts. bun leaves [tools]. It stays in mise.lock as a task-scoped engine of test:tools and test:stress, because the real lockfile tests regenerate bun.lock, and the pin test now checks it too.

Still Sweepy's call: aube's trust policy rejects @yarnpkg/[email protected], which has no provenance while 3.2.0 did, and was published 2025-09-18. The harness exempts exactly that version in a generated aube-workspace.yaml.

Docs

AGENTS.md now says: trivial tasks are entries in tasks.toml, which mise.toml includes, anything longer is a nu file task, and cc and ar stay shell. The branch sits on top of 2c2661e, so the CI cache and site search pages stay removed.

tasks.toml

Every TOML task moved from [tasks.*] in mise.toml to a top-level table in tasks.toml, unchanged. The includes list replaces mise's default task directories, so it names mise-tasks too, or the file tasks (including cc and ar, which CC and AR point at) would disappear. mise tasks lists the same 53 tasks. ci:changes treats tasks.toml like mise.toml (everything runs), and the engine pin test reads test:tools' tools from tasks.toml.

Task caching

docs:cli and docs:build declare sources and outputs, so mise skips them when every output is newer than every source. docs:cli watches Cargo.toml, crates/cli/ (the only crate with clap definitions) and the .usage templates. docs:build watches the site's src/, public/, config and lockfile, and writes to dist/. release:package runs mise run --force docs:cli so a release always regenerates the pages from the binary it ships, whatever the checkout's mtimes say. CI's docs job starts with no dist/, so it always builds.

@deepsource-io

deepsource-io Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 2c2661e...e2d34a2 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

Important

Some issues found as part of this review are outside of the diff in this pull request and aren't shown in the inline review comments due to GitHub's API limitations. You can see those issues on the DeepSource dashboard.

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Rust Oct 28, 2026 5:01p.m. Review ↗
JavaScript Oct 28, 2026 5:01p.m. Review ↗
Shell Oct 28, 2026 5:01p.m. Review ↗
Secrets Oct 28, 2026 5:01p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@context7

context7 Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Docs7 for sweepies/count-patchula

Result Status Action
Deployment ➖ Not used —
Content review ➖ Did not run. This site has no agent runs available this month. Wait for the monthly reset or check your Docs7 plan. —

Commit 6294f4c

@sweepies
sweepies force-pushed the chore/nu-tasks branch 2 times, most recently from 586c3ae to 408a389 Compare October 27, 2026 22:50
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
count-patchula e2d34a2 Commit Preview URL

Branch Preview URL
Oct 28 2026, 05:01 PM

@sweepies
sweepies marked this pull request as ready for review October 28, 2026 02:50
@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

RetriggerView in Greptile

[Medium impact] The PR appears safe to merge; no new actionable issue was established.

Reviews (3) · Last reviewed commit: "build(tasks): rewrite scripted mise task..." · Reviewed by Greptile

Comment thread mise-tasks/corpus/report Resolved
Comment thread tasks.toml Resolved
Tasks that run a command or two in order are now plain mise.toml entries:
test:unit, test:tools, docs:cli, benchmarks:summary and cache:usage. Every
task with real logic is a nu file task that works on structured data instead
of jq and bash string handling: ci, ci:changes, cache:prune, test:stress,
corpus:report, release:package, conformance:inspect, conformance:logs,
registry:update and server:replay. nu 0.116.1 is pinned in mise.toml and
mise.lock. The jobs that ran a script without mise (Changed paths, prune and
the pull request cache cleanup) install only nu.

server:replay computes HMAC-SHA256 in nu, so the secret never appears in a
command line.

The conformance harness installs Renovate with aube instead of bun, so bun
leaves the base tools; it stays a task-scoped engine for the real lockfile
tool tests.

mise-tasks/cc now passes -mcpu=baseline. When rustc links a host binary it
names no target, so Zig built its runtime for the build runner's CPU, and the
corpus job died with SIGILL running a binary linked on an AVX-512 runner.
@sweepies
sweepies merged commit 193f721 into main Oct 28, 2026
19 checks passed
@sweepies
sweepies deleted the chore/nu-tasks branch October 28, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant