Skip to content

feat(effects): engine jobs through the outbox - #609

Open
ccf-lisa[bot] wants to merge 1 commit into
effectors/14-effect-documentfrom
effectors/15a-effect-jobs
Open

ccf-lisa[bot] wants to merge 1 commit into
effectors/14-effect-documentfrom
effectors/15a-effect-jobs

Conversation

@ccf-lisa

@ccf-lisa ccf-lisa Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

What

The effect engine's jobs and how a transaction hands them over (API LLD, producer: "a new generation is never left without a durable delivery"):

  • Job arguments: effects.tick ({effect_id, at}) and effects.deliver ({effect_id, generation}, stable).
  • Outcome collects what one transaction decides. Persist writes the jobs to the domain event outbox (source engine) in that transaction (one tick per effect, the earliest, rounded up to the second so re-scheduled ticks deduplicate). Flush enqueues them after commit through a Scheduler and marks the rows processed; when enqueuing fails, the rows stay for the outbox dispatcher (feat(effectors): config and domain event outbox #603) and the caller only logs.

The state machine that fills an Outcome is the next PR.

Why

Plan: stack 2, PR 15 (state machine), split: this part is self-contained and reviewable on its own; the machine (15b) builds on it.

Test evidence

  • jobs_test.go: tick rounding (and UTC), one tick per effect (the earliest, first-seen order), Empty.
  • jobs_integration_test.go (Postgres): persisted rows and payloads, flush enqueues and marks processed, a failing scheduler (or none) leaves the rows, a rolled-back transaction writes nothing, an empty outcome.

Gate on this branch: go build ./... pass; go vet -tags integration ./... pass; make lint (golangci-lint v2.15.0, CI config) 0 new issues; make test pass; make swag no diff; go mod tidy no diff; go test -tags integration -p 1 on ./internal/service/effects/ pass.

Size

Counted: 364 lines.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: ea22b6a8-c53f-4679-8f4c-d3306bbd941a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

internal/service/effects: the effect engine's job arguments
(effects.tick at a time, effects.deliver of a generation) and Outcome,
which collects the jobs one transaction decides: Persist writes them to
the domain event outbox in that transaction (one tick per effect, the
earliest, rounded up to the second), Flush enqueues them after commit
through a Scheduler and marks the rows processed. When enqueuing fails
the rows stay for the outbox dispatcher, so no decided tick or delivery
is lost.

The state machine that fills an Outcome is the next PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@gusfcarvalho gusfcarvalho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ccf-review: APPROVE

no findings.

Stack (gh stack 604): #592 → #593 → #594 → #595 → #596 → #597 → #598 → #599 → #600 → #601 → #602 → #603 → #605 → #606 → #607 → #608 → #609 → #610 → #611 → #612 → #613 → #614 → #615 → #616 → #617 → #618 → #619 → #620 → #621 → #622 → #623 → #624 → #625 → #626 → #627 → #628 → #629 → #630

This branch has not been deployed

No deployments
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.

1 participant