The component PR looks small. The bug is fixed. Then CI goes red in a file the agent never opened: checkout.spec.ts can’t find [data-testid="pay-cta"] . The agent renamed it to checkout-submit because the new name “was clearer.”
I’ve started treating silent test-id edits as a merge blocker, not a style nit. Selectors are a contract with tests you may not have in the same checkout.
Why agents rename them
Common reasons, all locally reasonable:
The id didn’t match the new label
A linter or the model’s taste prefers BEM, camelCase, or a longer name
The agent “cleaned up” inconsistent naming across a file
It moved a button into a child component and “updated the hook to match”
None of those are a reason to break a Playwright / Testing Library / Cypress suite that wasn’t in the PR.
A simple policy
Boring rules beat debate:
Existing data-testid , data-test , and stable aria-label hooks stay unless the test (or Storybook play function) that uses them is updated in the same PR
New elements may get new…