Five patterns worth reviewing
The workbench’s snippet scanner flags the following text patterns. Its output is a review aid. It is not a JavaScript parser, a codemod or a promise that a snippet will work.
| Old pattern | Current review target |
|---|---|
navigator.modelContext | document.modelContext |
navigator.modelContextTesting | Native discovery and invocation on the current interface |
unregisterTool(...) | An AbortSignal supplied during registration |
executeTool(tool, JSON.stringify(input)) | Pass the input object |
window.ontoolactivated / window.ontoolcancel | Review the current modelContext event target |
The current imperative API documentation uses asynchronous registration, getTools() and executeTool(). Its call arguments are objects; stringified arguments are deprecated from Chrome 155. A registration AbortSignal is the cleanup mechanism. The debugging annotation is documented from Chrome 156. These are dated API details; consult the source again when upgrading.
A concrete migration exercise
Start with the support fixture, retain its seven inputs, and save a pack before editing code. Keep the metadata change and the API-owner change in separate review steps. First show that the intended JSON schema still accepts or rejects the same inputs. Then use a receipt-only native call to establish that the browser reaches the callback. Finally run the real staging action and verify its result.
This order makes failures easier to explain. A missing API is an environment or integration problem. A newly rejected account question is a contract decision. A successful callback followed by a missing confirmation email is an application or delivery problem. Combining all three into one red “agent failed” result hides the useful distinction.
Two lifetimes to keep separate
A component can disappear while an operation it started is still running. Our native probe removed a registration during a delayed call and still received that call’s result. Treat registration cleanup and operation cancellation as separate behaviors in your application tests.
For a preview-only operation, cancellation might simply discard the result. For a mutation, an aborted UI wait does not tell you whether a server committed the operation. Add a case that checks server state after a cancelled request. ContractKit does not simulate a transaction service or certify that cleanup is correct.
Declarative forms need their own regression path
A form declared through HTML attributes is not the same artifact as an imperative input schema pasted here. Chrome’s declarative API documentation describes form-based tools and their submit behavior. Check that guide against the exact browser build used for your test.
Retain the normal submit button, visible field errors and a keyboard-only path. Verify that a field rename reaches the server under the expected name. A local schema fixture cannot prove that your HTML form, event handler and backend agree. Do not mark that integration complete just because the metadata comparison is green.
Scanner limits
The scanner matches known patterns one line at a time. A comment containing an old name may be flagged. A renamed variable, computed property or multiline invocation may be missed. It does not load imports, run code, inspect the DOM or transform source. Review each hint in context, then use the native check and your application tests. See the release playbook for a compact evidence trail.
Bring the question back to a concrete case.
Open ContractKit ↗