Skip to content

feat(events): derive events from the op log - #112

Open
PiquelChips wants to merge 1 commit into
feat/events-undofrom
feat/events-stream
Open

PiquelChips wants to merge 1 commit into
feat/events-undofrom
feat/events-stream

Conversation

@PiquelChips

Copy link
Copy Markdown
Member

Plugins and agents had no way to react to what happens on a node, such as a CI worker waiting for landings that need its checks.

Events are derived from the op log when they're read: from its entries, the records they name, and the queues' waiting landings. Nothing is stored twice. There are four kinds: statement.issued, revision.created, target.advanced and check.requested, one for each statement a waiting landing lacks. An event's cursor is the sequence number of the entry it comes from, which never changes across restarts or index rebuilds.

Events are delivered at least once and in the op log's order, never past an entry whose write is in progress. Consumers deduplicate by the whole event kind, so check requests for different requirements or targets stay distinct. Events::after reads a page after a cursor, filtered by kind and by subject. A kind is an event name or a statement kind pattern. A subject is a record, a change or a target, and a revision's creation also matches its revision id. Events::wait polls until something arrives.

Benchmarks: an empty event poll costs 12.5 µs, and reading 10k entries takes 65 ms.

Note

Written by Claude Opus 5.5 in Claude Code (via T3 Code)

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 34 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0ecde6ad-cfc4-4757-8068-59f5b7c4ac3f
Commits

Reviewing files that changed from the base of the PR and between 38a9b30 and f2860eb.

Files selected for processing: 9

  • AGENTS.md
  • apps/origin-src/benches/store.rs
  • apps/origin-src/src/events.rs
  • apps/origin-src/src/lib.rs
  • apps/origin-src/src/oplog.rs
  • apps/origin-src/src/policy.rs
  • apps/origin-src/src/queue/mod.rs
  • apps/origin-src/src/queue/tests/mod.rs
  • apps/origin-src/src/targets.rs
  • 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

@PiquelChips
PiquelChips added this pull request to stack #165 November 22, 2026 14:59
@PiquelChips
PiquelChips force-pushed the feat/events-stream branch 2 times, most recently from 1428182 to f413c6d Compare November 22, 2026 18:54
Plugins and agents had no way to react to what happens on a node, such as
a CI worker waiting for landings that need its checks.

`Events` reads events derived from the op log, the records its entries
name and the queues' waiting landings, so nothing is stored twice:
`statement.issued`, `revision.created`, `target.advanced`, and
`check.requested` for each statement a waiting landing lacks. An event's
cursor is the sequence number of the entry it comes from, which never
changes, across restarts and index rebuilds alike. Events are delivered
at least once and in the op log's order, never past an entry whose write
is in progress; consumers deduplicate by the whole event kind, so check
requests for different requirements or targets stay distinct.

`Events::after` reads a page after a cursor, filtered by kind (an event
name or a statement kind pattern) and subject (a record, a change or a
target), and `Events::wait` polls until something arrives.

New benchmarks: reading the events of 10k entries, and polling when
there are none.
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