Skip to content

Support 200 MiB Journal asset transfers - #187

Merged
RCmerci merged 6 commits into
mainfrom
journal-asset-200mib
Nov 25, 2026
Merged

RCmerci merged 6 commits into
mainfrom
journal-asset-200mib

Conversation

@RCmerci

@RCmerci RCmerci commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Raises the Worker Put/Fetch, per-file cache, codec, Core and C/Swift AES-GCM limits to 200 MiB. Keeps the 64 MiB shared reservation for smaller transfers; larger transfers reserve it exclusively. Wire payloads over 100 MiB use Logseq prepare/direct PUT/complete without forwarding the managed bearer token to the signed URL.

Host: full source build passed; the codec accepted exactly 200 MiB and rejected +1 byte; reservation regressions passed. macOS native crypto decoded upstream fixtures up to 8 MiB and rejected 200 MiB + 1; the adapter fixture stopped before network in key setup.

iOS Simulator: final HEAD built, installed and launched on a fresh iPhone 17 Pro / iOS 26.1. Experimental host-restamp; no full iOS ABI claim. This is launch evidence, not UI transfer acceptance. The production app fixes its sync origin and auth provider, so no loopback transfers were exercised under the no-new-harness constraint. No real device, personal graph, or production upload was used. Keep draft until full-size transfer verification.

@RCmerci
RCmerci marked this pull request as ready for review November 25, 2026 07:36
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T07:39:10.746681Z 37e2f90 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 37e2f90944

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

{ asset = ticket.asset
; version = ticket.version
; maximum_plaintext_bytes = 8 * 1024 * 1024
; maximum_plaintext_bytes = 200 * 1024 * 1024

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve concurrent admission for small production transfers

For ordinary journal images, this change serializes downloads regardless of their actual size. The production worker now always passes a 200 MiB limit, while fetch_asset reserves asset_wire_bytes maximum_plaintext_bytes + maximum_plaintext_bytes; with_byte_reservation consequently acquires the entire 64 MiB semaphore for every request, including tiny thumbnails. Previously, the 8 MiB limit allowed multiple downloads to overlap. The upload path also always requests the full reservation, so a background upload blocks foreground image downloads. Separate the supported file-size ceiling from transfer admission so small production transfers retain concurrent progress.

Useful? React with 👍 / 👎.

|| List.length headers <> List.length (List.sort_uniq String.compare (List.map fst headers))
then Error "Invalid signed asset upload plan"
else (
match perform { request with uri; headers } with

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Extend the transport deadline for newly supported large uploads

For large uploads on typical mobile connections, the new direct PUT still uses Http_eio.perform, which initializes a fixed 30-second budget and wraps the entire request write and response wait in Eio.Time.with_timeout_exn (http_eio.ml:140). A 200 MiB plaintext upload at 10 Mbit/s needs roughly 168 seconds before encryption overhead, so it is deterministically cancelled and reported as a network failure despite being within the newly accepted size limit; retries encounter the same deadline. Use a size-aware transfer deadline or an inactivity timeout for asset bodies rather than retaining the small-request total deadline.

Useful? React with 👍 / 👎.

let local_store
?(asset_cache_budget_bytes = 268435456L)
?(asset_maximum_file_bytes = 8 * 1024 * 1024)
?(asset_maximum_file_bytes = 200 * 1024 * 1024)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Raise the durable upload-intent limit alongside the staging limit

For imports larger than 100 MiB and at most 200 MiB, the increased staging limit accepts and copies the file, but the production import workflow still rejects it before any upload. prepare_import_unlocked passes the staged size to Asset_upload_intent.prepare, whose validation in logseq_db_types/lib/asset_upload_intent.ml:52 still rejects size > 104857600L; the worker then releases the staged file and returns "Invalid asset upload intent". Consequently, the application's durable import/upload path cannot reach the new large-file transfer support. Update the intent validation and its checkpoint decoding path consistently with the new ceiling.

Useful? React with 👍 / 👎.

@RCmerci

RCmerci commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

iOS Simulator loopback validation of PR head 37e2f90944ebbab6aef965c72acec2a6fda73d1f: PASS, using the production OCaml reducer and effect runner in an external synthetic Journal host on arm64 iOS Simulator 26.1. Requests used the real Eio/Httpun transport, certificate-pinned TLS 1.3, and a local disk-backed fake origin/object store. The encrypted run used the production Apple crypto adapter with a synthetic key. Only host entry/link configuration changed in the external fixture; production runner sources and the PR worktree were untouched.

Plaintext bytes Raw PUT / GET body bytes Encrypted PUT / GET body bytes
25,165,824 (24 MiB) 25,165,824 each 33,554,483 each
209,715,200 (200 MiB) 209,715,200 each 279,620,315 each

Every request returned HTTP 200. Both exact-200-MiB runs performed prepare POST (115 request / 409 response bytes) → fixture HMAC-signed PUT (no bearer forwarded) → complete POST (116 / 0 bytes) → GET. Each downloaded file matched the staged plaintext size and SHA-256: 5f8388332b3af5f17de76df125818ae3f19df2d294d91a073c4d0422f36ced35 (24 MiB), db0e6cbbe829827e344133442cb0a34e30cc815880f6f6ffae06721ea703d4fd (200 MiB). A staged file grown to 209,715,201 bytes was rejected by the runner as Asset_size_rejected, before token acquisition; no request was emitted (therefore no HTTP 413). A separate out-of-range caller budget was rejected at the reducer as Asset_cancelled.

Local evidence: /tmp/pr187-loopback/ (raw.simulator.log, raw.origin.jsonl, encrypted.simulator.log, encrypted.origin.jsonl; build manifests build/run-i9m0cvv3/manifest.json and build/run-l9j7jn0i/manifest.json). Harness: source/app/native_embed.ml, origin.py, run.sh. Experimental host restamp; cross_abi_validated=false. This is synthetic Simulator transport evidence, not validation of real S3/SigV4, app UI, device ABI/performance, or a release gate. No merge or release.

@RCmerci
RCmerci merged commit ddfd490 into main Nov 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant