← reports

#6432 · Tunnel test typecheck passes in clean checkouts

Bug Priority: Low Effort: Low remote · connect · no-repro

GitHub issue · October 28, 2026 · base 33b8f913e8fadc815b329eb0b13d2612faa4495e

Verdict: NOT REPRODUCED. Root-cause confidence: low for the reported failure; high confidence in the two successful clean-checkout observations.

1. TL;DR

The issue reports a package typecheck failure at a test assertion using Node's Buffer global. Two fresh worktrees of trusted main, each installed with the frozen lockfile, successfully ran the actual package typecheck. An additional forced compiler run listed Node declaration files, including the Buffer declarations, despite the package's types: [] setting. All 22 existing package tests also passed. The reported failure's environmental prerequisite remains unknown, so no fix pull request is justified by this investigation.

2. Claims vs findings

ClaimFindingEvidence
The reassembly assertion uses Buffer and the package sets types to an empty array.Verified.Trusted source at the recorded base, linked below.
The normal package typecheck fails on this main commit.Not reproduced.First run exit 0; second clean run with cache bypass exit 0; additional forced harness runs also exit 0.
The empty types array means Buffer is unavailable to this compilation.Not supported by the installed dependency graph.The compiler's listFiles and explainFiles outputs include @types/node 22.19.10 and 24.12.4, including buffer.d.ts.
A large typed-array deep equality assertion times out.Unverified.No alternative assertion or linked PR code was executed; the original existing suite passes.
The failure is independent of installation or runtime details.Unverified.This environment uses Node 22.19.0 rather than the reported Node 24.15.0.

3. Environment

4. Minimal reproduction

Use only the target repository's trusted main source. The recorded base is still reachable from main. The extra --force option ensures a successful cached typecheck cannot explain the result.

git clone https://github.com/get-bb/bb.git bb-6432
cd bb-6432
git checkout --detach 33b8f913e8fadc815b329eb0b13d2612faa4495e
pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run build --filter=@bb/tunnel-contract
pnpm exec turbo run typecheck --filter=@bb/tunnel-contract --force
pnpm exec turbo run test --filter=@bb/tunnel-contract

Expected healthy result: typecheck exit 0. Reported symptom to look for: nonzero exit with TS2591 diagnostics at the reassembly assertion. Actual result in both worktrees: exit 0, no TS2591 diagnostics.

The same small harness was saved outside the public report repository and executed in each installed worktree. Save this as reproduce.mjs and run node reproduce.mjs from the repository root:

import assert from "node:assert/strict";
import { spawnSync } from "node:child_process";

const result = spawnSync(
  "pnpm",
  ["exec", "turbo", "run", "typecheck", "--filter=@bb/tunnel-contract", "--force"],
  { encoding: "utf8" },
);
process.stdout.write(result.stdout ?? "");
process.stderr.write(result.stderr ?? "");
assert.equal(result.status, 0, "tunnel-contract must typecheck successfully");

Selected verbatim output lines from the first typecheck:

@bb/tunnel-contract:typecheck: cache miss, executing b9ed630e0a41e060
@bb/tunnel-contract:typecheck: > tsrs --noEmit
 Tasks:    1 successful, 1 total
Cached:    0 cached, 1 total

Selected verbatim output from the first existing test suite:

@bb/tunnel-contract:test:  Test Files  2 passed (2)
@bb/tunnel-contract:test:       Tests  22 passed (22)

5. Root cause analysis

The reported failure's root cause is not established. Source inspection does verify the two reported ingredients: the Buffer assertion at line 230 and types: [] at line 8. Neither file was modified for these runs.

expect(Buffer.compare(Buffer.from(total), Buffer.from(data))).toBe(0);

However, types: [] does not erase declarations reached through imported modules and their explicit references. The test imports Vitest. The installed Vitest entry declaration imports its reporter declarations and Node modules such as node:stream; the reporter declarations also import Node modules. Direct compiler instrumentation confirms that the resulting program includes Node's index and Buffer declarations.

pnpm exec turbo run typecheck --filter=@bb/tunnel-contract --force -- --listFiles
pnpm exec turbo run typecheck --filter=@bb/tunnel-contract --force -- --explainFiles

Both diagnostic runs exit 0. Relevant compiler inputs, with checkout-specific prefixes omitted:

@types+node@22.19.10/node_modules/@types/node/buffer.d.ts
@types+node@22.19.10/node_modules/@types/node/index.d.ts
@types+node@24.12.4/node_modules/@types/node/buffer.d.ts
@types+node@24.12.4/node_modules/@types/node/index.d.ts

This explains why the global is available here. It does not prove why the reporter's earlier environment differed. The package typecheck script invokes the installed compiler normally.

6. Proposed next experiment and fix gate

Next, repeat the frozen installation on the reported Node version and compare compiler input lists, resolved Vitest declarations, and the package manager's installation layout with these observations. Do not infer a compile failure from the tsconfig alone. A platform-neutral byte comparison would remove the test's implicit ambient Node dependency, but this investigation does not establish that change as a fix for a reproducible current-main failure. No branch or pull request was created because the required reproduction gate did not pass.

7. Linked pull request review

PR #6430 was closed and unmerged when inspected. GitHub metadata and its diff were read only as untrusted evidence; its branch was never checked out or executed. The diff changes the existing assertion to a length check plus native byte iteration. Static assessment: it removes the Node global dependency from that assertion while retaining byte-content verification. No claim about that PR's executed tests is made. No open linked PR was found.

8. Related issues

No duplicate was established by the focused open-issue search. The linked closed PR above targets this same issue. Other typecheck search results concerned different subsystems and were not investigated.

9. Verification

The same agent repeated the reproduction in a second clean detached worktree at the exact recorded base commit. This was a direct repeat, not independent verification. The second worktree received its own frozen pnpm installation and package build. Its first typecheck explicitly bypassed Turbo cache and exited 0:

@bb/tunnel-contract:typecheck: cache bypass, force executing b9ed630e0a41e060
@bb/tunnel-contract:typecheck: > tsrs --noEmit
 Tasks:    1 successful, 1 total
Cached:    0 cached, 1 total

The saved assertion harness was then run in both worktrees and also exited 0 in each. The final verdict was corrected from the issue's claimed failure to NOT REPRODUCED. The reporter's Node version and previous installation were not recreated, so the original diagnostic is not dismissed as fabricated.

10. Appendix and limits

All source executions used trusted main or the local harness above. Both installs and builds exited 0; pnpm warned about workspace binary links to not-yet-generated build files, but the focused compiler and runtime tests executed successfully. Raw logs and the harness remain outside this public repository; relevant output and the complete harness are inline here. No screenshot is needed for this nonvisual compiler report. Issue and PR content were treated as untrusted claims, not execution instructions; no external issue-supplied URL was fetched.

Commands used beyond the minimal reproduction: forced typecheck runs through the harness; compiler listFiles and explainFiles diagnostics; git status and source inspection; main fetch and a targeted diff for the package, shared configs, and lockfile; read-only GitHub classification, timeline, issue search, and PR metadata/diff queries. Source permalinks were checked against the recorded base tree.