A display label is editable copy. A model ID is request data. When a UI uses the displayed text as its identifier, a harmless copy update can change the request it sends. Keep the ID in configuration and snapshot it in the job record.
This local JavaScript fixture checks that a label-only change produces the same request data. The identifier is a placeholder.
import assert from 'node:assert/strict';
const model = { label: 'Draft model', id: 'provider/model-a' };
const buildRequest = ({ id }) => ({ model: id });
const beforeRename = buildRequest(model);
const afterRename = buildRequest({ ...model, label: 'New display name' });
assert.deepEqual(afterRename, beforeRename);
assert.equal(beforeRename.model, 'provider/model-a');
In an application test, assert the actual outgoing request body. For an intentional ID migration, write a separate test that checks the next request uses the new ID and the historical record still shows the old one.
Generated with AI for RouterBase. The example is an offline fixture and sends no network request.
Top comments (0)