feat: per-call-context Identity, Causation, and CorrelationId managers#13
Draft
Copilot wants to merge 2 commits into
Draft
feat: per-call-context Identity, Causation, and CorrelationId managers#13Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
…agers Agent-Logs-Url: https://github.com/Cratis/Chronicle.TypeScript/sessions/31eac120-e56a-4112-96c1-db8a68a12366 Co-authored-by: einari <134365+einari@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement CausedBy, Causation, and CorrelationId setup
feat: per-call-context Identity, Causation, and CorrelationId managers
May 11, 2026
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.
Mirrors the .NET client's auditing/identity infrastructure for the TypeScript client. Each of the three concerns uses Node.js
AsyncLocalStoragefor per-async-context scoping, with module-level singletons and exported interfaces for consumer override.New modules
Source/Identity/Identity— value type withsubject,name,userName,onBehalfOf; statics:system,notSet,unknownIIdentityProvider/IdentityProvider—getCurrent(),setCurrentIdentity(),clearCurrentIdentity(); defaults toIdentity.systemidentityProviderSource/Auditing/CausationType— named type with staticsroot,unknown,appendEvent,appendManyEventsCausation—occurred,type,properties; factoryCausation.unknown()ICausationManager/CausationManager—getCurrentChain()returns the full per-context chain (seeded withroot);add()appends;defineRoot()sets the process-level rootcausationManagerSource/Correlation/CorrelationId— value type;CorrelationId.create()generates a new GUID-backed idICorrelationIdAccessor(read) /ICorrelationIdSetter(write) — interface segregation matching .NET patternCorrelationIdManager— implements both;currentauto-generates if none set in contextcorrelationIdManagerEventSequencewiringappendandappendManynow pull identity, causation chain, and correlation ID from the singletons instead of hard-coded[System]/ empty values:All three singletons plus their interfaces and value types are re-exported from the package root.