Skip to content

fix: preserve microflow-call BSON field order#342

Open
hjotha wants to merge 1 commit intomendixlabs:mainfrom
hjotha:submit/writer-microflow-call-field-order
Open

fix: preserve microflow-call BSON field order#342
hjotha wants to merge 1 commit intomendixlabs:mainfrom
hjotha:submit/writer-microflow-call-field-order

Conversation

@hjotha
Copy link
Copy Markdown
Contributor

@hjotha hjotha commented Apr 27, 2026

Summary

  • writes MicroflowCallAction with nested MicroflowCall before result-variable fields
  • writes nested MicroflowCall.ParameterMappings before QueueSettings
  • writes each parameter mapping as Argument then Parameter
  • adds a BSON-level writer regression test using generic names

Why

A microflow call can roundtrip MDL text unchanged but still become invalid in Studio Pro validation if the BSON shape differs from Studio Pro's expected field order. The observed failure is CE0117 on the call activity.

Validation

  • make build
  • make lint-go
  • make test

Closes #341.
Related to #332.

Symptom: rebuilding a microflow call with parameter mappings could produce an MPR that Studio Pro reported as CE0117 expression errors on the call activity even though the textual MDL roundtripped unchanged.

Root cause: the writer emitted MicroflowCallAction and nested MicroflowCall fields in an order that differs from the shape Studio Pro writes for this model version. The parameter mapping also placed Parameter before Argument.

Fix: emit the nested MicroflowCall before result-variable fields, place ParameterMappings before QueueSettings, and write each MicroflowCallParameterMapping as Argument then Parameter.

Tests: add a BSON-level writer regression test with generic microflow names that asserts the stable field order for the action, nested call, and parameter mapping.
@github-actions
Copy link
Copy Markdown

AI Code Review

Critical Issues

None

Moderate Issues

None

Minor Issues

None

What Looks Good

  • The PR correctly addresses a BSON field order issue that causes Studio Pro validation errors (CE0117) by ensuring the serialization order matches Studio Pro's expectations.
  • The test is well-written and verifies the exact field order for MicroflowCallAction, its nested MicroflowCall, and ParameterMappings.
  • The fix follows the established pattern in the codebase for BSON serialization (using bson.D with explicit field order).
  • The change is minimal and focused - only reordering fields in the serializer without changing functionality.
  • The PR includes proper validation steps (make build, make lint-go, make test) and references the related issue.
  • The test uses generic names as mentioned, making it a good regression test.

Recommendation

Approve. The PR correctly fixes a BSON serialization order bug with appropriate test coverage and follows the project's patterns. No changes are needed.


Automated review via OpenRouter (Nemotron Super 120B) — workflow source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Microflow call parameter mappings can be written with invalid BSON field order

2 participants