Align plugin Target with Dataverse for system-managed fields#344
Merged
Conversation
System fields were leaked into the plugin Target during pre-stages: ownerid was injected before PreValidation, and created/modified timestamps before PreOperation. Dataverse resolves these during the main operation, exposing them only via the post-image and the post-operation Target. - Core: stop injecting ownerid in HandleInternalPreOperations (keep id); extend CopySystemAttributes to reflect ownerid/ownership/statecode/ statuscode onto the post-operation Target (add OptionSetValue support). - CreateRequestHandler: move created/modified stamping from the pre-stage into the main operation on the persisted clone; resolve the effective owner on a local clone for the access checks only. - UpdateRequestHandler: drop the pre-stage modified stamping (Utility.Touch already sets the persisted values). - Tests: add ContactSystemFieldsProbePlugin and assertions that system fields are absent from the pre-stage Target, a caller-set ownerid stays visible, and the fields are present in the post-image and post-Target. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aligns XrmMockup365 plugin Target contents with Dataverse behavior for system-managed fields across the pipeline, ensuring those fields are not visible in pre-stages and only surface via post-image / post-operation Target.
Changes:
- Prevents
ownerid/ created/modified system fields from being injected into pre-stageTarget, and instead stamps/publishes them during the main operation + post-operation target copy. - Extends post-operation
Targetsystem-attribute copy to include ownership + state/status fields (includingOptionSetValuecloning). - Adds a diagnostic plugin and new tests asserting absence/presence of system fields at the correct pipeline stages.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/XrmMockup365Test/TestPlugins.cs | Adds create-pipeline assertions for system-field visibility across stages. |
| tests/TestPluginAssembly365/Plugins/ContactSystemFieldsProbePlugin.cs | Introduces a probe plugin to record which system fields are present in Target/post-image at each stage. |
| src/XrmMockup365/Requests/UpdateRequestHandler.cs | Removes pre-stage modified stamping so modified fields don’t leak into pre-stage Target. |
| src/XrmMockup365/Requests/CreateRequestHandler.cs | Moves created/modified stamping to the main create operation and resolves effective owner for security checks only. |
| src/XrmMockup365/Core.cs | Expands system attribute list, copies additional system fields onto post-operation Target, and stops defaulting ownerid in internal pre-ops. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
System fields were leaked into the plugin Target during pre-stages: ownerid was injected before PreValidation, and created/modified timestamps before PreOperation. Dataverse resolves these during the main operation, exposing them only via the post-image and the post-operation Target.