Skip to content

feat(mobile): prototype Enriched Markdown as the sole renderer - #12781

Closed
juliusmarminge wants to merge 11 commits into
mainfrom
t3code/evaluate-markdown-renderer-replacement
Closed

juliusmarminge wants to merge 11 commits into
mainfrom
t3code/evaluate-markdown-renderer-replacement

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Sep 20, 2026 •

Copy link
Copy Markdown
Member

September 24 upstream compatibility integration

Consumer 5b6a1441 carries core 7781ab17 and tint 0eca6691. The new archive includes upstream paragraph minimum-line-height behavior for tall inline code, pill baseline centering and shared Android background geometry/spoiler concealment, alongside inherited upstream fixes. Public nested pill API and T3 integration are unchanged. Font #861 is now merged; core/tint remain open. The combined integration commit is local 105fd60e2c57dfec0370ccef577c253ac9d3ec7f, retaining contributor credit.

Unique main-compat-v1.tgz contains 926 files/1,033,101 bytes, SHA256 59ba5df5492476181ecbe1ba573a1c163c4da3eaeea0431f30ed5ea235876319. Exact upstream geometry/background shipping sources were checked byte for byte. Original shipping Gradle configuration is retained. Combined 93 JS tests/14 suites, types, Bob modules/declarations/both native codegens, normal commit hooks, frozen Linux/Mac installs and mobile types pass.

The official iOS ensure rebuilt and installed this exact archive on iPhone 17 Pro/iOS 26.5, fingerprint c6809326ed4555205bcbb19db0319156b120257c. The successful retry used the previously documented host-only explicit-module/debug-symbol resource settings. An initial iOS attempt failed on disk exhaustion and supplies no proof. Authorized cleanup removed disposable download caches and stale prototype dependency caches while retaining the active package. Android's full consumer development APK passed on this exact archive, 1301 tasks; its initial attempt stopped on full Linux tmpfs before native compilation, corrected by relocating this task's Gradle cache to the main disk.

Personally inspected temporary style probes with 34px inline code and paragraph/list/quote line-height floors of 18px and 44px, below and above the pill height. Wrapped code glyphs and one pill per original link remain visible without observed overlap; the following ordinary list row stays separate. These are visual combined-consumer probes, not strict U+FFFC reference assertions. The shipping wrapper was restored byte-identical and fully reloaded afterward.

Restored shipping proof includes actual AX visible/original file and skill names, genuine discovered skill metadata, original $mobile-check clipboard, exact relative/full file clipboard, correct source-file routing, native root/quote/nested-quote/quoted-table menus and nonlink quoted-table Copy as Markdown retaining its original label and URL. An accessibility-reference long press landed on adjacent nonlink quote text; screenshot-guided presses on the actual pill verified the configured menus. The nonlink quote also retained its original link on Markdown copy. No native behavior patch was needed during this validation. No new media playback or Android device UI claim is made.

Current consumer REST metadata/target/configuration checks pass; no current-head full consumer CI or human review is claimed. Earlier captures below remain tied to their documented prior sources. Native pill XCTest and strict U+FFFC reference geometry are unwired/unrun; no VoiceOver traversal, Android UI or isolated-upstream-head device assertion.

Restored shipping wrapper with original-source file and skill accessibility names

Temporary probe: 34px inline code with an 18px line-height floor

Temporary probe: 34px inline code with a 44px line-height floor

Temporary 44px-floor probe in lists and quotes

Restored shipping wrapper: quoted-table link context menu

Mobile Markdown now uses Enriched as its only renderer. This removes the custom Markdown parser/render tree and the Nitro Markdown dependency, while keeping T3 file routing, context metadata, asset authorization, previews and playback in the mobile app.

