Skip to content

fix: return Catalyst HTTP exception responses from MockHTTP tests #1652

Closed

Description

@fglock

Parent: #1117. The HTTP::Message and LWP suites pass after PR #1641, but Catalyst Runtime 5.90132's HTTP exception acceptance path still fails on PerlOnJava.

What was done and why it was not enough

PR #1641 fixed the confirmed HTTP::Message-adjacent bzip2 output limit and interpreter zlib constant import defects and added focused unit tests. The unchanged HTTP::Message and LWP suites now pass. That coverage does not exercise Catalyst's HTTP exception responses, which travel through a PSGI response callback and then HTTP::Response->from_psgi.

Reproduction

Run t/http_exceptions_backcompat.t or t/http_exceptions.t from the Catalyst-Runtime 5.90132 distribution with the JVM backend. Both reach Plack::Test::MockHTTP::request and die with:

Can't call method "request" on an undefined value at Plack/Test/MockHTTP.pm line 29

t/http_exceptions_backcompat.t completes two assertions before aborting. t/http_exceptions.t completes 11 of its planned 17 assertions before aborting. System Perl passes both files (29 tests total) with the same installed prerequisites.

Root cause and proposed fix

The Catalyst PSGI app's HTTP-exception response reaches Plack::Test::MockHTTP::request line 24, which passes it to HTTP::Response->from_psgi. The conversion returns undef, then line 29 dereferences it. In HTTP::Message::PSGI::res_from_psgi, the CODE response branch records $res only when the responder callback runs; it returns $res immediately after invoking the PSGI callback. If Catalyst supplies a delayed/streaming responder form, that callback has not populated $res yet. Trace the exact response shape from Catalyst, then make the PerlOnJava path complete the response conversion for that supported PSGI form (or report unsupported asynchronous responses explicitly instead of returning undef).

Acceptance criteria

  • Confirm the exact PSGI response shape from the failing Catalyst exception action and compare it with system Perl.
  • Fix response conversion so it returns a valid HTTP::Response for the supported response form and preserves callback/body semantics.
  • Pass both tests on JVM and interpreter, including all 17 planned assertions in t/http_exceptions.t.
  • Rerun the Catalyst HTTP consumer selection required by Restore HTTP::Message 7.04 compatibility #1117.

Activity

  1. fglock commented on Oct 5, 2026

    @fglock
    OwnerAuthor

    System Perl baseline established after opening this follow-up. With the distribution's installed prerequisites and loopback access, standard Perl passes both files: t/http_exceptions_backcompat.t and t/http_exceptions.t, 29 tests total. The JVM rerun of the same files in the Catalyst consumer batch aborts in Plack::Test::MockHTTP::request after two assertions in the backcompat test and 11 assertions in http_exceptions.t, before the rest of its 17 planned tests.

  2. fglock commented on Oct 15, 2026

    @fglock
    OwnerAuthor

    Follow-up from merged PR #1815: t/http_exceptions.t and t/http_exceptions_backcompat.t now pass on system Perl, JVM, and interpreter (29 assertions total). The new direct HTTP::Message::PSGI callback and streaming response regression test also passes on both PerlOnJava backends. The full jcpan -t Catalyst::Runtime selection remains unconfirmed: three bounded runs (3600 seconds once, 5400 seconds twice) timed out before the full suite summary, after 35–36 files on the longer runs. Leaving this issue open until the complete Catalyst acceptance selection finishes.

  3. fglock commented on Oct 23, 2026

    @fglock
    OwnerAuthor

    Resolved by merged PR #1872. The complete Catalyst::Runtime 5.90132 suite now passes under PerlOnJava: 200 files and 3,820 tests, including both HTTP exception acceptance files and the upload cleanup regression. Closing as completed.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions