Skip to content

Commit b7bf8c9

Browse files
test(contracts): pin file attachment reads above the upload cap
The reader regression test decoded a fixed 75 MB file. Once the upload cap rises to 100 MB that value sits under the cap and no longer proves that a reader tolerates files a newer build accepted. Derive it from the cap, and note on the schema why sizeBytes has no upper bound. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent df3e34c commit b7bf8c9

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

‎packages/contracts/src/orchestration.test.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
ThreadTurnStartRequestedPayload,
3636
SnapShotAccessibility,
3737
isProviderSendTurnSupportedImageMimeType,
38+
PROVIDER_SEND_TURN_MAX_FILE_BYTES,
3839
} from "./orchestration.ts";
3940
import { ProviderInstanceId } from "./providerInstance.ts";
4041

@@ -376,8 +377,10 @@ it.effect("rejects malformed known attachment types instead of tolerating them",
376377
updatedAt: "2026-01-01T00:00:00.000Z",
377378
});
378379

379-
const largeFile = yield* decode({ ...base, type: "file", sizeBytes: 75_000_000 });
380-
assert.strictEqual(largeFile.attachments?.[0]?.sizeBytes, 75_000_000);
380+
// A newer build may raise the upload cap; this build must still read those files.
381+
const aboveUploadCap = PROVIDER_SEND_TURN_MAX_FILE_BYTES + 1;
382+
const largeFile = yield* decode({ ...base, type: "file", sizeBytes: aboveUploadCap });
383+
assert.strictEqual(largeFile.attachments?.[0]?.sizeBytes, aboveUploadCap);
381384

382385
const emptyFile = yield* Effect.exit(decode({ ...base, type: "file", sizeBytes: 0 }));
383386
assert.strictEqual(Exit.isFailure(emptyFile), true);

‎packages/contracts/src/orchestration.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,9 @@ export const ChatFileAttachment = Schema.Struct({
318318
id: ChatAttachmentId,
319319
name: TrimmedNonEmptyString.check(Schema.isMaxLength(255)),
320320
mimeType: TrimmedNonEmptyString.check(Schema.isMaxLength(100)),
321+
/** No upper bound: history and thread streams can carry files that a newer
322+
build accepted under a higher limit. `AttachmentCreateUploadUrlInput`
323+
enforces the upload cap. */
321324
sizeBytes: NonNegativeInt.check(Schema.isGreaterThanOrEqualTo(1)),
322325
/** Clipboard text folded by a client. Providers keep these path-only so the
323326
agent can inspect the file selectively instead of eagerly spending the

0 commit comments

Comments
 (0)