Skip to content

feat(oplog): add the op log - #106

Open
PiquelChips wants to merge 1 commit into
feat/events-framesfrom
feat/events-oplog
Open

PiquelChips wants to merge 1 commit into
feat/events-framesfrom
feat/events-oplog

Conversation

@PiquelChips

Copy link
Copy Markdown
Member

A node had no record of what it did. There was no undo, no event stream for plugins, and nothing to list operations from. This adds the op log they're built on.

Every node keeps one in .origin/oplog/: size-capped segments of checked frames, one entry each. An entry's sequence number is one more than the entry before it, never changes and is never reused. Each entry names the workspace and the command it came from, which a store writes for as its Actor. The entries one command run appends form an operation, numbered by its first entry. The log keeps the latest 16 MiB of entries, and reading after an older cursor fails with StoreError::Expired.

A write appends its entries just before it's committed, and they're synced with it, at no extra sync. Target heads log that they advanced, and queues log the landings they leave waiting. Records written are logged once the index catches up from the op log, later in this stack. Readers read the latest entries backwards from the end of the last segment, so a poll that finds nothing new reads one frame.

A new segment is published whole: its header is written to a temporary file and renamed into place. A reader used to be able to find a segment empty, read that as damage, and panic on macOS CI. readers_never_find_a_segment_without_its_header failed 5/5 on the old code.

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: 54b38747-1bcd-41bf-baa4-d5aea5b08285
Commits

Reviewing files that changed from the base of the PR and between f33ffe6 and 82e1b5c.

Files selected for processing: 7

  • apps/origin-src/src/frames.rs
  • apps/origin-src/src/index.rs
  • apps/origin-src/src/lib.rs
  • apps/origin-src/src/oplog.rs
  • apps/origin-src/src/queue/session.rs
  • apps/origin-src/src/store/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-oplog branch 2 times, most recently from c172950 to 8537e1f Compare November 22, 2026 18:54
A node had no record of what it did: nothing to list operations from,
nothing to undo, and no stream of events for plugins to follow.

Every node now keeps an op log in `.origin/oplog/`: size-capped segments
of checked frames, an entry each. An entry has a sequence number, one
more than the entry before it, which never changes and is never reused,
and names the workspace and the command it came from, which a store
writes for as its `Actor`. The entries one command run appends form an
operation, numbered by its first entry. The log keeps the latest 16 MiB
of entries; reading after a cursor older than that fails with
`StoreError::Expired`.

A write logs its entries just before it's committed, and they're synced
with it, at no extra sync. Target heads now log that they advanced, and
queues log the landings they leave waiting. Records written are logged
next, once the index catches up from the op log.

Readers read the latest entries backwards from the end of the last
segment, so a poll that finds nothing new reads one frame.
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