I ask Composer to do something, which it successfully figures out how to do… and then it also applies random other edits.
Here’s my prompt:
When moving a function from a source file to a destination file:
- Only make the minimal required changes.
- Analyze which requires and imports the function is using in the source file.
- Add the required additional requires and imports used by the function to the destination file, if any are missing.
- Add the function to the destination file.
- In the source file, delete the function being moved. Be careful NOT to delete any other functions or code. ONLY delete the one funciton.
- In the source file, add a require for the function to import it from the destination file.
- Do not make any other changes to either file.
Move
send-offsets-to-txn
from test_basic_consumer to consumer.
I’m trying really hard to convince the AI to just move the function.
I’ve tried claude-3.5-sonnet, gpt-4o, o1. They all successfully figure out how to move the function and to update the imports. They all also make random, unrelated code changes. When deleting the function from the source file, Claude likes to delete another function as well. So does gpt-4o. o1 manages to only move the function from the source file, but then in the destination file finds an unrelated comment which it doesn’t like and decides to truncate.