Skip to content

feat(history): lazily built metadata provider - #338

Merged
stakach merged 1 commit into
masterfrom
feat/history-metadata-provider
Oct 19, 2026
Merged

stakach merged 1 commit into
masterfrom
feat/history-metadata-provider

Conversation

@stakach

@stakach stakach commented Oct 19, 2026

Copy link
Copy Markdown
Member

Part of #336

History.with_metadata also accepts a History::MetadataProvider (Proc(Metadata)), which is only called when a change is recorded.

rest-api wraps each request in an around filter, and those run before authorize!. With a provider, the metadata can include the user once the request has been authenticated, and requests that don't change anything never build it.

The fiber metadata hash is now guarded by a mutex, so it is safe in multi-threaded builds.

Review

  • ./test: 858 examples, 0 failures.
  • New spec: the provider is not called for nested metadata or reads, is called once when a change is recorded, and sees state set after with_metadata began.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the type: enhancement new feature or request label Oct 19, 2026
@stakach
stakach merged commit 7a79808 into master Oct 19, 2026
8 checks passed
@stakach
stakach deleted the feat/history-metadata-provider branch October 19, 2026 22:47
@stakach stakach mentioned this pull request Oct 19, 2026
18 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement new feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant