Repository navigation
feat(cli): squirrel audit --urls-file batch mode #1231 - #2058
Merged
Merged
Conversation
nc9
force-pushed
the
boat/batch-audit-1231
branch
from
November 16, 2026 12:00
96f786f to
7572f13
Compare
nc9
force-pushed
the
boat/batch-audit-1231
branch
from
November 16, 2026 19:41
3f87803 to
fe9fb26
Compare
4 tasks done
nc9
force-pushed
the
boat/batch-audit-1231
branch
2 times, most recently
from
November 17, 2026 13:42
722d8b6 to
8a60316
Compare
nc9
marked this pull request as ready for review
November 17, 2026 19:18
nc9
force-pushed
the
boat/batch-audit-1231
branch
3 times, most recently
from
November 18, 2026 01:10
8b5e1c4 to
52ef57f
Compare
…sume and per-URL records #1231 Signed-off-by: Nik Cubrilovic <[email protected]>
…mode #1231 Signed-off-by: Nik Cubrilovic <[email protected]>
…#1231 Signed-off-by: Nik Cubrilovic <[email protected]>
Signed-off-by: Nik Cubrilovic <[email protected]>
Clears CodeQL js/file-system-race on the batch lock. A fresh lock is created with O_EXCL. A stale lock is taken over only by whoever first creates (O_EXCL) a claim file named after the stale lock's content; under the claim the lock is re-read through one descriptor and must still hold the same stale bytes, then an O_EXCL temp file is renamed over it and the lock is confirmed by our pid and nonce. Release deletes the lock only while it still holds our nonce. Signed-off-by: Nik Cubrilovic <[email protected]>
…second signal #1231 planBatch reruns a crashed/interrupted URL as the next attempt, like skipped-budget, so the re-run that the Ctrl-C message asks for does it. The second SIGINT/SIGTERM no longer exits with children running and running lines left behind: it kills the children so each gets its interrupted record and the lock is released; a third exits. SIGHUP is handled like SIGINT, and a child that died of SIGINT is recorded interrupted. Signed-off-by: Nik Cubrilovic <[email protected]>
Signed-off-by: Nik Cubrilovic <[email protected]>
Children got the user's raw offline tokens (--offline=false, --offline false, --no-offline). The orchestrator now drops every raw offline form and passes --offline only when the parent resolved it true. The guard tests now also cover repeated flags (citty parses them as an array, which is refused) and check that no child is spawned. Signed-off-by: Nik Cubrilovic <[email protected]>
Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
force-pushed
the
boat/batch-audit-1231
branch
from
November 18, 2026 04:43
52ef57f to
0b0c147
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Batch mode for
squirrel audit(PR A of the #1231 spec):squirrel audit --urls-file urls.txt --out-dir reports/ [--concurrency N] [--retry-failed] [--restart] [--url-timeout S] [--max-urls N] [--allow-private-hosts].Closes #1231 for the local-audit scope. Signed-in batches (credit estimate,
--yes,--max-credits, ephemeral default) and the retention notices are the spec's PR B and are NOT in this PR: a signed-in batch is refused with a message unless--offline.Design: each URL runs as a child
squirrel audit(same binary). The child writes a small hidden--batch-recordfile (audit status, reason code, score, pages, final URL) from the one exit point of the audit; the orchestrator adds exit code, signal and timings and is the only writer ofresults.jsonl. A child that dies with no record iscrashed.--concurrencywith--urls-fileis the batch pool, not the crawl worker pool (documented).Acceptance criteria
executeBatch > audits every URL...; real run: 4 local sites + 1 dead port, 5 report files and results.jsonla re-run does not redo completed URLs...,interrupting the batch then re-running...a failing URL is recorded...(exit 6), unreachable exit 5 in the real run--concurrencyrespected:never more than --concurrency children...; real run at--concurrency 4completed without lock errors. The 10-concurrent-audit storage criterion rests on Concurrent squirrel audit processes fail with 'SQLite database is busy (locked)' #1226 (closed); I ran 4, not 10, against real childrendocs/cli/audit.mdx(flags, results schema, exit code 6, retention recipe),completion.tsbash/zsh/fish,make validatepassesa child killed by a signal with no record is crashed; timeout:a child past --url-timeout...exit 2 only when --fail-on tripped...partial counts as success; rejected lines...,private hosts are rejected unless allowed, hashed report namestwo URLs of one project never overlap), lock file (a live lock...), SIGINT/SIGTERM forwarding with exit 130 (interrupting...via the stop signal; no real-signal test)--offline)-o,--resume,--project-name,--summaryrejected: checked by hand for-oand URL plus--urls-file; no automated test for the other threeGates (apps/cli)
format:check,lint,typecheckclean.bun testbatch/run, batch/manifest, batch/urls-file, self/completion: 191 pass; audit-options and three audit wiring tests: 70 pass.make validatein docs/: pass.Agent skill: needs a short batch section (private
skillsissue to file).CodeQL js/file-system-race fix (head fe9fb26)
The batch lock no longer decides anything on a path that can change between check and use:
openSync+fstatSync+readFileSync(fd)). Live or other-host holder: refused with the existing message..batch.lock.takeover-<sha256 of the stale bytes>. Under the claim it re-reads the lock (must still be the same stale bytes), writes the new lock to an O_EXCL temp${path}.${pid}.${random},renameSyncs it over the lock atomically, then re-reads and confirms our pid + nonce before proceeding.Why the claim file: rename-then-confirm alone does not exclude racers. In the new race test (8 child processes on one stale lock) all of them won without it, because each renamed and confirmed before the next renamed. With the claim, exactly one wins.
Tests:
apps/cli/tests/batch/lock.test.ts(fresh acquire, refusal while held, other-host lock, unreadable lock, stale takeover with no temp debris, claimed takeover refused, release leaves someone else's lock, 8 racers exactly one wins).Residual: a process killed between creating the claim and removing it leaves the claim, and later runs refuse with a message naming the file to delete.