Skip to content

Ticket #228: native prompt attachment size — verification ​

  • Date: 2026-11-11
  • Ticket: #228, found by #227
  • Branch: ticket/228-attachment-size
  • Base: integration/native-first at 5ebd5ba

Root cause ​

The live host carries a prompt file body in data (standard base64, sometimes wrapped in a base64 data URL). nativePromptAttachments() only read the probe-normalized dataLength field plus bytes/size, so a real host payload became size: 0.

Fix ​

  • Prefer a positive explicit bytes, size, or dataLength.
  • Otherwise derive the decoded length from data without copying or storing the payload: standard base64 padding is accounted for, and a base64 data URL is accepted.
  • Clamp every reported size to the attachment file bound (ATTACHMENT_MAX_FILE_BYTES). The chip is metadata only; no bytes, uri, data, or source path enters the durable row.

Tests ​

  • src/v2/attachments.test.ts: a data-only prompt file yields a positive size; a base64 data URL yields the same size; explicit fields win; an oversized explicit value is clamped; the serialized chip carries no payload or path.
  • src/v2/service.test.ts (ticket228): a native session.inbox.enqueued payload with only data produces a durable user row whose chip is { name, mime, kind, size > 0 }, and the serialized row contains neither the base64 payload, the file bytes, the source directory, nor a store path.

Commands and results ​

CommandResult
npm run verifyPass — strict typecheck; 1801 tests passed, 0 failed, 0 skipped.
npm run test:live:native-firstPass — main 65/65 checks, restart 16/16 checks; the attachment check passes. One recorded gap remains: #230 shadow-mode comparison.

The live run used the isolated fake host and the public driver from #227. No conversation content, attachment bytes, paths, or credentials are in this record.

Released under the MIT License.