Skip to content

Refactor canonical edit intent ownership - #10

Merged
isty2e merged 4 commits into
mainfrom
refactor/canonical-edit-foundation
Jul 28, 2026
Merged

Refactor canonical edit intent ownership#10
isty2e merged 4 commits into
mainfrom
refactor/canonical-edit-foundation

Conversation

@isty2e

@isty2e isty2e commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • require whole-file move changesets to carry canonical preview.move.{from,to} data
  • reorganize apply/edit integration suites by behavior ownership without dropping discovered tests
  • normalize edit and patch flag mode through one private edit-intent model while preserving their distinct lifecycles

Responsibility map

  • changeset: owns canonical text-vs-move preview families and rejects missing, mixed, or legacy placeholder move previews at ingress
  • cli::edit_intent: owns shared flag arguments, target selection, text-source resolution, and prepared intent normalization
  • cli::edit: resolves an intent and builds a changeset without writing
  • cli::patch: resolves the same intent and executes apply/dry-run behavior
  • integration tests: split into content edits, file targets, file moves, request validation, transactions, filesystem/atomicity, structural moves, and related owners

Contract and compatibility

  • move operations now require preview.move with matching from and to; empty text placeholders and missing move preview data fail at ingress with a regeneration diagnostic
  • edit --identity and patch's hidden --identity/--anchor aliases are removed; --at is the canonical selector
  • edit gains the same single-target flag capabilities as patch, but remains build-only
  • patch remains the one-shot apply path; --dry-run remains non-mutating
  • JSON and multi-file edit behavior are unchanged
  • no external downstream consumer was available in the workspace; the two compatibility breaks above are intentional for the pre-1.0 CLI

Public graph and dependencies

  • added no library-public API; the crate remains binary-only
  • added private cli::edit_intent ownership and removed duplicate cli::patch::{flag,target,text} ownership
  • caller paths shorten to EditIntentArgs -> PreparedEditIntent -> edit build | patch execute
  • dependency direction remains one-way: edit/patch commands depend on edit-intent normalization; edit-intent does not depend on command execution

Lean decisions

  • accepted: remove optional move-preview state, legacy placeholder normalization, duplicate flag parsers, and scenario-number test ownership
  • rejected: reintroducing timing-sensitive rollback tests removed from current main
  • rejected: merging edit and patch execution lifecycles, because build-only versus apply/dry-run is a real invariant
  • rejected: a generic target/operation abstraction beyond the concrete shared intent model

Validation

  • cargo test --locked --all-targets --quiet (2,038 tests passed)
  • cargo clippy --locked --all-targets -- -D warnings
  • cargo fmt --all -- --check
  • cargo build --locked --release
  • git diff --check origin/main...HEAD
  • focused suites: changeset unit tests, apply (190), edit (124), patch (772), merge (4), and CLI surface (15)

Residual risk

  • consumers that persist pre-change move changesets must regenerate them
  • scripts using the former edit --identity flag or patch's hidden --identity/--anchor aliases must switch to --at

@isty2e
isty2e merged commit 4c26c97 into main Jul 28, 2026
1 check passed
@isty2e
isty2e deleted the refactor/canonical-edit-foundation branch July 28, 2026 22:51
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