Skip to content

COMMIT writes 'Refresh in client = No' and 'With events = No' - defaults differ from Studio Pro and nothing flags it #895

Description

@Chendodelangen

Summary

COMMIT $Obj; writes a Commit activity with Refresh in client = No and With events = No. The second differs from what Studio Pro produces when a developer drags the same activity in, and the first produced a defect that survived every automated gate we have.

Environment

  • mxcli v0.17.0, windows/amd64
  • Studio Pro 11.12.2, MPR v2

1. Refresh in client

An entire connector module (77 microflows, 24 commit activities) was written from MDL and shipped without a single client refresh. Symptom at runtime: a user presses "Synchronize", the microflow runs, ~1800 records land in the database, and the page keeps showing the old data until a manual reload.

What did not catch it:

  • mxcli check — green
  • mxcli lint — 0 errors
  • Studio Pro's own consistency check (ped_check_errors) — "No errors found" over 91 documents
  • mxbuild --write-errors — BUILD SUCCEEDED

Only a person using the app found it. COMMIT $Obj REFRESH; exists and works (thanks to #407), so this is not a missing feature — it is a default that is invisible until runtime.

Suggestion: a lint rule would fit well here, e.g. "commit without refresh in a microflow that is reachable from a page action". That is exactly the kind of thing a reviewer cannot see in a diff either.

2. With events

Studio Pro's Commit activity defaults to committing with events; COMMIT $Obj; in MDL writes with events = No. The asymmetry is invisible in DESCRIBE output (both render as commit $Obj;) until you compare a hand-made and a scripted commit side by side:

-- written by mxcli
commit $SyncState;

-- same activity after ticking Refresh in client by hand in Studio Pro
commit $ChangedPartList with events refresh;

In a module built half by script and half by hand you therefore end up with both variants. Harmless while no entity has commit event handlers — and silently skipping business logic the moment someone adds a before-commit handler to one of those entities.

Suggestion: make WITH EVENTS the default for COMMIT (matching Studio Pro), or document the difference prominently in mxcli syntax microflow.object-operations, which currently presents COMMIT $Obj; and COMMIT $Obj WITH EVENTS; as neutral alternatives.

Reproduction

CREATE OR MODIFY MICROFLOW MyModule.ZZ_Probe ($Obj: MyModule.Entity)
BEGIN
  COMMIT $Obj;
END;
/

mxcli describe microflow MyModule.ZZ_Probe renders commit $Obj;; opening the activity in Studio Pro shows Refresh in client = No and With events = No.

Context: found while building a complete Odoo connector end to end with mxcli.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions