Skip to content

test(ui): three ui/ script tests spell their temp bases so the whole-tree scratch-dir sweep reads them (PM dispatch-gates red on main) - #25865

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-wnl5re
Oct 26, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-wnl5re

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread

Fixes #25851
Part of #25677 (cutover aftercare, bill item 50).

Clause-②: no
Metadata-protocol: none

Why main is red

Lint · PM dispatch-gates runs pnpm check:pm-dispatch-gates. On push and schedule that runs both tiers of the battery; on pull_request and the merge queue it runs the fast tier only. That is why every PR run of the cutover sitting was green while every push and schedule run since fd40831416 (#25825) has been red.

Job log of check-run 121332957566 (push run 40247793996, 90a34e2039), the only two red lines:

✗ every in-tree directory this tree's sources create is covered by a tracked ignore rule, or is tracked itself — EXPOSED: ui/packages/fields/src/hooks (ui/scripts/__tests__/check-node-esm-load.test.ts:141), ui/packages/fields/sub (ui/scripts/__tests__/check-node-esm-load.test.ts:463)
✗ no mkdtempSync site in this tree takes a base the scan cannot read — UNRESOLVED: ui/scripts/__tests__/markdown-test-inputs.test.ts:131 (a bare relative literal, resolved against a cwd this scan cannot see: ''), ui/scripts/__tests__/select-affected-tests-wiring.test.ts:142 (a bare relative literal, resolved against a cwd this scan cannot see: ''), ui/scripts/__tests__/select-affected-tests-wiring.test.ts:198 (a bare relative literal, resolved against a cwd this scan cannot see: '')
✗ dispatch-gates self-test: 2 of 2182 case(s) failed.

Both are slow-tier live-tree cases of the scratch-directory sweep (exposedScratchDirs in scripts/pm/dispatch-gates.mjs). Since the import it reads ui/ sources too, and it misreads two spellings in three ui/ script tests:

  1. check-node-esm-load.test.ts binds dir to a temp directory in most tests (const dir = tmpdir(), a local helper over os.tmpdir()), and to path.join(REPO_ROOT, 'packages/fields') and 'packages/auth' in two tests that only read package files. The sweep does not track scope and lets an in-tree reading win (its stated bias), so every mkdirSync(path.join(dir, …)) in the file read as a directory created under ui/packages/fields.
  2. markdown-test-inputs.test.ts and select-affected-tests-wiring.test.ts declare let scratch = '' and assign the real base (mkdtempSync(path.join(tmpdir(), …))) in beforeAll. The empty literal reads as a cwd-relative mkdtempSync base, and the two readings disagree, so the site stays unresolved.

What this changes

The three test sources only. No gate, fixture, workflow or ignore rule changes, and no test changes behaviour.

  • check-node-esm-load.test.ts: the two package-reading tests name their binding pkgDir.
  • markdown-test-inputs.test.ts, select-affected-tests-wiring.test.ts: let scratch: string;, so the beforeAll assignment is the only reading.

The nine mkdirSync(path.join(dir, …)) sites in check-node-esm-load.test.ts now read as unresolved mkdirSync (one dir comes from withTaskLog(…), an arrow function the resolver does not follow), the same class line 706 of that file already had. The live case counts only unresolved mkdtempSync sites, so they do not red it, and none of them reads as in-tree any more.

Evidence

All on this branch's base, main e167956e, with GITHUB_ACTIONS=true GITHUB_EVENT_NAME=push node scripts/pm/check-dispatch-gates.mjs (the step's second command, both tiers):

before (main e167956e) after (this branch, a5958c7b)
battery ✗ dispatch-gates self-test: 2 of 2182 case(s) failed. (exit 1, the same two lines as CI) ✓ dispatch-gates self-test: 2182 cases pass. (exit 0)
live sweep 2 exposed, 3 unresolved mkdtempSync 0 exposed, 0 unresolved mkdtempSync (2388 sites across 18098 tracked sources, 82 in-tree roots)

