Make request-traceable surgical edits
Bound authorized edits to the requested behavior and only clean up orphans created by those edits.
These examples and illustrative results are independently authored teaching materials, not measured model results.
Use case
Repair empty-email validation in a file with unrelated username rules and old unused functions. Every teaching edit should trace to the request, not incidental policy/reformatting.
Mechanism
Identify trigger/necessary call paths and preserve surrounding style. Remove orphans created by the fix, recording preexisting unrelated dead code. Include causally necessary cross-file edits instead of a one-file limit. Review diff provenance and regressions, preserving user changes.
Bad example
Fix email while tightening usernames, deleting old functions and reformatting everything as overall improvement.
Good example
Change empty-email behavior/required callers, retain username policy and remove newly unused imports only. Explain each diff’s connection and verify repair/related existing behavior without expanding rules.
Why the change matters
Traceability reduces review surface/unrelated regression. Cleaning new orphans completes the change while retaining unrelated code respects scope.
Observable expectation
Teaching email branch/import changes map to the fix; username policy stays. Shared-type edits need caller evidence. Check the symptom and existing valid usernames; unrun regressions remain unverified.
Limits
Small scope does not mean one line; necessary refactoring can be broader. Minimal diffs must not hide incomplete fixes. Continue authorized work and record unrelated design suggestions separately.