Skip to content

docs(rfc): rewrite the Layer 1 RFC after review [DMD-1900] - #709

Merged
martinsifra merged 1 commit into
ms/dmd-1899/cli-layer-2from
ms/dmd-1900/cli-layer-1
Aug 31, 2026
Merged

martinsifra merged 1 commit into
ms/dmd-1899/cli-layer-2from
ms/dmd-1900/cli-layer-1

Conversation

@martinsifra

@martinsifra martinsifra commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Rewrite of docs/merge-requests-layer1.md after two review passes and a design session (merged 2026-08-31 into the Layer 2 branch). The implementation of the RFC is a separate PR: see the open PR on ms/dmd-1900/cli-layer-1.

🤖 Generated with Claude Code

Two review passes (Opus + Sonnet) and a design discussion reshaped the
document. The command surface is unchanged; what changed is what may
happen without a human saying so, plus a batch of factual corrections.

Design decisions:

- Auto-merge is a destructive act, and classifying only `merge` as such
  was theatre. A background scheduler runs every approved MR armed with
  autoMergeStrategy through the SAME MergeProcessor under a system token
  (AutoMergeCandidateRepository.php:44-47, AutoMergeTickHandler.php:86),
  polling rather than hooking approve, retrying indefinitely. So
  create/update escalate to destructive when they arm it, and
  request-review/approve/resolve escalate on an already-armed MR.
  Confirmation sits where a human CHOOSES an irreversible outcome
  (merge, arming); escalation sits wherever one is CAUSED. `none` never
  escalates -- it is the disarm, and escalating it would let
  --deny-destructive lock the hazard in place.
- One rule replaces a per-command table: when an invocation resolves to
  `destructive`, --json requires an explicit target. Derived from the
  house rule that implicit branch resolution selects the SCOPE while the
  target is always named (storage delete-table takes the active branch
  but requires --table-id; branch delete requires --branch because there
  the branch IS the target). A bare `--json merge` would satisfy neither
  of the repo's two destructive shapes -- it neither prompts nor names.
  Inverting --yes under --json was considered and rejected: zero
  precedent across 48 commands carrying the flag.
- Flag is `--merge-request-id` (short alias `--id`), not `--mr-id`: a
  bare noun is the context you work IN (--project 206x, --branch 94x),
  `--<noun>-id` is the object you act ON (20 flags, ~170 uses).
- Every serve route declares require_permission, or the classification
  above is decorative over HTTP (only auth.py does today).

Corrections:

- The module split is justified qualitatively; output.py is at 679 CODE
  lines of 1000, not the 1013 raw lines previously cited (CONTRIBUTING
  measures code lines -- the exact mistake it warns about).
- The wire field list is deleted, not fixed: the notes doc is the
  authority. The previous list was wrong three ways (createdAt exists,
  mergerName is nested in merge{}, autoMerge* are response fields too).
- diff/allowed_actions claims are now true rather than aspirational --
  Layer 2 applied the findings (get_config_diff derives the branch from
  the MR; _enrich_row carries allowed_actions everywhere).
- Rich markup escaping, --state/--take pre-validation to exit 2, plain
  ConfigError -> exit 5, the mandatory CLI-layer test file, the serve
  wiring steps and route-order hazard, `resolve --take delete
  --change-description` being silently dropped, `update` with no fields
  being a no-op, and the branch-merge deprecation also resetting
  active_branch_id.

E2E remains explicitly unsettled.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@linear-code

linear-code Bot commented Aug 27, 2026

Copy link
Copy Markdown

DMD-1900

@martinsifra
martinsifra merged commit 980b28d into ms/dmd-1899/cli-layer-2 Aug 31, 2026
@martinsifra
martinsifra deleted the ms/dmd-1900/cli-layer-1 branch August 31, 2026 22:07
@martinsifra martinsifra changed the title docs(rfc): rewrite the Layer 1 RFC after review [DMD-1900] feat(cli): merge-request command group -- Layer 1 over MergeRequestService (DMD-1900) Sep 3, 2026
@martinsifra martinsifra changed the title feat(cli): merge-request command group -- Layer 1 over MergeRequestService (DMD-1900) docs(rfc): rewrite the Layer 1 RFC after review [DMD-1900] Sep 3, 2026
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.

1 participant