Skip to content

hono fixture: r1 regressed from 200 to 404 after v0.5.722 dynamic-dispatch override probe #632

Closed

Description

@proggeramlug

Summary

After v0.5.722's dynamic-dispatch override probe (#620 followup), the hono-basic fixture's first request regressed: previously r1.status=200 / r1.body={"hello":"world"}; now r1.status=404 / r1.body=not found. r2 and r3 also return 404. New [PERRY WARN] js_box_get: invalid box pointer 0x0 warnings appear on each request.

Repro

tests/release/packages/hono-basic/entry.ts from #603 — see issue body. Pre-v0.5.722 produced r1=200 + silent exit on r2 (Fatal error from #628). Post-v0.5.722 dispatches all 3 calls but matches none.

Bisection

The dynamic-dispatch override fix is correct in isolation: test_628_dyn.ts (interface-typed receiver with this.method = X override) now matches Node byte-for-byte. Other dispatch tests (test_628.ts, test_603_smartrouter_mock.ts, test_603_sr_loop.ts, the cross-module SmartRouter mock at /tmp/repro_xmod) all match Node.

But hono regressed. The js_box_get: invalid box pointer 0x0 warnings hint at a closure-capture interaction the probe may have broken — perhaps the probe call's IR ordering disturbs an SSA value's dominance, or the new blocks cause a phi-edge mismatch in some call path.

Suggested investigation

  1. Compare LLVM IR for app.get("/", handler) registration before and after v0.5.722 — does the handler get stored differently?
  2. Check whether the route-registration this.router.add(...) call from app.get lands in the dynamic-dispatch path. If so, my override probe runs there too. The probe is supposed to be a no-op when the receiver has no override, but may be perturbing something.
  3. Trace whether matchResult[0] is empty (route not registered) vs non-empty (route registered but dispatch fails).

Acceptance

tests/release/packages/hono-basic/out produces the expected:

r1.status=200
r1.body={"hello":"world"}
r2.status=200
r2.body={"id":"42","name":"User 42"}
r3.status=404
r3.body=not found

Environment

  • Perry 0.5.722
  • macOS arm64

Refs #603 (acceptance fixture), #620 (override probe), v0.5.722 (where this regressed).

Activity

  1. proggeramlug commented on May 9, 2026

    @proggeramlug
    ContributorAuthor

    Closed in v0.5.726. Bisected to a missing IMPLICIT_THIS bind in v0.5.722's override path (and v0.5.716's static fast-path #620 fix). Both paths called js_native_call_value(stored_method, args) without setting IMPLICIT_THIS to the receiver — fine for arrow / .bind()-bound methods that capture their own this, but broken for regular stored methods like hono's class RegExpRouter { match = match; } where the imported standalone match body reads this.buildAllMatchers(). Without the bind, the body saw stale IMPLICIT_THIS (or undefined) and the route lookup silently failed.

    Fix: save/set/restore IMPLICIT_THIS around the js_native_call_value call in both paths. Mirrors the pre-existing closure-call fallthrough at lower_call.rs:2607 (issue #519).

    Hono fixture r1 flips 404 → 200 matching expected. r3 (/missing) correctly 404 with "not found". r2 (/users/:id param route) still returns 404 — separate path-regex/param-extraction issue not blocked on this fix.

  2. added a commit that references this issue on May 9, 2026
    82e75b8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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