feat(codemode): unify callback acceptance and support built-in references (#36771)

This commit is contained in:
Aiden Cline 2026-07-14 15:25:39 -05:00 committed by GitHub
commit ea89a2f619
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 530 additions and 124 deletions

View file

@ -1083,9 +1083,10 @@ describe("promise chaining", () => {
expect(result.warnings).toBeUndefined()
})
test("non-plain-function handlers fail loudly instead of being ignored", async () => {
test("unsupported callable handlers fail loudly with a wrap hint", async () => {
const diagnostic = await error(`return await tools.host.echo({ id: 1 }).then(tools.host.completed)`)
expect(diagnostic.message).toContain("Promise.prototype.then handlers must be plain functions")
expect(diagnostic.message).toContain("Promise.prototype.then cannot use this callable as a handler")
expect(diagnostic.message).toContain("wrap it in an arrow function")
})
test("chaining methods are opaque references until called", async () => {