Skip to content

feat: job worker#12

Open
0xgleb wants to merge 2 commits into
feat/jobs-replace-servicesfrom
feat/job-worker
Open

feat: job worker#12
0xgleb wants to merge 2 commits into
feat/jobs-replace-servicesfrom
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 18 minutes and 37 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ 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.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

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: 0867ce89-ce04-4016-9976-246433b80c6d

📥 Commits

Reviewing files that changed from the base of the PR and between dedce5f and 6427003.

📒 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 and usage tips.

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
@0xgleb 0xgleb force-pushed the feat/job-worker branch from c151000 to 20e9663 Compare June 9, 2026 23:55
@0xgleb 0xgleb force-pushed the feat/jobs-replace-services branch from c1bf38c to c362373 Compare June 10, 2026 01:18
@0xgleb 0xgleb force-pushed the feat/job-worker branch from 20e9663 to cc7e258 Compare June 10, 2026 01:18
@0xgleb 0xgleb marked this pull request as ready for review June 10, 2026 01:42
@0xgleb 0xgleb requested review from JuaniRios and findolor June 10, 2026 02:08
@0xgleb 0xgleb force-pushed the feat/jobs-replace-services branch from c362373 to a0063c9 Compare June 10, 2026 02:50
@0xgleb 0xgleb force-pushed the feat/job-worker branch 2 times, most recently from 6b0d7fe to c7c1f85 Compare June 10, 2026 03:05
@0xgleb 0xgleb force-pushed the feat/jobs-replace-services branch from a0063c9 to f098223 Compare June 10, 2026 03:05
@0xgleb 0xgleb force-pushed the feat/job-worker branch 2 times, most recently from c6e93a6 to ad765a5 Compare June 10, 2026 03:39
@linear-code

linear-code Bot commented Jun 10, 2026

Copy link
Copy Markdown

RAI-915

@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
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