fix(writer): drop synthetic trailing newline from EndEvent ReturnValue#317
Open
hjotha wants to merge 2 commits intomendixlabs:mainfrom
Open
fix(writer): drop synthetic trailing newline from EndEvent ReturnValue#317hjotha wants to merge 2 commits intomendixlabs:mainfrom
hjotha wants to merge 2 commits intomendixlabs:mainfrom
Conversation
Pristine Mx 9 EndEvents store the return expression in `ReturnValue` without a trailing line break. The mxcli writer was appending "\n" whenever `ReturnValue != ""`, which: 1. Diverged from Studio Pro's pristine on-disk shape, breaking byte-equality on roundtrip diffs. 2. Made Studio Pro reject some list-return EndEvents with CE0117 "Error in expression" — the Mx parser tolerated the trailing newline in scalar return expressions but not in list-return contexts. The append predates a clear understanding of which fields are pristine. Empirically the parser does not need the trailing newline either: mxcli's own MPR parser already accepted the value without it. Drop the conditional newline and pass `o.ReturnValue` through directly. Tests added in sdk/mpr/writer_microflow_version_test.go: - `TestSerializeEndEvent_EmptyReturnValueHasNoTrailingLineBreak` — pins the void-microflow case (`empty`). - `TestSerializeEndEvent_NonEmptyReturnValueHasNoSyntheticLineBreak` — pins the value-return case (`$Result`). Both go through `serializeMicroflowObject` and assert the on-disk ReturnValue matches the input exactly.
AI Code ReviewWhat Looks Good
RecommendationApprove the PR. The change is correct, well-tested, and resolves the specific issue without introducing side effects. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
Adds an MDL script under mdl-examples/bug-tests/ exercising both non-empty and empty EndEvent ReturnValue serialization. The describe → exec → describe fixpoint confirms no synthetic trailing newline drift in serialized BSON. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
AI Code ReviewCritical IssuesNone Moderate IssuesNone Minor IssuesNone What Looks Good
RecommendationApprove. The PR correctly resolves the bug with minimal, targeted changes, adequate test coverage, and proper validation. No further action needed. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
29 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.
Part of #332.
Fixes #316.
Summary
The microflow writer no longer appends a synthetic trailing newline to EndEvent return expressions.
Root cause
The writer added
"\n"wheneverReturnValuewas non-empty, even though pristine Studio Pro MPRs store the field without that newline and mxcli's parser does not need it.Fix
Pass
ReturnValuethrough directly when serializing EndEvent objects.Tests
Added writer tests for both empty and non-empty EndEvent return values.
Validation
make buildmake testmake lint-gomake test-integrationAgentic Code Testing
Test plan