Conversation
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.
Problem Statement
MutationContext.ActorTypeis currentlyinternal, making it impossible for external consumers (policies, governance components) to inspect whether a mutation was initiated by aUser,Service, orSystem. This forces consumers to rely on fragile conventions like checking string prefixes:Solution Overview
1. Expose
ActorTypeenum aspublicThe enum is used by
MutationContextand needs to be visible to consumers for type inspection.2. Change
MutationContext.ActorTypevisibilityConsumers can read the value, but only the framework can assign it.
3. Keep
System()factory signature unchangedMutationContext.System()does not setActorId— the system actor is identified by its type, not an ID.User()andService()continue to setActorIdas before.Design Decisions
Why exclude convenience booleans (`IsSystemActor`, etc.)?
MutationContextis a data holder, not a policy engine. Adding booleans blurs responsibility and creates maintenance debt — if new actor types match the same semantics (e.g.Administratorshould behave likeUser), the booleans become misleading. Policies should writecontext.ActorType is ActorType.Systemexplicitly.Why not add `systemId` parameter to `System()`?
ActorIdhas shared semantics — it identifies "who did it" regardless of actor type. System actors are identified byActorType == ActorType.System, not by an ID. If a specific system component needs attribution, consumers can pass it viaMetadata.Files Changed
ActorType.cs
internal enumtopublic enumMutationContext.cs
ActorTypeproperty changed frominternaltopublicwithinternal initMigration
Note
No breaking changes. Existing code that uses
MutationContextfactory methods (System,User,Service) is unaffected. All existing callers continue to work without modification.closes #84