← reports

#6778 · Thread attachment size validation and upstream error messages

BugPriority: MediumEffort: LowuiGitHub issue

2026-11-01 · trusted main 916d684ac23d0b0de82c09cfc7553a50287d2188

Verdict: PARTIALLY REPRODUCED · Root-cause confidence: high for the tested composer behavior; the original ingress failure remains unverified.

1. TL;DR

The existing-thread composer uploads files without first checking their size. When an upstream service rejects an upload with only a generic HTTP 413 reason, the composer has no attachment-specific explanation. Both behaviors reproduce at the actual composer upload-function boundary in two clean checkouts of trusted main. However, main already preserves descriptive server errors and uses a shared 35 MiB limit for images and other files; the older limits in the report do not describe this base. This investigation did not send the original video through a live relay and does not identify which ingress generated that user's 413.

2. Claims vs findings

ClaimFindingEvidence
Thread uploads lack size preflightVerifiedA 35 MiB + 1 byte synthetic file reaches the upload callback. The regression expects only the subsequent valid file to reach it, but receives two calls.
A generic 413 does not explain attachment sizeVerified at the composer boundaryInjected SDK HTTP failures with empty, generic, and numeric-only reasons produce no size guidance.
Client always discards a useful server messageRefuted for trusted mainThe existing server-refusal test passes. SDK JSON error extraction and composer error formatting already preserve detailed messages.
Thread limits differ between image and non-image filesRefuted for trusted mainThe shared domain constant is 35 × 1024 × 1024 bytes; the server checks it for every file type.
The relay rejected the original upload; logs were absentUnverifiedNo production logs, runtime data, original file, or remote relay were accessed.
Typed draft must survive rejectionNot dynamically verifiedThe upload helper has no text-clearing operation and calls addAttachment only after upload succeeds. No full UI draft lifecycle claim is made.

3. Environment

4. Minimal reproduction

  1. Clone the public repository and check out the recorded commit:
    git clone https://github.com/get-bb/bb.git bb-6778
    cd bb-6778
    git checkout --detach 916d684ac23d0b0de82c09cfc7553a50287d2188
    pnpm install --frozen-lockfile --prefer-offline
    pnpm exec turbo run build --filter=@get-bb/plugin-sdk
    pnpm exec turbo run build --filter=@bb/app
  2. Download the agent-authored regression patch into the checkout as regression.patch and apply it. It changes only the existing upload test, not production:
    git apply regression.patch
    pnpm exec turbo run test --filter=@bb/app -- --run src/components/thread/composer/useComposerAttachmentUploads.test.ts
  3. Expected: reject the oversized file before invoking upload; attach the small valid file; show size guidance for generic HTTP 413. Actual on unchanged production:
    AssertionError: expected "vi.fn()" to be called 1 times, but got 2 times
    Test Files  1 failed (1)
    Tests  5 failed | 4 passed (9)
    The three 413 cases also fail their expected guidance assertion. These failures are intentional regression evidence, not environmental setup failures.

Complete artifacts: test source, first log, second log.

Complete reproduction test file
import { describe, expect, it, vi } from "vitest";
import type { PromptDraftAttachment } from "@bb/client-core";
import { BbHttpError } from "@bb/sdk/browser";
import { PROMPT_ATTACHMENT_MAX_BYTES } from "@bb/domain";
import { uploadDraftAttachments } from "./useComposerAttachmentUploads";

const uploaded: PromptDraftAttachment = {
  type: "localFile",
  path: "uploads/old.txt",
  name: "old.txt",
  sizeBytes: 3,
};

function pending(name: string) {
  return { id: name, file: new File([name], name) };
}

describe("uploadDraftAttachments", () => {
  it.each(["video/mp4", "image/png"])(
    "rejects an oversized %s before upload and still attaches a valid file",
    async (mimeType) => {
      const file = new File(
        [new Uint8Array(PROMPT_ATTACHMENT_MAX_BYTES + 1)],
        "large-attachment",
        { type: mimeType },
      );
      const upload = vi.fn(async () => uploaded);
      const addAttachment = vi.fn();
      const settled = vi.fn();
      const target = { key: "bottom", addAttachment };

      const result = await uploadDraftAttachments({
        uploads: [{ id: "large", file }, pending("old.txt")],
        target,
        upload,
        getCurrentTarget: () => target,
        onUploadSettled: settled,
      });

      expect(upload).toHaveBeenCalledTimes(1);
      expect(upload).toHaveBeenCalledWith(expect.objectContaining({ name: "old.txt" }));
      expect(result.added).toEqual([uploaded]);
      expect(addAttachment).toHaveBeenCalledTimes(1);
      expect(settled).toHaveBeenCalledTimes(2);
      expect(result.failureMessage).toContain("large-attachment is 35.1 MB");
      expect(result.failureMessage).toContain("35 MB attachment limit");
    },
  );

  it.each(["", "Payload Too Large", "413"])(
    "explains an upstream 413 with generic reason %j",
    async (message) => {
      const upload = vi.fn(async () => {
        throw new BbHttpError({ body: null, code: null, message, status: 413 });
      });
      const target = { key: "bottom", addAttachment: vi.fn() };
      const result = await uploadDraftAttachments({
        uploads: [pending("clip.mp4")],
        target,
        upload,
        getCurrentTarget: () => target,
        onUploadSettled: vi.fn(),
      });

      expect(result.added).toEqual([]);
      expect(target.addAttachment).not.toHaveBeenCalled();
      expect(result.failureMessage).toContain("Upload rejected as too large");
      expect(result.failureMessage).toContain("35 MB");
    },
  );

  it("adds a late upload to the draft it started in after the composer moves to another draft", async () => {
    const addToThreadA = vi.fn();
    const addToThreadB = vi.fn();
    const threadA = { key: "thread-a", addAttachment: addToThreadA };
    let currentTarget = threadA;
    const settled: string[] = [];

    const result = await uploadDraftAttachments({
      uploads: [pending("old.txt")],
      target: threadA,
      upload: async () => {
        currentTarget = { key: "thread-b", addAttachment: addToThreadB };
        return uploaded;
      },
      getCurrentTarget: () => currentTarget,
      onUploadSettled: (upload) => settled.push(upload.id),
    });

    expect(result).toEqual({ added: [], failureMessage: null });
    expect(addToThreadA).toHaveBeenCalledWith(uploaded);
    expect(addToThreadB).not.toHaveBeenCalled();
    expect(settled).toEqual(["old.txt"]);
  });

  it("adds uploads to the target that is still current", async () => {
    const addAttachment = vi.fn();

    const result = await uploadDraftAttachments({
      uploads: [pending("old.txt")],
      target: { key: "bottom", addAttachment },
      upload: async () => uploaded,
      getCurrentTarget: () => ({ key: "bottom", addAttachment }),
      onUploadSettled: vi.fn(),
    });

    expect(result.added).toEqual([uploaded]);
    expect(addAttachment).toHaveBeenCalledWith(uploaded);
  });

  it("shows the server's reason when it refuses an upload", async () => {
    const message =
      "HEIC images are not supported. Convert the image to JPEG or PNG before attaching it.";
    const upload = vi
      .fn<(file: File) => Promise<PromptDraftAttachment>>()
      .mockRejectedValueOnce(
        new BbHttpError({
          body: { code: "invalid_request", message },
          code: "invalid_request",
          message,
          status: 400,
        }),
      )
      .mockRejectedValueOnce(new TypeError("Failed to fetch"));

    const result = await uploadDraftAttachments({
      uploads: [pending("IMG_0001.heic"), pending("shot.png")],
      target: { key: "bottom", addAttachment: vi.fn() },
      upload,
      getCurrentTarget: () => ({ key: "bottom", addAttachment: vi.fn() }),
      onUploadSettled: vi.fn(),
    });

    expect(result.failureMessage).toBe(
      `Failed to attach IMG_0001.heic, shot.png: ${message}`,
    );
  });

  it("names failed files without a reason when the failure is not a server refusal", async () => {
    const result = await uploadDraftAttachments({
      uploads: [pending("inline.txt")],
      target: { key: "bottom", addAttachment: vi.fn() },
      upload: async () => {
        throw new Error("inline failed");
      },
      getCurrentTarget: () => ({ key: "bottom", addAttachment: vi.fn() }),
      onUploadSettled: vi.fn(),
    });

    expect(result.failureMessage).toBe("Failed to attach: inline.txt");
  });

});

