feat(act): configurable correlation id generator (ACT-404)#726
Merged
Conversation
Replaces the hardcoded `randomUUID()` correlation source with a
delegate on `ActOptions.correlator` and a readable, time-monotonic
default of the form `{state[:4]}-{action[:4]}-{4 ms}{4 random}` (18
chars, lowercase base36, e.g. `coun-incr-lwxk9p3a`).
Why:
- UUIDv4 is unreadable in logs and scatters across the correlation
index — page splits and poor cache locality on PG.
- The default keeps competing-consumer workers from colliding (1.68M
random values per ms) without coordination, while still time-ordering
inserts inside ~28-minute windows for index page-fill behavior.
- Apps that want tenant prefixes, trace-id propagation, idempotency-key
bridging, DB-issued monotonic ids, or ULID/UUIDv7 plug their own
delegate via `act()...build({ correlator })`.
Threaded through `event-sourcing.action()` (originating commits) and
`runCloseCycle` (close transactions, with a synthetic `$close` context).
Reactions still inherit `reactingTo.meta.correlation` — the chain is
untouched. Wolfdesk demonstrates a tenant-prefixed correlator.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
🎉 This PR is included in version @rotorsoft/act-v0.42.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
2 tasks
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.
Summary
Closes #725.
Replaces
randomUUID()for correlation ids with a configurable delegate plus a readable, time-monotonic default of the form{state[:4]}-{action[:4]}-{4 ms}{4 random}(18 chars, lowercase base36).Why
What changed
Test plan
Docs
🤖 Generated with Claude Code