Skip to content

Support pre-dispatch hook registration in app! #434

Open

Description

@prk-Jr

Description

Core pre-dispatch hooks landed in PR #403, but app! still accepts only state and owns_logging keyword arguments; crates/edgezero-macros/src/app.rs:33. Application authors must reconstruct the generated router to install a hook while retaining routes, middleware, state, manifest/store/logging metadata and app identity.

Steps to reproduce

Attempt to register a pre-dispatch hook using app! keyword syntax. The parser rejects an unknown argument. Compare the manual workaround/tests from #403 and enumerate every generated surface the replacement must preserve.

Expected behavior

An optional documented app! hook argument installs the existing pre-dispatch hook while preserving generated behavior and legacy invocation syntax.

Impact

Manual reconstruction repeats routing/metadata configuration and is easy to drift when generated application surfaces change.

Proposed fix

Extend only app! argument parsing and builder generation using the existing hook registration contract. Specify value/Arc and duplicate registration behavior, and test continuation/terminal paths plus preservation of generated surfaces. No runtime-specific dependency belongs in core/macros.

Done when

  • Define and document an optional macro argument for hook installation, including value/Arc behavior and duplicate-registration semantics.
  • Existing macro syntax and generated application behavior remain compatible.
  • Tests demonstrate terminal and continuation behavior and preservation of every generated metadata/router surface.
  • No runtime-specific dependencies enter core or macros.

Related

Activity

  1. self-assigned this
    on Oct 22, 2026
  2. added theissue type on Oct 22, 2026
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

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions