fix: emit loop captions during microflow describe#444
Conversation
Symptom: describe emitted @caption for action activities and split activities, but captions stored on LoopedActivity objects were omitted. Root cause: emitObjectAnnotations did not handle LoopedActivity.Caption even though the builder already preserves captions for loop and while statements. Fix: emit a quoted @caption annotation for LoopedActivity before attached @annotation lines, matching the existing ExclusiveSplit and InheritanceSplit handling. Tests: added a focused emitObjectAnnotations regression covering loop captions with apostrophe and newline escaping; ran make build, targeted executor tests, make test, and make lint-go.
ako
left a comment
There was a problem hiding this comment.
PR #444 Review — fix: emit loop captions during microflow describe
Clean, focused fix. Three lines of production code that mirror the adjacent ExclusiveSplit and InheritanceSplit handlers exactly. The write side (applyAnnotations in cmd_microflows_builder_annotations.go) already set Caption on LoopedActivity — this completes the roundtrip by emitting it on the describe side.
The unit test is good: covers apostrophe doubling and newline escaping through mdlQuote, which are the two failure modes that matter.
Minor
No doctype-level example for @caption on a loop
02-microflow-examples.mdl has @caption examples on activities and splits but nothing on a loop or while-loop statement. TestMxCheck_DoctypeScripts would never have caught this regression. Worth adding one microflow in that file with a loop that carries @caption, e.g.:
@caption 'Process each item'
loop $Item in $Items
log info $Item/Name;
end loop;
This doubles as living documentation that @caption is valid on loop statements.
Otherwise looks good to merge.
PR #444 Review — fix: emit loop captions during microflow describeClean, focused fix. Three lines of production code that mirror the adjacent The unit test is good: covers apostrophe doubling and newline escaping through MinorNo doctype-level example for
This doubles as living documentation that Otherwise looks good to merge. |
Closes #443.
Summary
@captionformicroflows.LoopedActivityduring microflow describe.mdlQuotepath as other activity captions.Validation
make buildgo test ./mdl/executor -run 'TestEmitObjectAnnotations_LoopCaption|TestLoopCaptionPreserved|TestWhileLoopCaptionPreserved' -vmake testmake lint-go