Skip to content

Version and dispatch durable Fold events - #4

Merged
K-Mistele merged 3 commits into
mainfrom
fold-event-entry-version
Aug 15, 2026
Merged

Version and dispatch durable Fold events#4
K-Mistele merged 3 commits into
mainfrom
fold-event-entry-version

Conversation

@K-Mistele

@K-Mistele K-Mistele commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Write version on every durable Fold event from the central stored-entry factory.
  • Export the current and supported event-format versions for host capability negotiation.
  • Decode persisted events through a version-dispatching Fold boundary and return a typed error for unsupported future versions.
  • Preserve compatibility with historical entries that predate per-entry versioning by upcasting them to v1.
  • Route the JSONL backend through the same decoder that Postgres-backed hosts such as Riptide should call.

Runtime model

  • Hosts persist and transport the Fold event envelope without interpreting its version.
  • The installed Fold runtime selects a bundled historical decoder for each entry and upcasts it to the current in-memory LogEntry model.
  • Writers always emit CURRENT_LOG_ENTRY_VERSION; readers advertise SUPPORTED_LOG_ENTRY_VERSIONS.
  • A future v2 keeps LogEntryV1 frozen, adds LogEntryV2 plus an upcaster, and extends decodeStoredLogEntry.
  • Unknown versions fail with EventLogUnsupportedVersionError instead of being guessed or treated as transient storage failures.

Validation

  • bun run typecheck
  • bun run lint
  • bun run format:check
  • bun x vitest run test/EventLog/StoredLogEntryDecoder.vi.test.ts test/EventLog/EventLogMemory.vi.test.ts in packages/fold-core
  • bun x vitest run test/EventLog/EventLogJsonl.vi.test.ts test/Session/TitleGenerator.vi.test.ts in packages/fold-agent
  • bun x vitest run test/PromptRenderer.vi.test.ts test/Renderer.vi.test.ts test/TuiSubagents.vi.test.ts in packages/fold-cli

@K-Mistele K-Mistele changed the title Version every durable Fold event Version and dispatch durable Fold events Aug 15, 2026
@K-Mistele
K-Mistele marked this pull request as ready for review August 15, 2026 20:06
@K-Mistele
K-Mistele merged commit 4390764 into main Aug 15, 2026
9 checks passed
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