From 103bb24b658fa49447b0a253ff24fa88c032d981 Mon Sep 17 00:00:00 2001 From: yetone Date: Thu, 15 Oct 2026 17:07:59 +0800 Subject: [PATCH] trae: ownclient's tests open one fake at a time, so global.test finds the realm's own hosts (0.2.14's publish run) checkIn() opened a fake over the one the test had already opened; closing the second put the first's 127.0.0.1 origin back as trae-cn's hosts, so global.test.mjs, run after it in one process, read a fake host. The publish run for 2009f49 went red on it and 0.2.14 never reached npm. checkIn now closes the fake before it opens another. Ran: HOME=$(mktemp -d) bun test at the repo root: 1509 pass, 0 fail. Broken by hand: without the close, `bun test ./ownclient.test.mjs ./global.test.mjs` fails "the realm's table is its own" (26 pass, 1 fail), as the publish run did. --- packages/trae/ownclient.test.mjs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/trae/ownclient.test.mjs b/packages/trae/ownclient.test.mjs index 78a2745..ea67e97 100644 --- a/packages/trae/ownclient.test.mjs +++ b/packages/trae/ownclient.test.mjs @@ -48,6 +48,9 @@ function client(userId, { encoded = true, dcs = [DC] } = {}) { } async function checkIn(auth = signedIn()) { + // one fake at a time: a second opened over the first would put the + // first's host back as the realm's own when it closes + f?.close() f = fakeTrae() f.route("POST /trae/api/v2/ug/checkin_credits/claim", () => json({ code: 0 })) f.route("POST /trae/api/v2/pay/ide_user_ent_usage", () => json({ code: 0 }))