Skip to content

feat: job worker#12

Draft
0xgleb wants to merge 2 commits into
graphite-base/12from
feat/job-worker
Draft

feat: job worker#12
0xgleb wants to merge 2 commits into
graphite-base/12from
feat/job-worker

Conversation

@0xgleb

@0xgleb 0xgleb commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Motivation

ADR-0001 lifts a supervised job-execution stack into event-sorcery. With the
Job trait in place (#11), the next layer is the worker side: the storage
handle, retry/backoff policy, the apalis handler, and the fault-injection
harness that end-to-end tests need.

Solution

  • JobBackend<J> — worker-side handle over apalis's Jobs table, built once at
    startup, yielding the apalis Storage<J> for worker registration.
  • work<J> apalis handler (production + test-support variants) that
    deserializes, logs, and runs perform against the injected Input.
  • Retry policy: ExponentialBackoff (1s base, doubling, 30s cap) +
    RETRY_BACKOFF; FAIL_STOP_RECOVERY_TIMEOUT keeps a tripped circuit breaker
    open until a human-supervised restart.
  • on_terminal_failure stops the worker and notifies the supervisor when
    retries exhaust; JobError models a failed or injected job.
  • FailureInjector (test-support) arms a Job::KIND so the next instance fails
    terminally and sticks to that Label across retries while others run.
  • build_poll_config tunes a 100ms poll interval with backoff for sub-second
    pickup.
  • Test: the injector targets the first armed instance and spares others.

Closes RAI-915.

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@0xgleb, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 59 minutes and 56 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 98398dae-299e-4fe9-9bb1-04997709787b

📥 Commits

Reviewing files that changed from the base of the PR and between fc40125 and 5516230.

📒 Files selected for processing (3)
  • crates/event-sorcery/Cargo.toml
  • crates/event-sorcery/src/job.rs
  • crates/event-sorcery/src/lib.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/job-worker

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

0xgleb commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label add-to-gt-merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@0xgleb 0xgleb mentioned this pull request Jun 5, 2026
@0xgleb 0xgleb force-pushed the feat/job-worker branch from 7effc0a to 0c9db78 Compare June 5, 2026 02:24
@0xgleb 0xgleb self-assigned this Jun 5, 2026
@0xgleb 0xgleb force-pushed the feat/job-worker branch from 0c9db78 to f768561 Compare June 5, 2026 03:04
@0xgleb 0xgleb force-pushed the feat/jobs-replace-services branch from 0c789dd to 5394dcd Compare June 5, 2026 03:04
@0xgleb 0xgleb force-pushed the feat/jobs-replace-services branch from 5394dcd to dd7e272 Compare June 8, 2026 22:58
@0xgleb 0xgleb force-pushed the feat/job-worker branch from f768561 to 9d7e5dd Compare June 8, 2026 22:58
@0xgleb 0xgleb force-pushed the feat/jobs-replace-services branch from dd7e272 to 53af639 Compare June 8, 2026 23:41
@0xgleb 0xgleb force-pushed the feat/job-worker branch 2 times, most recently from 507a496 to 39bfec0 Compare June 9, 2026 20:39
@0xgleb 0xgleb force-pushed the feat/jobs-replace-services branch from 53af639 to a40555c Compare June 9, 2026 20:39
@0xgleb 0xgleb mentioned this pull request Jun 9, 2026
@0xgleb 0xgleb force-pushed the feat/job-worker branch from 39bfec0 to fadd787 Compare June 9, 2026 21:22
@0xgleb 0xgleb marked this pull request as ready for review June 9, 2026 22:23
@0xgleb 0xgleb requested review from JuaniRios and findolor June 9, 2026 22:26
@0xgleb 0xgleb added the enhancement New feature or request label Jun 9, 2026 — with Graphite App
@0xgleb 0xgleb force-pushed the feat/job-worker branch from fadd787 to c151000 Compare June 9, 2026 23:24
@0xgleb 0xgleb force-pushed the feat/jobs-replace-services branch from 36417ae to 1ca936e Compare June 9, 2026 23:24
@0xgleb 0xgleb marked this pull request as draft June 9, 2026 23:35

@findolor findolor left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

@0xgleb 0xgleb force-pushed the feat/jobs-replace-services branch from f098223 to 712b2a1 Compare June 10, 2026 17:39
@0xgleb 0xgleb force-pushed the feat/job-worker branch from ad765a5 to 01e5055 Compare June 10, 2026 17:39
@graphite-app graphite-app Bot force-pushed the feat/jobs-replace-services branch from 712b2a1 to f011eab Compare June 10, 2026 19:17
@graphite-app graphite-app Bot force-pushed the feat/job-worker branch from 01e5055 to a0a4629 Compare June 10, 2026 19:18
@0xgleb 0xgleb force-pushed the feat/job-worker branch from a0a4629 to d947c89 Compare June 12, 2026 19:45
@0xgleb 0xgleb force-pushed the feat/jobs-replace-services branch 2 times, most recently from 38705c3 to da9be17 Compare June 12, 2026 21:16
@0xgleb 0xgleb force-pushed the feat/job-worker branch from d947c89 to 43fa41e Compare June 12, 2026 21:16
@0xgleb 0xgleb force-pushed the feat/jobs-replace-services branch from da9be17 to dedce5f Compare June 12, 2026 21:55
@0xgleb 0xgleb force-pushed the feat/job-worker branch from 43fa41e to 6427003 Compare June 12, 2026 21:55
@graphite-app graphite-app Bot force-pushed the feat/jobs-replace-services branch from dedce5f to f46d6f8 Compare June 15, 2026 19:27
@graphite-app graphite-app Bot force-pushed the feat/job-worker branch from 6427003 to 86b30e1 Compare June 15, 2026 19:27
@0xgleb 0xgleb force-pushed the feat/job-worker branch from 86b30e1 to e79cf6d Compare June 26, 2026 20:28
@0xgleb 0xgleb force-pushed the feat/jobs-replace-services branch from f46d6f8 to d201b3c Compare June 26, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants