Repository navigation
Conversation
The create path sent no connection sides, so Studio Pro drew every flow right -> left: @anchor, CASE outcome anchors and the builder's own sides were lost (11.15.0-rc.4: a CASE read back 1 -> 3 on all eight flows). A note failed the whole create, since mapObjectTree had no Annotation case. buildFlowDocContent now maps each sequence flow's indexes onto originConnectionSide/destinationConnectionSide (setPEDSides, shared with the splice). It also writes notes as Microflows$Annotation and their lines as Microflows$AnnotationFlow elements: origin/destination plus the required connection indexes, defaulting through the new AnnotationFlow.SidesOrDefault, which the modelsdk writer uses as well. The skeleton adapter keeps a note line's $Type and shifts its ends past the parameters. On the pre-11.14 constructor, whose flows are untyped, notes are refused rather than risk a note line read as a sequence flow. The splice sent a note line with the constructor's originId/destinationId keys, which PED refuses. It now uses the same mapping and adds note lines after its new sequence flows, because PED stores an AnnotationFlow after a SequenceFlow added later in the same update. Verified live against Studio Pro 11.15.0-rc.4: the same script gives identical sides on all 10 flows over --mcp and on the modelsdk engine, note lines included; with the fix reverted every flow read back 1 -> 3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every insert over --mcp failed on 11.15.0-rc.4 with `undefined is not an object (evaluating 'u.$Type')`. The splice sent the whole insert as one ped_update_document and addressed the elements it added in that same update by index. PED resolves a path against the document as it was before the update, so none of those sets reach a new element: a set below a new flow's line fails the whole update, and any other set (an activity's action, a flow's isErrorHandler) is accepted and lost. Separately, several index-less adds to one array are stored in reverse and $id() resolves against that final order, so an insert of more than one element was wired to the wrong objects. The insert is now two updates. The first adds the new elements (constructor properties only, each at the stored length as its index, wired with $id()) and moves the stored ones. The second fills in the new elements: actions, conditions, loop sources, isErrorHandler and control vectors (0;0 is the schema default and is not sent). A failed second update leaves the insert incomplete in Studio Pro, the same contract as CreateMicroflow's create-then-set; the error says so. Verified live on 11.15.0-rc.4: plain, IF/ELSE and note inserts match the default engine on every flow's ends, sides and control vectors and every object's position, and ped_check_errors is clean on two successive calls. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Stacked on #1534 (
fix/mcp-create-flow-sides-and-notes), which is itself stacked on #1528. This PR targetsmain, so until those two merge its diff also shows their commits. Merge them first: this PR's own change is the last commit.Problem
On Studio Pro 11.15.0-rc.4, every
alter microflow … { insert after … begin … end; }over--mcpfailed:It happened with or without a note; a plain one-activity insert reproduced it. Removing the failing set exposed two more problems that the crash had been hiding:
Cause (measured by direct
ped_update_documentprobes)The tool's own rule is that "every index you provide refers to the array as it exists BEFORE this call". The splice sent the whole insert as one update and addressed the elements it added in that same update by index.
/flows/N/line/originControlVectoru.$Type)/flows/N/line(whole curve)/flows/N/isErrorHandler/objectCollection/objects/N/actionor…/relativeMiddlePointline/isErrorHandler/actionin the constructor valueNodeUnableToConvertElement, String, System.Guid)Every one of these sets lands in a later update.
$id()references do resolve to elements added earlier in the same update.Separately, several adds to one array without an
indexare stored in reverse, and$id()resolves against that final order. Three objects came back as 3, 2, 1. A one-activity insert hides this, because it adds only one object and one flow. Adds given one sharedindex(the stored length) keep their listed order. That is PED's documented rule for adding several elements at a position. It also explains #1534's "an AnnotationFlow added before a SequenceFlow is stored after it".Fix
flowPatchOpsnow returns two operation lists, andSaveUnitsends them as two updates:index, wired with$id()), rewired flow ends, the stored elements moved to make room, and control vectors on flows that already existed.isErrorHandler, and the new flows' control vectors (0;0is the schema default and is not sent).The atomicity trade-off
The splice relied on a single update being all or nothing. That cannot be kept on 11.15: nothing in the update that adds an activity can give it its action. If update 2 fails, update 1 is not rolled back, and the insert is left in Studio Pro without its fill. This is the same contract as
CreateMicroflow, which creates and then sets activities. The error says so (the insert into X was added in Studio Pro, but setting up its new activities and flows failed …), andped_check_errorsnames what is missing. A retry cannot insert twice: the live/local index check refuses it.Considered and rejected: sending only the cosmetic control vectors second and refusing everything else. That fixes the crash but leaves every insert with "No action defined".
Verification
Unit tests (
mdl/backend/mcp/microflow_mutator_test.go):TestFlowPatchOps_NewElementsAreFilledInOnceTheyExist: the first update addresses nothing it adds; the second sets the action and the new flow's vectors, and nothing else.TestFlowPatchOps_AddsKeepTheirListedOrder: every add carries the stored length as its index.TestFlowPatchOps_NewErrorHandlerFlowIsMarkedOnceItExists:isErrorHandleris set in the fill, not with the add.TestNewFlowLineOps_LeavesOutDefaults:0;0vectors are not sent.Control: against the original save path, all four behavioural tests fail with the reported shape (one update,
/flows/3/line/…set beside the add), and the ordering test fails withindex <nil>.Live, Studio Pro 11.15.0-rc.4, through the MCP tunnel. Each base document was created once over
--mcpand once locally, then the same ALTER ran both ways and every flow was compared after resolving PED's$id(...)references to positions:true/falsecase values, the action and the condition;ped_check_errorswas clean on two successive calls for all three.Live control: the unfixed binary reproduced the
u.$Typefailure on the same plain insert, and left the live document unchanged (4 objects, 3 flows).make build,make test,make lintandmake check-mdlpass.Repro script:
mdl-examples/bug-tests/mcp-alter-insert-addresses-new-elements.mdl. Measurements are indocs/03-development/PED_MCP_CAPABILITIES.md(11.15 section, "what one update can address"); the finding is recorded under.claude/skills/fix-issue/findings/mdl-backend/.Not fixed here
domainmodel.go(entities/attributes),navigation.go(menu items),workflow.go. Not audited.microflow.go), on both create and ALTER. The refusal's premise ("PED has no error-handler flow") no longer holds on 11.15:isErrorHandleris settable in a later update. The splice already marks such a flow in its fill, but MDL cannot reach that path until the refusal is lifted and verified.0;0default. The local builder writes0;0for most flows as well, which is why they compare equal here.Test documents left in the open Studio Pro project (PED has no delete), all in
MyFirstModule:MCPA_XPlain,MCPA_XIf,MCPA_XNote,MCPA_WPlain;MCPA_VecProbe1,MCPA_OrderProbe;MCPA_SplicePlainandMCPA_VPlain(new activity without an action), andMCPA_WIf(mis-wired, unfilled);MCPA_VIf,MCPA_VErr,MCPA_WErr,MCPA_XErr.🤖 Generated with Claude Code