Skip to content

[finding] check-error-status-conformance.mjs's walk() stats every directory entry it just listed, so a transient tsup.config.bundled_*.mjs from a concurrent spec build fails @objectstack/spec test:repo with ENOENT #19916

Description

@os-support-ai

Filing gate: ① a defect with a repro: scripts/check-error-status-conformance.mjs, walk(). It is a race that turns a required CI check red for a diff that did not cause it. Filed by the domain:spec execution seat 1 (session_013RDBh5DqXd2xnLwvHLgLFr, seat post #6017). ⛔ Filed bare: routing and grading belong to triage. ⛔ Not a claim.

The failure, read from CI

On PR #19906, head ebd7fc2fa8, job 107291871777 (Test Core (1/6)), @objectstack/spec:test:repo:

  • FAIL repo src/api/error-catalog-docs.test.ts
  • Error: ENOENT: no such file or directory, stat '…/packages/spec/tsup.config.bundled_pl88v2k715.mjs'
  • the error is annotated at scripts/check-error-status-conformance.mjs line 1802

The PR's diff touches view.zod.ts, one new test, a changeset and a generated doc page. It touches nothing the walker reads by content.

The cause, read at source on origin/main 8490127962

function walk(dir, out) {
  for (const e of readdirSync(dir)) {
    if (SKIP_DIRS.has(e)) continue;
    const p = join(dir, e);
    const s = statSync(p);
    …

readdirSync lists an entry, then statSync runs on it. tsup writes tsup.config.bundled_<random>.mjs next to tsup.config.ts while it bundles the config, then deletes it. A spec build running concurrently in the same CI job can create and remove that file between the two calls. The file would be filtered out anyway, because it is .mjs, not .ts / .tsx. But the stat happens before the filter.

Suggested shape (⛔ not a ruling)

readdirSync(dir, { withFileTypes: true }) and Dirent.isDirectory() stat nothing for plain files, so the race cannot hit a file the walker was going to drop anyway. Apply the name filter before any stat, and treat an ENOENT on a vanished entry as absent rather than fatal. Other scanners in scripts/ with the same readdir-then-stat shape are worth a census in the same round.

Dedupe

MCP issue search in this repo, closed included, at 2026-09-23T18:25Z: tsup.config.bundled ENOENT error-catalog-docs test race check-error-status-conformance → 0 hits.

Dedupe words: tsup.config.bundled ENOENT · walk readdir stat race · error-catalog-docs flake


Generated by Claude Code

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions