Skip to content

[M14 refactoring] Unify semantic rename across OPY and OSTW on validated edit transactions #129

Description

@Teakowa

Parent: #127
Depends on: #128

Goal

Make semantic rename a shared Wright refactoring over the project-aware edit transaction contract, preserving the proven OPY/M10 behavior while adding the declared OSTW source surface without creating language- or LSP-specific mutation engines.

Context

M10 already proved project-wide semantic rename for OPY, but that behavior lives across language-service/workspace code that predates the M14 shared edit transaction boundary. #128 establishes the frontend-aware atomic validation contract needed to make rename a reusable semantic operation.

M14 should consolidate rename around semantic identity and validated source edits before exposing mutation to agents or adding further refactorings.

Scope

  • Reuse Wright semantic symbols/references/project ownership to resolve the rename target and collect only semantically identical occurrences.
  • Produce one validated multi-source edit transaction rather than textual whole-document replacement.
  • Preserve current OPY project-wide rename behavior, including includes, open overlays, source/version preconditions, collisions, and stale refusal.
  • Add semantics-backed rename for the accepted OSTW source/project surface where current semantic identity and source spans prove correctness.
  • Support declarations and references across imports/project files when the shared semantic model exposes them.
  • Refuse ambiguous, unsupported, generated-only, or otherwise unsafe rename targets explicitly.
  • Validate the resulting transaction through [M14 foundation] Make source-edit transactions project- and frontend-aware #128 before returning success.
  • Keep the refactoring API editor/transport neutral; LSP mapping is handled separately.
  • Add cross-language positive/negative regressions for same-spelled unrelated identifiers, shadowing/namespace boundaries, cross-file references, overlays, stale versions, collisions, and unsupported targets.

Non-goals

  • Plain-text search/replace as semantic rename.
  • Whole-source reconstruction through Workshop/WIR.
  • Extract/inline/move/organize-imports or other new refactorings.
  • Expanding OPY/OSTW language support solely for rename.
  • LSP-specific WorkspaceEdit ownership.
  • Agent/tool-service exposure; tracked separately.

Acceptance criteria

  • OPY semantic rename uses the shared [M14 foundation] Make source-edit transactions project- and frontend-aware #128 edit transaction/validation boundary and retains accepted M10 project-wide behavior.
  • OSTW symbols on the declared supported semantic surface can be renamed against original OSTW source when semantic identity and spans are sufficient.
  • Only occurrences belonging to the resolved semantic identity are edited; unrelated same-spelled text/symbols remain unchanged.
  • Cross-file edits preserve source identity/version preconditions and validate atomically through the original project/frontend semantics.
  • Ambiguous, colliding, stale, unsupported, or unsafe renames fail with deterministic structured diagnostics and no partial transaction.
  • The reusable rename contract contains no LSP protocol types and exposes no mutable HIR/WIR internals.
  • Existing OPY/OSTW compile/check/analyze/lint/inspect/convert behavior remains green.
  • Full current CI is green.

Relationships

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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