← Files Software & AI CopilotARCHIVED FILE
references/behavior-preserving-refactors.md
734 Bytes · Nov 29, 2026 · 00:39 UTC
# Refactor without accidental behavior change Write a behavior map before edits: public API, serialization, ordering, exception types, side effects, persistence, performance-sensitive boundaries. Capture characterization tests for legacy logic where needed. Move one responsibility at a time; avoid renaming every symbol or formatting whole directories. Beware of observably different null/default logic and hidden time or locale dependencies. After refactor, compare regression outcomes and public contract snapshots, verify changed build output, and inspect the diff for unrelated changes. Document intentionally changed behavior separately. A refactor request is not approval to migrate frameworks or replace the architecture.
SHA-256: 8b4a5f1b4b3fe84f12ea90f5ca49e9b2dd2293651b7a26a00684c933c8603437