Skip to content

docs(proposal): MDL change plans — review agent-proposed scripts, apply them safely - #2819

Merged
ako merged 1 commit into
mainfrom
proposal/mdl-change-plans
Dec 4, 2026
Merged

ako merged 1 commit into
mainfrom
proposal/mdl-change-plans

Conversation

@ako

@ako ako commented Dec 4, 2026

Copy link
Copy Markdown
Owner

Adds docs/11-proposals/PROPOSAL_mdl_change_plans.md, a design for reviewing MDL scripts that several agents propose and applying them to a project safely. It is the detailed design for Option A / Phase 3 of PROPOSAL_multi_agent_merge.md, which named this workflow and the tooling it needs but did not design them.

This PR adds the proposal only, with no code.

The design in short

  • mxcli plan runs a script on a scratch copy, as mxcli diff does. It writes a versioned plan file holding the script text itself and its observed effect: per document, a canonical before and after hash plus the MDL rendering a reviewer reads. A domain model is split per entity and per association.
  • mxcli apply re-runs the reviewed script on the current project inside the journal. It lands the script only if the effect equals the reviewed one. If a document the script touches changed since review, or the script now touches a document nobody reviewed, the plan is stale: exit 4, nothing written. Several plans apply all or nothing.
  • plan check answers the same question beforehand, against a scratch copy, writing nothing. plan diff shows a re-planned script's delta against the reviewed plan.
  • Conflict detection uses real effects, not a model of MDL statements, which is the approach upstream feat(plan): add mxcli plan to predict conflicts between several MDL scripts mendixlabs/mxcli#2019 took. This follows Terraform (stale saved plans), Kubernetes (resourceVersion, field ownership) and migration tools (checksums, preconditions), which are compared in the proposal.

Prerequisites (separate PRs; each also fixes exec today)

  • P1: the journal covers generated .java/.js files. Today a rolled-back exec leaves them behind, and both writers go through WriteSourceIfChanged.
  • P2: a durable journal under .mxcli/journal/, recovered when the write lock is taken. Today a killed run leaves half a script written.
  • P3: document-level canonical hashing, built on canon's canonical form.

Test plan (in the proposal)

Every case names its control:

  • apply-rule cases: lost update, same unit with different documents, effect grew, already applied, tampered script, changed input, indirect change, Mendix version;
  • all-or-nothing and recovery: a rollback that includes generated files, a killed process, hash drift, MPR v1;
  • concurrency: two apply processes, 20 iterations each;
  • output: golden files and the schema;
  • Mendix acceptance: mx check on the results, under -tags integration;
  • one agentic scenario.

Fixtures are built in the test, so nothing can silently skip in CI.

Relation to the upstream PRs reviewed

Open questions

Listed in the proposal:

  1. the plan name, which upstream fix(catalog): reference the mappings a flow applies and a mapping's JSON structure (#1861) #2019 also uses;
  2. coarse documents: module and project security, navigation;
  3. whether plans should also expire;
  4. where plan files live;
  5. automatic re-planning without a new review.

Generated by Claude Code

…ly them safely

Designs PROPOSAL_multi_agent_merge Option A / Phase 3: mxcli plan records a
script's observed effect (per-document canonical before/after hashes plus
the MDL rendering); mxcli apply re-runs the reviewed script and lands it only
if the effect is unchanged, several plans all or nothing. Prerequisites: the
journal covers generated source files and survives a crash; document-level
canonical hashing. Includes a test plan with a control per case. Informed by
the review of upstream mendixlabs#2015/#2019/#2020/#2035 and Terraform,
Kubernetes and migration tools.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QiMsnXa9crge2qnSk9S7Zn
@ako
ako merged commit 2cdf970 into main Dec 4, 2026
18 checks passed
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.

2 participants