This is a prototype for discussing the generic integration APIs with the Enriched team. The prepared Enriched package is committed as a local 1 MB tarball in apps/mobile/deps, replacing the 9,761-line pnpm patch. The original 909-file archive matched the previously verified patch byte for byte. The current 917-file archive includes the reviewed nested pill API, accessibility/metrics/cache fixes and the opt-in link-menu API; changed shipping sources match the verified combined prototype. Generic native dependency extensions are reviewable in the upstream PRs below; they contain no T3 routing, context records, branded icons, authentication or media player code. The archive includes source, built JS/types, generated native bindings and the MIT license, with its usual postinstall behavior intact. The package note explains inspection and replacement. This uses the same deps directory previously used by Nitro Markdown.

Integration APIs

Enriched API T3 integration
Existing markdownStyle.linkVariants, extended with font and nested pill boolean/configuration for geometry, presentation label, local icon URI and optional tint File, skill, context and GitHub pills. T3 decides labels, icons, accents and PR state. Original source text and URL remain native.
Optional linkRegex and inlineCodeLinkRegex, sharing the input API's regex normalization Known skill mentions and whole inline-code paths become ordinary native links. T3 supplies the recognition patterns and handles routing. Defaults remain disabled.
Optional onDocumentAssets({ revision, assets }) Builds per-URL presentation from the accepted native parse, without a second JavaScript Markdown parser. Descriptors identify occurrences, kind, URL, alt text, title and placement.
Optional linkContextMenus, keyed by original URL with title, text, icon, disabled/destructive state and JS callbacks Native anchored link menus on iOS 17+, including quote and table links. T3 supplies file/context actions; onLinkLongPress remains the fallback elsewhere.
Optional renderMedia(asset) T3 returns its existing image, SVG and video components. Native layout reserves measured slots and reports frames, including recursive quote placement. Returning null uses native rendering.
Optional resolveImageSource(asset) returning a URI and headers, synchronously or asynchronously T3 signs environment assets so native list, table, inline and linked bitmap images use the same asset access as app-owned media. Transport rewriting preserves the original Markdown URL and native callbacks.

Existing onLinkPress, onLinkLongPress and onImagePress remain the integration points for routing, fallback link menus and media previews. Configured native link menus take precedence over onLinkLongPress on iOS 17+. The packaged library handles measurement, selection and generic presentation. The app handles product actions. The remaining t3-source-text module provides only selectable source documents on iOS, with React Native Text on Android. Shared link/chip helpers and icons now live in the app, and Android’s composer chip lives in t3-composer-editor. Unused native pill/menu/copy machinery from t3-markdown-text has been removed.

Upstream work

Separate agents prepared focused upstream PRs using existing library conventions. The font/pill/tint layers preserve Ernest's font cleanup and example; upper layers link their dependencies and layer-only comparisons. The current consumer archive integrates core 3ba9ea74 and tint e3e7b18e, including maintainer font feedb0b0.

  • #848: embedded MD4C symbol/header isolation, closed without merge.
  • #849: semantic super/subscript in iOS Copy as Markdown, merged.
  • #855: consumer-controlled native link recognition, open, ready for review.
  • #856: accepted native document asset manifest, closed without merge.
  • #857: optional native image source resolution, closed without merge.
  • #858: consumer-owned media slots, closed without merge.
  • #859: recursive quote media placement, closed without merge.
  • #861: per-link-variant font family, merged September 24.
  • #862: opt-in native pill labels, local icons and geometry, open, ready for review.
  • #863: optional native pill icon tint, open, ready for review.
  • #865: opt-in per-link native context menus, open, ready for review.

These statuses were refreshed September 23, 2026. Closed proposals remain prototype-only extensions in the archive; they are not represented as accepted upstream APIs or refiled. Existing hourly review/CI follow-up continues for open PRs and settles owning threads once their PRs are merged or closed. Nothing is being merged by this prototype task.

September 23 verification and limits

Current consumer cf0dc9b3 migrates the app's single variant hook to nested pill configuration and replaces the prepared dependency archive. Combined generic source is committed locally as 0f05b38e7fc788e0f1282d7ed75fed545032414d; no combined branch was published on the fork. Archive pill-review-v2.tgz is 1,025,248 bytes/917 files, SHA256 569ae48ad0efd93946a9ed5726f98228bcfdf7554418639e3a4f1bb191ec9f53. Its 681 production source files match the committed combined source byte for byte, excluding the combined worktree's local Android unit-test Gradle harness. Existing shipping Gradle configuration is retained.

