Skip to content

fix: harden scaffold, native text reads, and macOS ZIP packaging - #69

Merged
justjavac merged 8 commits into
mainfrom
milky/dev
Jul 30, 2026
Merged

fix: harden scaffold, native text reads, and macOS ZIP packaging#69
justjavac merged 8 commits into
mainfrom
milky/dev

Conversation

@Milky2018

Copy link
Copy Markdown
Contributor

Summary

  • keep the generated shared/contract module target-neutral instead of restricting it to native builds
  • make caller-owned native text reads retry when the value grows between the length query and buffer read
  • generate macOS ZIP archives with the final .app basename and without __MACOSX or AppleDouble metadata entries

Background

Several independent correctness issues remained in generated projects and native/package boundaries:

  • the scaffolded shared module is consumed by both frontend and backend targets, so a native-only target restriction makes the generated isomorphic project invalid
  • caller-owned text APIs use a length-query/read protocol; mutable native state can grow between those calls, causing a legitimate second call to return PROTON_ERROR_BUFFER_TOO_SMALL
  • macOS packaging staged the bundle under a hidden .staging.app name and used ditto --sequesterRsrc --keepParent, which preserved the temporary root name and intentionally added __MACOSX metadata to the archive

Implementation

  • remove target restrictions from the shared scaffold template and cover the generated manifests
  • centralize caller-owned text extraction in a retrying MoonBit helper, preserving bounded failure behavior and applying it to native state and notification reads
  • stage macOS bundles inside a hidden staging directory while keeping the child bundle's final name, then archive with ditto --norsrc --keepParent
  • clean up the complete staging directory after promotion or failure
  • add regression coverage for growing caller-owned values and macOS ZIP entry layout

Impact

Generated isomorphic projects keep their contracts available to every consumer target. Native reads no longer turn a normal size race into an application startup failure. macOS ZIP artifacts now contain the expected application root and no hidden staging root, __MACOSX, or ._ entries; the .app itself is unchanged.

Validation

  • moon -C cli test -p justjavac/proton_cli/package --target native --no-parallelize --diagnostic-limit 80
  • moon -C cli check --target native --diagnostic-limit 80
  • moon fmt --check
  • git diff --check
  • packaged examples/47_dev_extension_js as .app and .zip
  • inspected ZIP entries with zipinfo -1
  • extracted the generated ZIP and verified the app with codesign --verify --deep --strict --verbose=2

Centralize variable-length native text reads and retry buffer negotiation when mutable state grows between calls.
Stage app bundles under their final names and omit AppleDouble resource-fork metadata from generated ZIP archives.
@Milky2018
Milky2018 marked this pull request as ready for review July 30, 2026 10:18
proton_engine_bridge_pending_cancel still referenced the pre-rename
g_bridge_pending symbol, breaking the win32 engine build (C2065).
Resolve overlaps between the bridge cancellation/origin work and main:

- invokeOp (win/mac/linux): keep the 5-arg action dispatch, validate
  page_instance via the shared proton_engine_bridge_page_instance_is_valid
  helper from cef_common/bridge_json.h.
- notification poll click: keep the read_native_text refactor, which
  also covers the exact-span decode hardening from main.
- scaffold shared module: drop supported_targets (target-neutral) and
  keep preferred_target js so bare moon check uses a proven backend.
- regenerate cli/new/templates.generated.mbt.
@justjavac
justjavac merged commit 2a2a221 into main Jul 30, 2026
4 checks 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.

2 participants