5. Root cause

The composer upload loop invokes upload(pendingUpload.file) unconditionally. Neither its pending-upload staging nor the shared mutation checks size before invoking the SDK. Consequently, even a file that exceeds the server's known limit consumes upload bandwidth and can hit a proxy rejection first.

Rejection formatting delegates every SDK HTTP error to the general mutation formatter. There is no special case for a generic 413. The SDK error reader deliberately uses status text for an empty body or HTML error, but preserves a useful JSON message. This is why a generic upstream refusal provides little guidance, while a descriptive application error already works.

The shared limit is 35 MiB. The server validation rejects oversize uploads with HTTP 400 and a descriptive envelope. The original 413 therefore cannot be attributed to that current validation branch alone. History records the shared-limit change in commit 76ae202c87 (PR #4046); no historic branch was executed.

6. Proposed fix

Keep the change inside the existing-thread composer upload subsystem: compare each file's size with the domain constant before invoking upload, collect a filename/actual-size/limit explanation, and continue processing valid files. Retain existing upload settlement and draft targeting. Preserve detailed server reasons; add a helpful fallback only for generic 413 responses, acknowledging that a proxy may impose a smaller limit. Do not change server protocols, SDK schemas, relay policy, storage, or the distinct task-attachment subsystem.

A local candidate implements this in the upload module and its existing test file. The initial focused post-fix check passed all 21 tests across upload behavior, pending upload lifecycle, and mutation error messages. The expanded run passed 86 tests in five files, including existing plugin/new-thread composer and queued-edit tests. Turbo app build, typecheck, and lint passed (lint reports warnings in existing files, with zero errors). The candidate changes 165 text lines in two files (134 additions + 31 deletions), with no binary or generated changes; git diff --check passed.

7. Verification

The same agent repeated the reproduction in a second clean temporary clone, named verify, at 916d684ac23d0b0de82c09cfc7553a50287d2188. A new frozen install and SDK build preceded applying the identical test-only patch. The exact Turbo test command above again produced 5 failed and 4 passed, including the same two unwanted-upload assertions and three missing-guidance assertions. This is a repeated clean run, not independent-agent verification. No ports or data directories apply because both executions were unit-level.

Report correction after verification: none. The verdict intentionally remains partial because the current limit differs from the report, useful server error bodies already work, and the production relay path was not exercised.

Selected verification recipe: composer attachments. Unit-level attachment/error behavior is verified; live browser rendering, actual connect transport, and persisted typed-draft restoration are not run. The repository verification-map inventory check stops on an already-unmapped diagnostics CLI family unrelated to this patch; no inventory baseline was changed.

8. Related issues and pull requests

No linked open pull request was found in cross-reference metadata or the open-PR search for this issue before fixing. PR #4046 is historical limit context, not a reviewed candidate fix. No additional duplicate issue was established from the attachment issue search.

9. Appendix

Issue text and comments were treated only as untrusted claims. No commands, links, scripts, branches, or patches from issue content were executed. The regression was authored from trusted repository evidence. No screenshot is claimed or fabricated.

Checks used: repository visibility and issue property GraphQL reads; label-list and similar-issue reads; trusted main fetch; frozen installs; Turbo build/test/typecheck/lint; commit-pinned source inspection and Git history; two unchanged-production regression runs; focused post-fix tests; duplicate-PR metadata search.

First clean-run log
• turbo 2.10.12

   • Packages in scope: @bb/app
   • Running test in 1 packages
   • Remote caching disabled

//:ensure-native-modules: cache bypass, force executing ced2b614b0a022e8
@bb/process-utils:generate:profile-worker: cache miss, executing f00ba284b5432770
@bb/plugin-build:generate: cache miss, executing 8547817cb3290869
@bb/templates:generate:templates: cache miss, executing 90ed396ea2c45072
@bb/templates:generate:plugin-scaffold: cache miss, executing 74a882d3009ba7d4
//:ensure-native-modules: 
//:ensure-native-modules: > bb@ ensure-native-modules <temporary-work-directory>/base
//:ensure-native-modules: > node scripts/ensure-native-modules.mjs
//:ensure-native-modules: 
@bb/process-utils:generate:profile-worker: 
@bb/process-utils:generate:profile-worker: > @bb/process-utils@0.0.1 generate:profile-worker <temporary-work-directory>/base/packages/process-utils
@bb/process-utils:generate:profile-worker: > node scripts/generate-profile-worker.mjs
@bb/process-utils:generate:profile-worker: 
@bb/templates:generate:plugin-scaffold: 
@bb/templates:generate:plugin-scaffold: > @bb/templates@0.0.1 generate:plugin-scaffold <temporary-work-directory>/base/packages/templates
@bb/templates:generate:plugin-scaffold: > node ./scripts/generate-plugin-scaffold.mjs
@bb/templates:generate:plugin-scaffold: 
@bb/templates:generate:templates: 
@bb/templates:generate:templates: > @bb/templates@0.0.1 generate:templates <temporary-work-directory>/base/packages/templates
@bb/templates:generate:templates: > node ./scripts/generate-templates.mjs
@bb/templates:generate:templates: 
@bb/plugin-build:generate: 
@bb/plugin-build:generate: > @bb/plugin-build@0.0.1 generate <temporary-work-directory>/base/packages/plugin-build
@bb/plugin-build:generate: > node ./scripts/generate-plugin-theme.mjs && node ./scripts/generate-runtime-export-manifest.mjs
@bb/plugin-build:generate: 
//:ensure-native-modules: [ensure-native-modules] Detached hardlinked better-sqlite3 binary before verification
@bb/plugin-build:generate: plugin-theme.generated.ts up to date
@bb/plugin-build:generate: host-tailwind.css up to date
@bb/plugin-build:generate: host-tailwind-version.ts up to date
@bb/plugin-build:generate: wrote <temporary-work-directory>/base/packages/plugin-build/src/generated/runtime-export-manifest.generated.ts (react@19.3.0)
@bb/app:test: cache miss, executing 8cd74ea508ee8de2
@bb/app:test: 
@bb/app:test: > @bb/app@0.0.1 test <temporary-work-directory>/base/apps/app
@bb/app:test: > node scripts/generate-pwa-icons.mjs --check && vitest run --config vitest.config.ts "--run" "src/components/thread/composer/useComposerAttachmentUploads.test.ts"
@bb/app:test: 
@bb/app:test: 
@bb/app:test:  RUN  v4.1.1 <temporary-work-directory>/base/apps/app
@bb/app:test: 
@bb/app:test:  ❯ |@bb/app| src/components/thread/composer/useComposerAttachmentUploads.test.ts (9 tests | 5 failed) 41ms
@bb/app:test:      × rejects an oversized video/mp4 before upload and still attaches a valid file 21ms
@bb/app:test:      × rejects an oversized image/png before upload and still attaches a valid file 9ms
@bb/app:test:      × explains an upstream 413 with generic reason "" 4ms
@bb/app:test:      × explains an upstream 413 with generic reason "Payload Too Large" 1ms
@bb/app:test:      × explains an upstream 413 with generic reason "413" 1ms
@bb/app:test:      ✓ adds a late upload to the draft it started in after the composer moves to another draft 1ms
@bb/app:test:      ✓ adds uploads to the target that is still current 1ms
@bb/app:test:      ✓ shows the server's reason when it refuses an upload 1ms
@bb/app:test:      ✓ names failed files without a reason when the failure is not a server refusal 1ms
@bb/app:test: 
@bb/app:test: ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 5 ⎯⎯⎯⎯⎯⎯⎯
@bb/app:test: 
@bb/app:test:  FAIL  |@bb/app| src/components/thread/composer/useComposerAttachmentUploads.test.ts > uploadDraftAttachments > rejects an oversized video/mp4 before upload and still attaches a valid file
@bb/app:test:  FAIL  |@bb/app| src/components/thread/composer/useComposerAttachmentUploads.test.ts > uploadDraftAttachments > rejects an oversized image/png before upload and still attaches a valid file
@bb/app:test: AssertionError: expected "vi.fn()" to be called 1 times, but got 2 times
@bb/app:test:  ❯ src/components/thread/composer/useComposerAttachmentUploads.test.ts:40:22
@bb/app:test:      38|       });
@bb/app:test:      39|
@bb/app:test:      40|       expect(upload).toHaveBeenCalledTimes(1);
@bb/app:test:        |                      ^
@bb/app:test:      41|       expect(upload).toHaveBeenCalledWith(expect.objectContaining({ na…
@bb/app:test:      42|       expect(result.added).toEqual([uploaded]);
@bb/app:test: 
@bb/app:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/5]⎯
@bb/app:test: 
@bb/app:test:  FAIL  |@bb/app| src/components/thread/composer/useComposerAttachmentUploads.test.ts > uploadDraftAttachments > explains an upstream 413 with generic reason ""
@bb/app:test: AssertionError: expected 'Failed to attach clip.mp4: Request fa…' to contain 'Upload rejected as too large'
@bb/app:test: 
@bb/app:test: Expected: "Upload rejected as too large"
@bb/app:test: Received: "Failed to attach clip.mp4: Request failed"
@bb/app:test: 
@bb/app:test:  ❯ src/components/thread/composer/useComposerAttachmentUploads.test.ts:67:37
@bb/app:test:      65|       expect(result.added).toEqual([]);
@bb/app:test:      66|       expect(target.addAttachment).not.toHaveBeenCalled();
@bb/app:test:      67|       expect(result.failureMessage).toContain("Upload rejected as too …
@bb/app:test:        |                                     ^
@bb/app:test:      68|       expect(result.failureMessage).toContain("35 MB");
@bb/app:test:      69|     },
@bb/app:test: 
@bb/app:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/5]⎯
@bb/app:test: 
@bb/app:test:  FAIL  |@bb/app| src/components/thread/composer/useComposerAttachmentUploads.test.ts > uploadDraftAttachments > explains an upstream 413 with generic reason "Payload Too Large"
@bb/app:test: AssertionError: expected 'Failed to attach clip.mp4: Payload To…' to contain 'Upload rejected as too large'
@bb/app:test: 
@bb/app:test: Expected: "Upload rejected as too large"
@bb/app:test: Received: "Failed to attach clip.mp4: Payload Too Large"
@bb/app:test: 
@bb/app:test:  ❯ src/components/thread/composer/useComposerAttachmentUploads.test.ts:67:37
@bb/app:test:      65|       expect(result.added).toEqual([]);
@bb/app:test:      66|       expect(target.addAttachment).not.toHaveBeenCalled();
@bb/app:test:      67|       expect(result.failureMessage).toContain("Upload rejected as too …
@bb/app:test:        |                                     ^
@bb/app:test:      68|       expect(result.failureMessage).toContain("35 MB");
@bb/app:test:      69|     },
@bb/app:test: 
@bb/app:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[3/5]⎯
@bb/app:test: 
@bb/app:test:  FAIL  |@bb/app| src/components/thread/composer/useComposerAttachmentUploads.test.ts > uploadDraftAttachments > explains an upstream 413 with generic reason "413"
@bb/app:test: AssertionError: expected 'Failed to attach clip.mp4: 413' to contain 'Upload rejected as too large'
@bb/app:test: 
@bb/app:test: Expected: "Upload rejected as too large"
@bb/app:test: Received: "Failed to attach clip.mp4: 413"
@bb/app:test: 
@bb/app:test:  ❯ src/components/thread/composer/useComposerAttachmentUploads.test.ts:67:37
@bb/app:test:      65|       expect(result.added).toEqual([]);
@bb/app:test:      66|       expect(target.addAttachment).not.toHaveBeenCalled();
@bb/app:test:      67|       expect(result.failureMessage).toContain("Upload rejected as too …
@bb/app:test:        |                                     ^
@bb/app:test:      68|       expect(result.failureMessage).toContain("35 MB");
@bb/app:test:      69|     },
@bb/app:test: 
@bb/app:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[4/5]⎯
@bb/app:test: 
@bb/app:test: 
@bb/app:test:  Test Files  1 failed (1)
@bb/app:test:       Tests  5 failed | 4 passed (9)
@bb/app:test:    Start at  04:45:25
@bb/app:test:    Duration  12.92s (transform 12.03s, setup 1.70s, import 11.00s, tests 41ms, environment 0ms)
@bb/app:test: 
@bb/app:test:  ELIFECYCLE  Test failed. See above for more details.
@bb/app#test:  ERROR  command (<temporary-work-directory>/base/apps/app) /usr/local/bin/pnpm run test --run src/components/thread/composer/useComposerAttachmentUploads.test.ts exited (1)

 Tasks:    5 successful, 6 total
Cached:    0 cached, 6 total
  Time:    16.253s 
Failed:    @bb/app#test

 ERROR  run failed: command  exited (1)
Second clean-run log
• turbo 2.10.12

   • Packages in scope: @bb/app
   • Running test in 1 packages
   • Remote caching disabled

@bb/plugin-build:generate: cache miss, executing 8547817cb3290869
@bb/templates:generate:templates: cache miss, executing 90ed396ea2c45072
@bb/process-utils:generate:profile-worker: cache miss, executing f00ba284b5432770
//:ensure-native-modules: cache bypass, force executing ced2b614b0a022e8
@bb/templates:generate:plugin-scaffold: cache miss, executing 74a882d3009ba7d4
@bb/templates:generate:templates: 
@bb/templates:generate:templates: > @bb/templates@0.0.1 generate:templates <temporary-work-directory>/verify/packages/templates
@bb/templates:generate:templates: > node ./scripts/generate-templates.mjs
@bb/templates:generate:templates: 
//:ensure-native-modules: 
//:ensure-native-modules: > bb@ ensure-native-modules <temporary-work-directory>/verify
//:ensure-native-modules: > node scripts/ensure-native-modules.mjs
//:ensure-native-modules: 
@bb/process-utils:generate:profile-worker: 
@bb/process-utils:generate:profile-worker: > @bb/process-utils@0.0.1 generate:profile-worker <temporary-work-directory>/verify/packages/process-utils
@bb/process-utils:generate:profile-worker: > node scripts/generate-profile-worker.mjs
@bb/process-utils:generate:profile-worker: 
@bb/plugin-build:generate: 
@bb/plugin-build:generate: > @bb/plugin-build@0.0.1 generate <temporary-work-directory>/verify/packages/plugin-build
@bb/plugin-build:generate: > node ./scripts/generate-plugin-theme.mjs && node ./scripts/generate-runtime-export-manifest.mjs
@bb/plugin-build:generate: 
@bb/templates:generate:plugin-scaffold: 
@bb/templates:generate:plugin-scaffold: > @bb/templates@0.0.1 generate:plugin-scaffold <temporary-work-directory>/verify/packages/templates
@bb/templates:generate:plugin-scaffold: > node ./scripts/generate-plugin-scaffold.mjs
@bb/templates:generate:plugin-scaffold: 
//:ensure-native-modules: [ensure-native-modules] Detached hardlinked better-sqlite3 binary before verification
@bb/plugin-build:generate: plugin-theme.generated.ts up to date
@bb/plugin-build:generate: host-tailwind.css up to date
@bb/plugin-build:generate: host-tailwind-version.ts up to date
@bb/plugin-build:generate: wrote <temporary-work-directory>/verify/packages/plugin-build/src/generated/runtime-export-manifest.generated.ts (react@19.3.0)
@bb/app:test: cache miss, executing a3de7f13f1c75a7c
@bb/app:test: 
@bb/app:test: > @bb/app@0.0.1 test <temporary-work-directory>/verify/apps/app
@bb/app:test: > node scripts/generate-pwa-icons.mjs --check && vitest run --config vitest.config.ts "--run" "src/components/thread/composer/useComposerAttachmentUploads.test.ts"
@bb/app:test: 
@bb/app:test: 
@bb/app:test:  RUN  v4.1.1 <temporary-work-directory>/verify/apps/app
@bb/app:test: 
@bb/app:test:  ❯ |@bb/app| src/components/thread/composer/useComposerAttachmentUploads.test.ts (9 tests | 5 failed) 36ms
@bb/app:test:      × rejects an oversized video/mp4 before upload and still attaches a valid file 17ms
@bb/app:test:      × rejects an oversized image/png before upload and still attaches a valid file 9ms
@bb/app:test:      × explains an upstream 413 with generic reason "" 4ms
@bb/app:test:      × explains an upstream 413 with generic reason "Payload Too Large" 1ms
@bb/app:test:      × explains an upstream 413 with generic reason "413" 1ms
@bb/app:test:      ✓ adds a late upload to the draft it started in after the composer moves to another draft 1ms
@bb/app:test:      ✓ adds uploads to the target that is still current 1ms
@bb/app:test:      ✓ shows the server's reason when it refuses an upload 1ms
@bb/app:test:      ✓ names failed files without a reason when the failure is not a server refusal 0ms
@bb/app:test: 
@bb/app:test: ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 5 ⎯⎯⎯⎯⎯⎯⎯
@bb/app:test: 
@bb/app:test:  FAIL  |@bb/app| src/components/thread/composer/useComposerAttachmentUploads.test.ts > uploadDraftAttachments > rejects an oversized video/mp4 before upload and still attaches a valid file
@bb/app:test:  FAIL  |@bb/app| src/components/thread/composer/useComposerAttachmentUploads.test.ts > uploadDraftAttachments > rejects an oversized image/png before upload and still attaches a valid file
@bb/app:test: AssertionError: expected "vi.fn()" to be called 1 times, but got 2 times
@bb/app:test:  ❯ src/components/thread/composer/useComposerAttachmentUploads.test.ts:40:22
@bb/app:test:      38|       });
@bb/app:test:      39|
@bb/app:test:      40|       expect(upload).toHaveBeenCalledTimes(1);
@bb/app:test:        |                      ^
@bb/app:test:      41|       expect(upload).toHaveBeenCalledWith(expect.objectContaining({ na…
@bb/app:test:      42|       expect(result.added).toEqual([uploaded]);
@bb/app:test: 
@bb/app:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/5]⎯
@bb/app:test: 
@bb/app:test:  FAIL  |@bb/app| src/components/thread/composer/useComposerAttachmentUploads.test.ts > uploadDraftAttachments > explains an upstream 413 with generic reason ""
@bb/app:test: AssertionError: expected 'Failed to attach clip.mp4: Request fa…' to contain 'Upload rejected as too large'
@bb/app:test: 
@bb/app:test: Expected: "Upload rejected as too large"
@bb/app:test: Received: "Failed to attach clip.mp4: Request failed"
@bb/app:test: 
@bb/app:test:  ❯ src/components/thread/composer/useComposerAttachmentUploads.test.ts:67:37
@bb/app:test:      65|       expect(result.added).toEqual([]);
@bb/app:test:      66|       expect(target.addAttachment).not.toHaveBeenCalled();
@bb/app:test:      67|       expect(result.failureMessage).toContain("Upload rejected as too …
@bb/app:test:        |                                     ^
@bb/app:test:      68|       expect(result.failureMessage).toContain("35 MB");
@bb/app:test:      69|     },
@bb/app:test: 
@bb/app:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/5]⎯
@bb/app:test: 
@bb/app:test:  FAIL  |@bb/app| src/components/thread/composer/useComposerAttachmentUploads.test.ts > uploadDraftAttachments > explains an upstream 413 with generic reason "Payload Too Large"
@bb/app:test: AssertionError: expected 'Failed to attach clip.mp4: Payload To…' to contain 'Upload rejected as too large'
@bb/app:test: 
@bb/app:test: Expected: "Upload rejected as too large"
@bb/app:test: Received: "Failed to attach clip.mp4: Payload Too Large"
@bb/app:test: 
@bb/app:test:  ❯ src/components/thread/composer/useComposerAttachmentUploads.test.ts:67:37
@bb/app:test:      65|       expect(result.added).toEqual([]);
@bb/app:test:      66|       expect(target.addAttachment).not.toHaveBeenCalled();
@bb/app:test:      67|       expect(result.failureMessage).toContain("Upload rejected as too …
@bb/app:test:        |                                     ^
@bb/app:test:      68|       expect(result.failureMessage).toContain("35 MB");
@bb/app:test:      69|     },
@bb/app:test: 
@bb/app:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[3/5]⎯
@bb/app:test: 
@bb/app:test:  FAIL  |@bb/app| src/components/thread/composer/useComposerAttachmentUploads.test.ts > uploadDraftAttachments > explains an upstream 413 with generic reason "413"
@bb/app:test: AssertionError: expected 'Failed to attach clip.mp4: 413' to contain 'Upload rejected as too large'
@bb/app:test: 
@bb/app:test: Expected: "Upload rejected as too large"
@bb/app:test: Received: "Failed to attach clip.mp4: 413"
@bb/app:test: 
@bb/app:test:  ❯ src/components/thread/composer/useComposerAttachmentUploads.test.ts:67:37
@bb/app:test:      65|       expect(result.added).toEqual([]);
@bb/app:test:      66|       expect(target.addAttachment).not.toHaveBeenCalled();
@bb/app:test:      67|       expect(result.failureMessage).toContain("Upload rejected as too …
@bb/app:test:        |                                     ^
@bb/app:test:      68|       expect(result.failureMessage).toContain("35 MB");
@bb/app:test:      69|     },
@bb/app:test: 
@bb/app:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[4/5]⎯
@bb/app:test: 
@bb/app:test: 
@bb/app:test:  Test Files  1 failed (1)
@bb/app:test:       Tests  5 failed | 4 passed (9)
@bb/app:test:    Start at  04:46:04
@bb/app:test:    Duration  12.68s (transform 11.85s, setup 1.48s, import 11.00s, tests 36ms, environment 0ms)
@bb/app:test: 
@bb/app:test:  ELIFECYCLE  Test failed. See above for more details.
@bb/app#test:  ERROR  command (<temporary-work-directory>/verify/apps/app) /usr/local/bin/pnpm run test --run src/components/thread/composer/useComposerAttachmentUploads.test.ts exited (1)

 Tasks:    5 successful, 6 total
Cached:    0 cached, 6 total
  Time:    15.712s 
Failed:    @bb/app#test

 ERROR  run failed: command  exited (1)