This PR's own CI runs the fast tier only, so it cannot show the fixed cases. The proof is the first green push run of Lint & Type Check on main after this lands; its run id goes on #25851.

Tier S: three ui/scripts/__tests__/ files, no governed surface. skip-changeset: publishes nothing. The known Test UI 8/16 and 9/16 reds belong to the next 4b PR and are not touched.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HssnEmZ59WGARsErPSbRpf

…three ui/ script tests

The slow tier of `pnpm check:pm-dispatch-gates` runs only on push and
schedule, and since the ui/ import it reads ui/ sources too. Two of its
live-tree cases went red on three ui/ test files:

- check-node-esm-load.test.ts binds `dir` to a temp directory in most
  tests and to `path.join(REPO_ROOT, 'packages/fields' | 'packages/auth')`
  in two. The sweep does not track scope and an in-tree reading wins, so
  every `mkdirSync(path.join(dir, ...))` read as a directory created in
  ui/packages/fields. The two package-reading tests now say `pkgDir`.
- markdown-test-inputs.test.ts and select-affected-tests-wiring.test.ts
  declared `let scratch = ''` and assigned the real temp base in
  beforeAll. The empty literal read as a cwd-relative mkdtempSync base.
  They now declare `let scratch: string;`, so the one assignment is the
  only reading.

No gate changes. Tests unchanged in behaviour (86/86).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HssnEmZ59WGARsErPSbRpf
@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Oct 26, 2026
@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 26, 2026 01:34
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 26, 2026 01:34
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit 1210544 Oct 26, 2026
57 of 59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-wnl5re branch October 26, 2026 01:49
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 40255280821 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Test UI (9/16) — 失败步骤: Run the ui tests (shard 9/16)

    × bounds the three jobs objectui#7270 found running under the 360-minute default 4ms
    × bounds the four jobs objectui#7956 derived a ceiling for 1ms
    FAIL   unit  scripts/__tests__/workflow-cache-save-bound.test.ts > every workflow cache save is bounded and non-fatal (objectui#7048) > bounds the three jobs objectui#7270 found running under the 360-
      ↳ 失败原因: AssertionError: changeset-release.yml must still define a `release:` job: expected undefined to be defined
    FAIL   unit  scripts/__tests__/workflow-cache-save-bound.test.ts > every workflow cache save is bounded and non-fatal (objectui#7048) > bounds the four jobs objectui#7956 derived a ceiling for
      ↳ 失败原因: AssertionError: changeset-release.yml must still define a `lane:` job: expected undefined to be defined
    
  • Test UI (8/16) — 失败步骤: Run the ui tests (shard 8/16)

    × gives every workflow in .github/workflows/ a row in the inventory table — in both directions 49ms
    × never names a workflow file that does not exist 8ms
    × documents every job these four workflows define 2ms
    × names every first-party command the four jobs actually run 1ms
    × names no command outside the declared non-`run:` set 1ms
    × reads one section per workflow — a shrunken enumeration is a broken reader 2ms
    × finds commands on both sides — a silent parser would make every pin below vacuous 3ms
    × names every first-party command every workflow job actually runs 3ms
    × declares every command a section names that its workflow does not run 2ms
    × finds no pre-install gate reaching a package 9ms
    FAIL   unit  scripts/__tests__/check-pre-install-import-graph.test.ts > the real tree — every step objectui#6148 measured is still derived > finds no pre-install gate reaching a package
      ↳ 失败原因: AssertionError: a script this repository runs before `pnpm install` needs `node_modules` to load: expected [ Array(1) ] to deeply equal []
    FAIL   unit  scripts/__tests__/ci-cd-pipeline-doc.test.ts > ci-cd-pipeline.md — workflow inventory > gives every workflow in .github/workflows/ a row in the inventory table — in both directions
      ↳ 失败原因: AssertionError: the "Workflow Inventory" table has rows for workflows that are NOT in .github/workflows/:
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 6 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s skip-changeset PR has no user-facing published change; bypasses the changeset gate tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hourly full run: red on main (Lint & Type Check)

2 participants