Repository navigation
feat(effectors): config and domain event outbox - #603
Open
ccf-lisa[bot] wants to merge 1 commit into
Open
ccf-lisa[bot] wants to merge 1 commit into
ccf-lisa[bot] wants to merge 1 commit into
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
ccf-lisa
Bot
force-pushed
the
effectors/11-config-outbox
branch
2 times, most recently
from
December 1, 2026 16:45
0fd3b4b to
9541351
Compare
This was referenced Dec 1, 2026
This was referenced Dec 1, 2026
ccf-lisa
Bot
force-pushed
the
effectors/11-config-outbox
branch
from
December 1, 2026 18:49
9541351 to
d4426e0
Compare
internal/config: the CCF_EFFECTOR_* settings (signing keys, insecure webhooks, CEL cost limit, delivery timeout), bound in cmd so the environment reaches them (PoC follow-up 5), and listed in .env.example. internal/service/outbox: writes domain events in the producer's transaction and dispatches them (claim with SKIP LOCKED, one evaluation per subject, engine job rows, rows kept for the next dispatch, prune). EvidenceService and the workflow evidence integration can record a subject-changed event with every evidence write (WithDomainEvents); nothing enables it yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ccf-lisa
Bot
force-pushed
the
effectors/11-config-outbox
branch
from
December 2, 2026 12:07
d4426e0 to
09e9dc9
Compare
This was referenced Dec 2, 2026
gusfcarvalho
approved these changes
Dec 2, 2026
gusfcarvalho
left a comment
Contributor
There was a problem hiding this comment.
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 was referenced Dec 2, 2026
This was referenced Dec 2, 2026
This branch has not been deployed
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.
What
Config (API LLD, configuration):
internal/config/effector.goreadsCCF_EFFECTOR_SIGNING_KEYCCF_EFFECTOR_SIGNING_KEY_NEXTCCF_EFFECTOR_ALLOW_INSECURE_WEBHOOKSfalseCCF_EFFECTOR_CEL_COST_LIMIT100000CCF_EFFECTOR_DELIVERY_TIMEOUT10sinto
Config.Effector, withEnabled()andEffectorDomainEvents()(effectors on and the worker running). The variables are bound incmd/root.go(PoC follow-up 5 (follow-ups): unbound, they were silently ignored and effectors stayed off) and listed in.env.example.Outbox (API LLD, producer and dispatcher):
internal/service/outboxSubjectChanged/Writerecord a domain event in the producer's transaction;WriteJobrecords an engine job with its payload;MarkProcessedmarks rows whose jobs were enqueued directly.Dispatchclaims up to 500 unprocessed rowsFOR UPDATE SKIP LOCKED, folds them into one evaluation per (source, subject) (newest row id kept), passes engine job rows through, skips sources without enabled rules, and marks everything processed except the rows the enqueue callback asks to keep, all in the caller's transaction.Prunedeletes processed rows older than a cutoff (Retention= 24h).Producers:
evidence.WithDomainEvents()makesEvidenceService.Createwrite asubject-changedevent in the evidence's transaction;EvidenceIntegration.WithDomainEvents(true)does the same for workflow evidence, which now writes each evidence row and its labels in one transaction.Nothing turns the producers on or runs the dispatcher yet:
cmd/run.gois unchanged. That wiring lands with the River workers (stack 2), so no rows pile up before something consumes them.Why
Plan: stack 1, PR 11. Last PR of stack 1.
Test evidence
internal/service/outbox/outbox_integration_test.go(new; the PoC only tested dispatch through the worker): empty dispatch, folding per subject and newest id, sources without enabled rules, engine job payloads, kept rows, the limit, rollback on enqueue error,SKIP LOCKEDunder a concurrent dispatcher, rollback of a producer transaction,MarkProcessedandPrune. 85.9% coverage.domain_events_integration_test.go:Createwrites one row per evidence with the option, none without, none when the transaction rolls back.internal/workflow: workflow evidence writes the stream's event only when enabled.internal/config/effector_test.go(defaults, overrides, quotes, nil config) andcmd/root_test.go(the environment reaches the loader).Gate on this branch:
go build ./...pass;go vet -tags integration ./...pass;make lint0 new issues (6 pre-existing onmain, untouched files);make testpass;make swagno diff;go mod tidyno diff;go test -tags integration -p 1on./internal/service/outbox/ ./internal/service/relational/evidence/ ./internal/workflow/ ./cmd/ ./internal/config/pass.Size
Counted: 810 lines.
🤖 Generated with Claude Code