Passed: 88 combined-library JS tests/13 suites, library types, Bob modules/declarations, both native code generators, normal library commit hooks, frozen installation and grammar restoration on Linux and Mac, mobile typecheck, scoped lint, 19 focused app tests, release smoke and normal consumer commit hooks. The full Android development APK compiles the new native resolver/cache/accessibility/renderer sources. That build used the immediately preceding archive revision; the final archive changes only an iOS header import order, so all compiled Android/JS sources are byte-identical. The Android Device panel still fails to boot its emulator; there is no Android UI proof.

The official native-client ensure rebuilt and installed the final archive on iPhone 17 Pro/iOS 26.5, fingerprint 8df81c7cdd3c7f4f179c23194c324d409120e471. The first build failed because the Mac ran out of disk. After authorized disposable-cache cleanup, the successful retry used host-only XCODE_XCCONFIG_FILE settings disabling explicit Clang/Swift modules and debug-symbol generation to reduce temporary disk use; development behavior and repository build configuration were unchanged.

Personally inspected the restored shipping wrapper: one visual pill per link in root text, inline code, quotes/nested quotes and tables/quoted tables; local icons and GitHub tint; actual accessibility nodes include shortened file label plus original path and Mobile Check, $mobile-check. Verified original skill-token clipboard, relative/full file-path clipboard, file routing, native anchored root/quote/table menus, and nonlink quoted-table Copy as Markdown preserving the original link destination. Temporary known-skill-input and public pill:false probes were restored byte for byte; final shipping captures use real discovered skill metadata. Signed native list/table/linked images, SVG and video previews render. No new end-to-end video playback claim is made. A dropped task SSH tunnel was restored and backend reachability confirmed before the final healthy capture.

These are combined-consumer results. Phone-width rendering was inspected visually; the strict single-U+FFFC reference geometry tests were not executed. No claim is made that every resource URI/cache-pressure branch was exercised.

Current-head REST checks were refreshed after verification: metadata/target/configuration checks pass, CodeRabbit skips this draft, and the main consumer CI run is not observed. No current-head full-CI or human-review pass is claimed. Shared GraphQL quota was exhausted, so older-thread resolution was not independently verified. Preceding consumer 703927c1 passed 14 checks with 4 skipped; that does not establish current-head CI. Upstream core/tint native iOS and Android build jobs pass, but core still has the preceding CHANGES_REQUESTED review and needs maintainer rereview. Native XCTest sources remain unwired/unrun and native test-lane wiring is maintainer-owned. No isolated-upstream-head device proof, VoiceOver traversal, older-iOS/macOS runtime, library example or Maestro pass is claimed. This consumer PR remains a draft.

React media slots support standalone direct media at the root and recursively inside quotes. Inline/list/table/linked images retain native rendering and use the source resolver for signed access. Native decoding does not add SVG/video support in those placements. Occurrence IDs survive ordinary trailing appends; arbitrary edits and reference reclassification may renumber them. Asynchronous decisions are guarded by document identity, revision and width.

Known clipboard limits remain: linked-image Copy as Markdown loses its enclosing link, and the pill-spanning fixture omitted emphasis markers inferred from font traits. Original file destinations, skill tokens and link URLs were preserved. Android keeps its app-owned fallback link menu; the generic anchored native menu API is iOS 17+.

September 23 reviewed-pill consumer proof

Restored shipping app: file and skill pills, original-source accessibility labels

Native anchored menu on a quoted-table file link

Signed native images in list, table and linked placements

Temporary public pill:false probe: original text and ordinary links restored

Root native menu and relative-path copy: https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/e3831edb1a867683/t3-enriched-pill-review-actions-relative.mp4

File pill tap opens the source viewer: https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/3a39bc5f58b99b3c/t3-enriched-pill-review-actions-routing.mp4

Initial renderer comparison

These captures use the same original fixture and viewport, before the expanded pills/media fixture was added.

Before, custom renderer:

Before: custom mobile Markdown renderer

After, initial Enriched replacement:

After: initial Enriched mobile renderer

Earlier combined media example

Final combined iOS signed native table and linked bitmap images

Final combined iOS native client, fingerprint 04fe792ea85df13a3fab2f2b9a3c91596ebfc860:

Final combined iOS chat with duplicate signed PNG slots

Final combined iOS SVG slot and app-owned video preview

Both video syntaxes after playing to their final frame on the final iOS client

Final combined iOS SVG and two-video playback recording

Final Enriched Markdown file preview with code, table and quoted SVG

Nested quote image opened in the actual iOS QuickLook preview

Earlier pill proof

Combined consumer iOS fingerprint 04fe792ea85df13a3fab2f2b9a3c91596ebfc860, including the final ordinary-text glyph optimization. This is app integration proof, not isolated upstream-head proof.

Final combined iOS native pills: one visual per link, shortened file labels and skill names

Final file-pill routing and long-press action recording

Source-only module after cleanup

iOS source attachment: whole-file selection with syntax colors

The iOS clipboard exactly matched the original six-line source fixture. This evidence uses the combined consumer build after the module cleanup, not an isolated upstream head.

Earlier anchored native link-menu proof

Before, the Enriched prototype's JS action sheet:

Before: JS file-link action sheet

After, native anchored menu with JS actions, final combined iOS fingerprint 8e87eff1da695f5c12f0e666884a623725704e4d:

After: native anchored file-link menu

Native menu relative-path copying and file-viewer navigation

Temporary quoted-table fixture on the same native client:

Configured link menu inside a quoted table

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XXL 1,000+ changed lines (additions + deletions). 📱 Native Change Changes the native fingerprint; merging blocks production OTAs until a new store build ships. labels Sep 20, 2026
@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.5 KiB 13.5 KiB +2 B (+0.0%) 15.1 KiB ✅
Codex Thread snapshot wire 7.1 KiB 7.0 KiB −11 B (−0.2%) 7.3 KiB ✅
Codex Live turn WebSocket wire 6.4 KiB 6.5 KiB +13 B (+0.2%) 7.8 KiB ✅
Codex Live turn WebSocket decoded 56.2 KiB 56.3 KiB +44 B (+0.1%) 66.4 KiB ✅
Codex Live turn messages 9 10 +1 (+11.1%) 21 ✅
Claude Total thread wire 13.5 KiB 13.5 KiB −8 B (−0.1%) 15.1 KiB ✅
Claude Thread snapshot wire 7.1 KiB 7.1 KiB −8 B (−0.1%) 7.3 KiB ✅
Claude Live turn WebSocket wire 6.4 KiB 6.4 KiB 0 B (0.0%) 7.8 KiB ✅
Claude Live turn WebSocket decoded 57.0 KiB 57.0 KiB 0 B (0.0%) 66.4 KiB ✅
Claude Live turn messages 9 9 0 (0.0%) 21 ✅

Baseline: fa1e171 · PR result: 703927c · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 113.9 KiB
  • Claude decoded thread snapshot: 114.7 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 1, 2026 — with ChatGPT Codex Connector
@juliusmarminge

Copy link
Copy Markdown
Member Author

Thanks for working on this. We merged the orchestrator V2 rewrite in #2829, and we are closing this PR as part of that transition.

The patch conflicts with the rewrite in apps/mobile/src/features/threads/ThreadFeed.tsx. Even where the conflict is small enough to rebase, we are asking for fresh PRs against the new base so we can review and verify the behavior in V2.

Sorry for the extra work this creates. If the change is still needed on V2, please rebuild it on current main, verify it there, and open a new PR linking back here. We're closing the current implementation without assuming the underlying request is resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews 📱 Native Change Changes the native fingerprint; merging blocks production OTAs until a new store build ships. size:XXL 1,000+ changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant