Skip to content

Wrangler keepNames breaks serialized native storage read and restore realms #776

Closed

Description

@kamilio

Confirmed exact production-provider failure

With public @poe-platform/safe-bash@0.1.690 bundled by normal Wrangler defaults, native Cloudflare navigation to https://example.com succeeds, then the automatic owned storage checkpoint fails:

Native storage origin operation failed: ReferenceError: __name is not defined
    at collectStorageOrigin (<anonymous>:8:35)

Exact evidence: /tmp/poe2-playwright-690-cloud-storage.log, deployed worker 44465a2d.

The package serializes collectStorageOrigin.toString() and restoreOrigin.toString() into an isolated browser realm. Wrangler's default keepNames transform inserts references to a bundle-scoped __name helper into nested functions. The serialized function body does not carry that outer helper into the browser realm. The native fixture's keepNames: false build did not exercise production bundling.

Required behavior

Both read and restore expressions must be self-contained after supported consumer bundling, including keepNames: true and minification. Use maintained generated literal realm sources, preserving the typed canonical implementation and verifying generation stays synchronized. Do not require a consumer-specific bundler flag or private API workaround. Add a genuine compiler-differential regression that bundles with naming helpers and executes both expressions in a fresh realm, then verify the public release and real Cloudflare worker.

Activity

  1. self-assigned this
    on Sep 18, 2026
  2. kamilio commented on Sep 18, 2026

    @kamilio
    MemberAuthor

    Claimed for the focused producer fix: compiler-differential keepNames/minified fresh-realm reproduction, generated literal read/restore sources synchronized with typed canonical implementations, then remote main and verified public release. No consumer-specific bundler flags or private API workaround.

  3. kamilio commented on Sep 18, 2026

    @kamilio
    MemberAuthor

    The confirmed collectStorageOrigin Wrangler failure is fixed on verified remote main (98db897d2fd627943befcd809e393e6c9de3042c).

    Browser read and restore expressions now use generated string literals from canonical typed functions. The guarded package build rejects missing or stale generated sources before emission. The native source/installed fixtures now preserve names, matching the consumer bundling behavior.

    Validation:

    • Original compiler differential reproduced the read failure under keepNames:true: __name undefined without minification and renamed m undefined with minification. Restore already passed this exact old-shape regression; no restore failure is claimed.
    • Updated focused source suite:93 passing tests,0 failures.
    • Guarded build suite:356 passing tests,0 failures, including synchronized-literal checks and existing held-path controls.
    • Focused changed-file guarded lint authenticates the maintained25 receipt boundaries; nine changed TS/MJS subjects pass with0 errors/warnings. This is not a full-root lint gate.
    • SOURCE ONLY actual Wrangler/Cloudflare worker 7cbc7d71-1015-42fb-be26-868952c1aaf7: automatic checkpoints, cookie/localStorage/IndexedDB replacement and empty clearing, live tab IDs/selection/sessionStorage preservation, standard console/requests clear and cancellation pass. Separate controller/KV browser-recreation probe preserves closed-origin IDB and clears after raw SDK census. This is controller restart, not an isolate/DO cold restart.

    Public scoped release and overlay-free consumer verification remain a separate publication milestone.

  4. kamilio commented on Sep 18, 2026

    @kamilio
    MemberAuthor

    Public lockstep @poe-platform/safe-fs, safe-js, and safe-bash@0.1.691 is verified from source 98db897d2fd627943befcd809e393e6c9de3042c.

    Scoped release fully succeeded: https://github.com/poe-platform/poe-code/actions/runs/35382645670

    The maintained publication gate downloaded public archives, authenticated SHA-512 and provenance source, performed a fresh registry installation, and checked public imports. Independently authenticated Safe Bash archive:9,729,914 bytes; sha512-pz/EfvyLkiIlzlu9MT21vkMCsWgThfkVgYs5WASvifIMszZCybtg4g/aWkR4X/vSwK1JYEI+dyEXgNME+eW0yg==.

    Exact installed public archive compiler differential:6/6 pass with keepNames:true, both minified and unminified, and both read/restore expressions evaluated in fresh realms. The same archive harness reproduces the prior0.1.690 read failure (__name, renamed helper h); restore passes for that prior exact shape as well. Supported public reader import/runtime and strict installed consumer types pass.

    The consumer is repeating its production Wrangler storage and controller/KV probes without source overlays. The source-only Cloudflare probes described above remain separately identified.

  5. kamilio commented on Sep 18, 2026

    @kamilio
    MemberAuthor

    The separately monitored ordinary application release exposed an omitted compiler-helper dependency in the maintained synthetic committed-archive verification snapshot. Its explicit reviewed input list omitted scripts/generate-native-storage-sources.mjs, so the synthetic compiler failed module resolution before continuity/alias controls could run. The failed job log is retained as evidence; this did not affect the fully verified public safe-package0.1.691 archive.

    Follow-up verified on remote main: f77bb0504474f0927f3ea652eb680c04024e7741. Two QA files explicitly include the helper in the existing bounded committed input list and fixture, with archive membership/read assertions.

    Focused regression fails before the list correction. Full owning archive-control file passes221/221; focused two-file guarded lint authenticates25 receipt boundaries and passes with0 findings. Package implementation and public0.1.691 provenance source remain unchanged.

    Replacement ordinary application release: https://github.com/poe-platform/poe-code/actions/runs/35384920131 . The already-failed superseded application run was cancelled to release its serialized queue; the original failed shard and red/green evidence were preserved.

    Consumer's overlay-free public0.1.691 Cloudflare storage and controller/KV probes also pass. That consumer PR remains separately owned and is not a claim of merged or production rollout.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions