Skip to content

Add Checker::cancelable - #1395

Merged
clauderic merged 1 commit into
theme-check-threadsfrom
theme-check-cancelable
Nov 13, 2026
Merged

clauderic merged 1 commit into
theme-check-threadsfrom
theme-check-cancelable

Conversation

@clauderic

@clauderic clauderic commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

What are you adding in this PR?

checker.cancelable(&f).run(&fs, root), a run that stops once f returns true, with an error whose is_cancelled() is true. agent-server checks themes on request, and wants to stop a run whose result nobody needs anymore.

  • f is called before each file is read, parsed and checked, and before the theme graph is built. It's called from the thread doing that work, so it's Fn() -> bool + Sync.
  • A run that stopped early is cancelled even if f returns false again later.
  • Checker::run is self.cancelable(&|| false).run(fs, root).
  • Error was Error(String) with a private field, so it gains a cancelled flag without a breaking change.

Not covered: listing the theme's files, and downloading the docs and schemas when they aren't given.

Stacked for agent-server, to merge in order:

  1. Add Checker::ignore #1393 Checker::ignore
  2. Add Checker::threads #1394 Checker::threads
  3. Add Checker::cancelable #1395 Checker::cancelable (this PR)

Tophatting

  • The doc test on Checker::cancelable cancels before the first file.
  • a_run_cancelled_between_files_is_cancelled cancels after the first of two files is checked. It fails without the runner's check.
  • cargo test --workspace

Before you deploy

  • I included a patch bump changeset. theme-check-rs is 0.1.x, where an addition is a patch bump (0.1.0 → 0.1.1).
  • My feature is backward compatible

🤖 Generated with Claude Code

@clauderic
clauderic requested a review from a team as a code owner November 12, 2026 17:54
This was referenced Nov 12, 2026
@clauderic
clauderic added this pull request to stack #1396 November 12, 2026 19:27
@clauderic
clauderic force-pushed the theme-check-cancelable branch from 066fcbb to 854eeef Compare November 12, 2026 21:45
agent-server checks themes on request, and wants to stop a run whose result nobody needs any
more. `checker.cancelable(&f).run(&fs, root)` calls `f` before each file is read, parsed and
checked, and before the theme graph is built. Once it returns true, the run returns an error
whose `is_cancelled()` is true.

`Checker::run` is a run that's never cancelled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clauderic
clauderic force-pushed the theme-check-cancelable branch from 854eeef to 5c72606 Compare November 12, 2026 21:46
@clauderic
clauderic merged commit 2557514 into main Nov 13, 2026
9 checks passed
@clauderic
clauderic deleted the theme-check-cancelable branch November 13, 2026 19:26
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.

2 participants