Skip to content

[NFR]: Serve request history in ADR apps #43

Closed

Description

@niden

Summary

Request history works only in MVC. Make it work in ADR apps, with no change to the application routes.

Why ADR needs a different mechanism

  • MVC selects the controller on application:beforeHandleRequest. ADR does not fire this event, and it has no MVC dispatcher.
  • A listener on application:beforeHandle cannot stop handle().
  • A listener on application:afterHandle runs after the application routing and the error responder. This is too late.

Proposed direction

  • Add a package ADR Action (Phalcon\Contracts\ADR\Action) that calls the handler from [NFR]: Extract a neutral history handler from HistoryController #42.
  • Decorate Phalcon\Contracts\ADR\Router\Router through extend() on the container:
    • The history URL returns new RouterMatch($actionClass).
    • All other URLs go to the inner router.
    • The decorator implements all 9 contract methods and forwards them to the inner router, including the 4 setters that Application::handle() calls. Phalcon\ADR\Router\Router is final, so a subclass is not possible.
  • The ADR service provider from [NFR]: Framework-neutral integration seam: boot and response injection without Mvc\Application #14 registers history when history.enabled is set. It also registers the Action in the container with its dependencies.
  • The existing HistoryEndpoint::matches() guard stops injection on the history response.

Notes

  • Global middleware also runs for this Action. For example, phalcon/vokuro-adr has RememberMeLogin.
  • The history URL replaces an application route with the same path, as it does in MVC. [NFR]: History Panel enhancements #32 tracks this.
  • A probe confirmed the decorator for GET and DELETE on the history URL, and for other URLs.
  • The router extend() must run before the container resolves the router, because extend() on a resolved service throws CannotExtendResolved. The application must not resolve the router during registration.

Acceptance

  • An ADR app can list, read and clear history.
  • The history panel shows in an ADR app.
  • A denied client gets a 404 from the history URL.
  • Other URLs reach the application routes with no change.
  • History in phalcon/vokuro still works.
  • Tests pass with full coverage. phpcs and phpstan pass.

Depends on

Part of

#13

Activity

  1. self-assigned this
    on Nov 3, 2026
  2. added theissue type on Nov 3, 2026
  3. moved this from Backlog to Active Sprint in Phalcon v5on Nov 3, 2026
  4. niden commented on Nov 5, 2026

    @niden
    SponsorMemberAuthor

    Resolved in #59

  5. moved this from Active Sprint to Implemented in Phalcon v5on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

  • Status
    Implemented

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions