Commit Graph
12 Commits
Author SHA1 Message Date
dotCooCoo d04218c1ce craft-xtask: open lock and owner files on Unix without waiting on a FIFO
Owner files are opened with O_NOFOLLOW and O_NONBLOCK, and the opened
handle must be a regular file with one name. An entry replaced by a link
or a FIFO after a check can no longer block holders() or the wait in
acquire(). Lock files are opened with O_NONBLOCK: holders() treats a FIFO
lock file as a free slot, and try_acquire() returns a lock error for it.
2026-11-17 04:36:06 -08:00
dotCooCoo 80060307d8 Merge main into feat/craft-xtask-stats 2026-11-16 21:27:35 -08:00
Dylan M. TayloranddotCooCoo 453b0da782 Restore XLSB fixtures and Unix atomic-report test compilation (#1994)
* xtask: delegate Unix group restoration in report test filesystem

* craft-xlsx: xlsb tests unwrap the zip fixture's Result

#1386 made the test zip writer return Result<Vec<u8>, Error>. The xlsb
tests from #1263, #1323, #1330 and #1337 merged alongside it and still
used the return value as bytes, so `cargo check --workspace --tests`
failed on main with seven E0308 errors in crates/xlsx/tests/xlsb.rs.
These call sites now unwrap the result, as #1386 did for the others.

---------

Co-authored-by: dotCooCoo <RobertLeeLW@gmail.com>
2026-11-16 23:06:56 -05:00
dotCooCoo 7f9e77c63f Merge main into feat/craft-xtask-stats 2026-11-16 19:46:25 -08:00
.CooCoo 2c5f2e10b5 craft-xtask: add the asset attribution check against a document and folders the app supplies (#1424) 2026-11-16 21:34:47 -05:00
dotCooCoo 9062e2c069 craft-xtask: skip owner entries that are links, note terminal reads in run_cancelable
holders no longer follows a link planted under a slot's owner file in a
shared lock directory. On Unix the entry must be a regular file with one
name and the opened file must match it; on Windows the entry itself is
opened and must be a regular file.

The run_cancelable doc comment and the README say that on Unix a child
that reads from the terminal is stopped by SIGTTIN, since its process
group is not the foreground group, and that such commands go through run.
2026-11-14 21:07:55 -08:00
dotCooCoo 016dbd11c8 craft-xtask: end the child's tree when cancel is set while its exit is read
wait_cancelable now checks the cancel flag after reading the child's
status as well as before. A child that exits while cancel is being set
has its process group (Unix) or tree (Windows) ended, and the run counts
as canceled. The status is not read once the flag is set, so on Windows
the tree is ended while the child still runs.
2026-11-14 20:44:45 -08:00
dotCooCoo d77ddfffbf craft-xtask: end the child's tree when cancel is set before it exits
run_cancelable checked the child's status before the cancel flag. When
cancel was set during a poll and the child then exited, the run returned
the child's own result, and processes the child had started kept running.
The flag is now checked first, so the group or tree is ended and the run
counts as canceled.
2026-11-14 20:26:53 -08:00
dotCooCoo aeab39ca9f craft-xtask: close piped stdin in run_cancelable, ignore stderr write failures
run_cancelable closes a piped stdin after starting the child, as
Command::status does for run, so a child that reads stdin to the end can
exit. Diagnostics in runner.rs and lock.rs are written with a fallible
write, so a closed stderr no longer panics before a command starts.

The runner and lock changes of cf0f8cc7 on feat/craft-xtask-version.
2026-11-14 20:24:34 -08:00
dotCooCoo 1bba19db56 craft-xtask: build the stats tests on Windows without an unused mut warning
private_dir only calls DirBuilderExt::mode on Unix, so the Windows gate
rejected the mutable builder under -D warnings. The builder keeps its
allow for non-Unix targets, as crates/psd/tests/it/roundtrip.rs does.
2026-11-14 16:03:03 -08:00
dotCooCoo dc8f348102 craft-xtask: count Rust files, lines and tests per crate without following links
Adds the stats module behind a new stats feature, the library form of
the apps' cargo xtask stats. The app passes its cargo metadata JSON, a
function that builds its cargo command, and a writer.

Compared with the app copies, links and junctions are not followed,
every input has a size limit, only workspace members are walked, a
member nested in another member's folder is counted once, and
malformed or duplicate packages are errors. The exact-mode tests start
child processes and take spawn_guard like the runner and lock tests.
2026-11-14 14:43:35 -08:00
dotCooCoo da31f4949a craft-xtask: add the gate's step runner, slot lock and per-step report
A library for the apps' cargo xtask binaries. Each app keeps its xtask
binary, step list and policy, and calls the library.

- runner: run_steps runs the steps in order, stops at the first failure
  and prints the ok, FAIL and skip summary. root takes the caller's
  manifest directory and returns an error instead of panicking. The test
  commands from nextest_or_test and doctest pass --workspace --exclude
  <xtask package>, so a test build does not rebuild the running xtask
  executable (storytold/craft-common-actions#185). cargo test is the
  default; nextest is opt-in with a fallback. A Cancel flag stops the run,
  and run_cancelable ends the child's process group or tree.
- lock (feature): 1 to 64 slots held across processes with file locks in
  a caller-chosen directory. A slot count outside 1 to 64 is an error on
  try_acquire, acquire and holders before any file is opened. Owner files
  are read to at most 4096 bytes, holders lists only slots whose lock is
  held, and waiting can be canceled.
- report (feature): schema 1 JSON with step, command, status and
  duration_ms per step, written with craft-atomic so a failed write keeps
  the previous report. It is written while the run holds its slot; a run
  that does not take its slot writes no report.

From DesignCraft xtask/src/main.rs (8b169f8e) and LightCraft
xtask/src/ci_lock.rs and ci.rs (25ffe3e5); LightCraft's two lock tests
move in. DesignCraft and LightCraft are the planned consumers; no app
switches here.
2026-11-14 13:45:24 -08:00