Skip to content

feature: implement new dispatchers - #63

Draft
rustatian wants to merge 9 commits into
mainfrom
feature/exceptions-impl
Draft

feature: implement new dispatchers#63
rustatian wants to merge 9 commits into
mainfrom
feature/exceptions-impl

Conversation

@rustatian

@rustatian rustatian commented Aug 3, 2026

Copy link
Copy Markdown
Member

Reason for This PR

  • Dispatcher implementation.

Description of Changes

  • Add missing __construct methods. Regenerate stubs.
  • Fix PHP 8.6 upcoming change with XtOffsetOf.

License Acceptance

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

PR Checklist

[Author TODO: Meet these criteria.]
[Reviewer TODO: Verify that these criteria are met. Request changes if not]

  • All commits in this PR are signed (git commit -s).
  • The reason for this PR is clearly provided (issue no. or explanation).
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this PR.
  • Any user-facing changes are mentioned in CHANGELOG.md.
  • All added/changed functionality is tested.

Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
@rustatian rustatian self-assigned this Aug 3, 2026
@rustatian rustatian added the enhancement New feature or request label Aug 3, 2026
@rustatian rustatian moved this from Backlog to In progress in RapiraRS Kanban board Aug 3, 2026
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added dispatcher-based PHP request handling with blocking and nonblocking receives, timeout support, request counters, and graceful shutdown.
    • Added HTTP request and response APIs, including headers, bodies, streaming, cancellation, finalization, and status handling.
    • Added readonly address, TLS, multipart, form, upload, and request value objects with validation.
  • Bug Fixes
    • Improved request timeout management and worker recovery after stalled or abandoned requests.
    • Added response body limits and truncation handling for safer processing.
  • Tests
    • Expanded coverage for dispatcher behavior, HTTP values, timeouts, response handling, and lifecycle scenarios.

Walkthrough

The PR adds dispatcher-mode serving with bounded request intake, PHP HTTP value objects, request and response exchange handling, timer control, worker lifecycle cleanup, workspace metadata, PHP build support, and comprehensive integration tests.

Changes

Dispatcher runtime and PHP HTTP integration

Layer / File(s) Summary
Workspace and build wiring
.clang-tidy, Cargo.toml, Makefile, crates/php_sys/..., crates/runtime/..., crates/scoreboard/...
Workspace version and edition settings are centralized. The Makefile gains a PHP build target. The PHP extension build injects its version and compiles the new HTTP sources.
PHP HTTP objects and Zend registration
crates/php_sys/rapira*.stub.php, crates/php_sys/rapira*_arginfo.h, crates/php_sys/rapira_classes.*, crates/php_sys/rapira_http.c
Address, TLS, multipart, upload, request, dispatcher, and exchange classes gain constructors, typed properties, registration metadata, and object lifecycle handlers.
Dispatcher and exchange bridge
crates/php_sys/rapira_dispatcher.c, crates/php_sys/rapira_exchange.c, crates/php_sys/src/exchange.rs, crates/php_sys/wrapper.h
Dispatcher methods receive jobs and expose counters. Exchanges map request fields, validate response operations, write heads and bodies, enforce finalization rules, and emit response frames.
Rust intake and worker lifecycle
crates/php_sys/src/handler.rs, crates/php_sys/src/start.rs, crates/php_sys/src/rapira_worker.rs, crates/php_sys/src/types.rs, crates/php_sys/module.c
Request intake uses bounded synchronous channels and pending counters. Worker cycles track served and closed states. Receive timers are disarmed while waiting and restored per request.
Dispatcher fixtures and integration validation
crates/tests/fixtures/dispatcher/*, crates/tests/fixtures/http_values/*, crates/tests/tests/*, src/main.rs
Fixtures and tests cover dispatcher identity, receive states, request mapping, response behavior, timeouts, recycling, HTTP value objects, and migration to dispatcher mode.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant RapiraHandle
  participant IntakeChannel
  participant Dispatcher
  participant Exchange
  participant Worker
  Client->>RapiraHandle: submit request
  RapiraHandle->>IntakeChannel: enqueue timestamped job
  Dispatcher->>IntakeChannel: receive job
  Dispatcher->>Exchange: create exchange
  Exchange->>Worker: expose request and response operations
  Worker->>Exchange: write head and body
  Exchange->>Client: emit finalized response
Loading

Possibly related PRs

  • rapira-rs/rapira#61 — Introduced the dispatcher and PHP class-registration code extended by this PR.
  • rapira-rs/rapira#62 — Added related PHP registration and dispatcher infrastructure.
  • rapira-rs/rapira#31 — Contains overlapping worker startup, execution-mode, and job-intake changes.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: implementing new dispatcher functionality.
Description check ✅ Passed The description includes all required sections, explains the main changes, accepts the license, and marks all checklist items complete.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/exceptions-impl
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feature/exceptions-impl

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the PHP-facing surface of Rapira by adding missing __construct definitions to HTTP value types and tightening “host-created only” construction semantics, with accompanying regenerated stub/arginfo outputs and new PHP fixtures to exercise the behavior.

Changes:

  • Add missing __construct signatures to HTTP value objects (e.g., InetAddress, Request, Multipart) and regenerate corresponding arginfo.
  • Mark internal HTTP classes as host-created via private constructors in stubs (and add fixtures that assert construction/cloning behavior).
  • Update .clang-tidy to use a curated check set instead of the previous default.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/tests/fixtures/http_values/construct.php New fixture exercising construction/readonly/type/arity constraints for HTTP value objects.
crates/tests/fixtures/dispatcher/worker-singleton.php New fixture checking dispatcher singleton/cloning behavior and logging properties.
crates/tests/fixtures/dispatcher/host-created-only.php New fixture asserting internal dispatcher is not user-constructible.
crates/php_sys/rapira.stub.php Clarifies Dispatcher interface doc comment about plugin narrowing.
crates/php_sys/rapira_http.stub.php Adds missing constructors for HTTP value types; marks internal HTTP classes host-created via private constructors.
crates/php_sys/rapira_http_arginfo.h Regenerated arginfo to reflect new constructors and method tables.
crates/php_sys/rapira_arginfo.h Regenerated stub hash metadata.
.clang-tidy Switches to curated clang-tidy checks list (and updates formatting).
Suppressed comments (1)

.clang-tidy:9

  • This PR description focuses on adding missing PHP __construct methods / regenerating stubs, but it also changes the default clang-tidy check set (from the previous survey-mode default to a curated list). If intentional, it should be called out in the PR description (or split into a separate PR) because it can change local/CI lint behavior.
Checks: >
  bugprone-*,

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/tests/fixtures/dispatcher/host-created-only.php Outdated
Comment thread .clang-tidy Outdated
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.11765% with 42 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/php_sys/src/handler.rs 49.01% 26 Missing ⚠️
crates/php_sys/src/exchange.rs 97.33% 8 Missing ⚠️
crates/php_sys/src/start.rs 87.93% 7 Missing ⚠️
crates/php_sys/src/callbacks.rs 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@rustatian
rustatian requested a balanced review from Copilot August 6, 2026 20:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated no new comments.

Suppressed comments (5)

crates/php_sys/wrapper.h:30

  • bool requires a visible definition (typically via <stdbool.h>). Since this header is reused across translation units, add #include <stdbool.h> before using bool (or switch the declaration to a PHP/Zend type like zend_bool) to avoid compilation failures on toolchains where PHP headers don't provide bool.
extern bool rapira_worker_mode;
sapi_globals_struct *rapira_sg(void);

crates/php_sys/rapira_dispatcher.c:184

  • These internal constructors throw but don’t RETURN_THROWS(). Add RETURN_THROWS(); after zend_throw_error(...) (or otherwise immediately return in the same pattern used elsewhere in this file) so the engine always sees a clear “exceptional return” path for these internal methods.
ZEND_METHOD(Rapira_Internal_Http_Dispatcher, __construct) {
    zend_throw_error(NULL, "host-created; obtain it from \\Rapira\\get_dispatcher()");
}

ZEND_METHOD(Rapira_Internal_Http_DispatcherInfo, __construct) {
    zend_throw_error(NULL, "host-created");
}

ZEND_METHOD(Rapira_Internal_Http_Exchange, __construct) {
    zend_throw_error(NULL, "host-created");
}

crates/php_sys/rapira_dispatcher.c:199

  • The new "not implemented" errors are very generic and will be hard to debug in userland (especially now that get_dispatcher() can succeed). Consider including the concrete method name and actionable guidance in the message (e.g., which mode/feature gate is required, or that Exchange verbs are not available yet) so failures are self-explanatory.
ZEND_METHOD(Rapira_Internal_Http_Dispatcher, tryReceive) {
    zend_throw_error(NULL, "not implemented");
    RETURN_THROWS();
}

ZEND_METHOD(Rapira_Internal_Http_Dispatcher, receive) {
    zend_throw_error(NULL, "not implemented");
    RETURN_THROWS();
}

ZEND_METHOD(Rapira_Internal_Http_Dispatcher, getInfo) {
    zend_throw_error(NULL, "not implemented");
    RETURN_THROWS();
}

crates/php_sys/src/start.rs:66

  • The previous doc comment here explained important lifecycle/teardown semantics for worker-side start. Replacing it with a terse comment loses key context for maintainers; please restore a concise doc comment describing the contract (module startup/teardown expectations, thread lifecycle, and how it differs from fused start).
    // worker side part
    pub fn start_worker(mode: Mode, hooks: WorkerHooks) -> anyhow::Result<Self> {
        let WorkerHooks {

crates/php_sys/src/handler.rs:15

  • The PR removes the API-level documentation for RapiraHandle (shutdown contract and lifecycle expectations). Since this is a public type, restoring a shorter version of that doc (or moving it into module-level docs) would preserve important usage guarantees without bloating the file.
#[derive(Clone)]
pub struct RapiraHandle {
    intake: mpsc::Sender<Job>,

Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
@rustatian rustatian changed the title chore: add missed __construct's feature: implement new dispatchers Aug 9, 2026
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
@rustatian rustatian added this to the v0.7.0 milestone Aug 12, 2026
@rustatian

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/main.rs (1)

135-141: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update the stale comment: the non-classic branch now selects Dispatcher.

The comment names Worker as the non-classic mode, but line 140 constructs Mode::Dispatcher. The two statements now contradict each other.

📝 Proposed comment correction
-    // Both forms run the same worker model; --classic only changes whether the script is
-    // re-included per request (Classic) or stays resident (Worker).
+    // Both forms run the same worker model; --classic only changes whether the script is
+    // re-included per request (Classic) or stays resident and pulls units from the
+    // dispatcher (Dispatcher).
     let mode = if settings.pool.classic {
         Mode::Classic
     } else {
         Mode::Dispatcher(script.clone())
     };
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main.rs` around lines 135 - 141, Update the comment above the mode
selection to describe the non-classic branch as Dispatcher rather than Worker,
while preserving the explanation that --classic controls whether the script is
re-included per request or remains resident.
crates/php_sys/src/types.rs (1)

139-147: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Restore the invariant documentation on Context and StreamState.

This PR removes the doc comments that recorded the StreamState progression, its invariant, the Context field roles, the is_truncated rule, and the sealing contract of finish. The same PR adds a second writer to that state: crates/php_sys/src/exchange.rs sets ctx.head and ctx.stream = StreamState::HeadSent directly (lines 361-362 and 386-390) and deliberately bypasses Context::commit_head. It also relies on finish sending exactly one Frame and dropping the sender.

Two independent code paths now depend on these unwritten rules. Restore the invariants as doc comments on StreamState, Context, is_truncated, and finish, so the classic path and the Exchange path share one written contract.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/php_sys/src/types.rs` around lines 139 - 147, Restore documentation
comments for the StreamState progression and invariant, Context field roles, the
is_truncated rule, and finish’s sealing contract. Anchor the comments to the
StreamState definition, Context struct, is_truncated, and finish, explicitly
covering direct head/stream updates in exchange.rs and that finish sends exactly
one Frame before dropping the sender.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/php_sys/rapira_exchange.c`:
- Around line 232-246: Update the header-building loop around
rapira_rs_exchange_header to preserve repeated names: look up an existing list
in headers and append value.ptr/value.len to it, otherwise create and insert a
new list. Keep zend_symtable key handling so digit-only names retain integer-key
behavior, and stop replacing previously accumulated values.

In `@crates/php_sys/rapira_http.c`:
- Around line 195-250: Update the TLS assignment in the request-construction
function around zend_update_property(..., "tls") to explicitly handle tls ==
NULL, storing a PHP null value instead of passing the null C pointer to the
property writer. Preserve the existing object assignment for non-null TLS
objects and retain exception checking after the property update.

In `@crates/php_sys/src/exchange.rs`:
- Around line 71-78: Update reclaim_current to emit
sb_update(Event::Handled(true)) and perform the associated quota::tick() when
reclaiming an unfinalized Unit::Handling pointer, while preserving the existing
drop behavior. Do not charge Unit::Sealed; distinguish the two variants so only
the unfinalized handling unit updates the scoreboard before being reclaimed.

In `@crates/php_sys/src/handler.rs`:
- Around line 55-92: Replace the Full branch in handle with cancellable async
admission or semaphore-based queueing; remove the per-request spawn_blocking
retry loop, deadline, and sleep. Preserve bounded backpressure and return the
existing worker-pool-stopped-or-saturated error when admission fails or the
worker pool disconnects.

In `@crates/php_sys/src/rapira_worker.rs`:
- Around line 98-117: The dispatcher path must emit exactly one
scoreboard::Event::Recycled whenever it returns Cycle::Recycle, and emit
scoreboard::Event::Healthy when served_any() is true before returning
Cycle::Restart after a shutdown bailout. Update the dispatcher cycle-handling
logic around the visible Cycle::Stop/Cycle::Recycle/Cycle::Failed branches,
preserving existing Healthy behavior and ensuring the events are emitted on
every applicable return path.

In `@crates/php_sys/src/start.rs`:
- Around line 93-99: Replace the joke SAFETY comment above the assignment to
crate::rapira_mode in start_worker with a precise invariant: start_worker is
called only once per process, and rapira_mode is fully initialized before the
spawned worker thread or C code can read it. Preserve the existing write and
unsafe block unless converting the value to an atomic is necessary.

In `@crates/tests/tests/timeout_tests.rs`:
- Around line 107-116: Remove the #[ignore] attribute from
max_execution_time_fires_on_rearmed_jobs so the dispatcher-based timeout test
runs in CI. Keep the existing Mode::Dispatcher setup and test behavior
unchanged.
- Around line 36-42: Update the timeout test around the loop over "/first" and
"/second" so it verifies the worker has entered its receive state before the
two-second sleep, using a readiness signal or a completed warm-up exchange.
Ensure the timed idle intervals begin only after that synchronization, while
preserving the existing drain and per-unit timer assertions.

---

Outside diff comments:
In `@crates/php_sys/src/types.rs`:
- Around line 139-147: Restore documentation comments for the StreamState
progression and invariant, Context field roles, the is_truncated rule, and
finish’s sealing contract. Anchor the comments to the StreamState definition,
Context struct, is_truncated, and finish, explicitly covering direct head/stream
updates in exchange.rs and that finish sends exactly one Frame before dropping
the sender.

In `@src/main.rs`:
- Around line 135-141: Update the comment above the mode selection to describe
the non-classic branch as Dispatcher rather than Worker, while preserving the
explanation that --classic controls whether the script is re-included per
request or remains resident.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 25308c16-6c0c-44c0-83c5-f37a166851a7

📥 Commits

Reviewing files that changed from the base of the PR and between 9e6e04b and 98c6044.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (53)
  • .clang-tidy
  • Cargo.toml
  • Makefile
  • crates/api/Cargo.toml
  • crates/config/Cargo.toml
  • crates/master/Cargo.toml
  • crates/php_sys/Cargo.toml
  • crates/php_sys/allowed_bindings.rs
  • crates/php_sys/build.rs
  • crates/php_sys/module.c
  • crates/php_sys/rapira.stub.php
  • crates/php_sys/rapira_arginfo.h
  • crates/php_sys/rapira_classes.c
  • crates/php_sys/rapira_classes.h
  • crates/php_sys/rapira_dispatcher.c
  • crates/php_sys/rapira_exchange.c
  • crates/php_sys/rapira_http.c
  • crates/php_sys/rapira_http.stub.php
  • crates/php_sys/rapira_http_arginfo.h
  • crates/php_sys/src/callbacks.rs
  • crates/php_sys/src/exchange.rs
  • crates/php_sys/src/handler.rs
  • crates/php_sys/src/lib.rs
  • crates/php_sys/src/rapira_worker.rs
  • crates/php_sys/src/scoreboard.rs
  • crates/php_sys/src/start.rs
  • crates/php_sys/src/types.rs
  • crates/php_sys/wrapper.h
  • crates/runtime/Cargo.toml
  • crates/runtime/src/lib.rs
  • crates/scoreboard/Cargo.toml
  • crates/tests/fixtures/dispatcher/echo-loop-worker.php
  • crates/tests/fixtures/dispatcher/host-created-only.php
  • crates/tests/fixtures/dispatcher/recv-probes-worker.php
  • crates/tests/fixtures/dispatcher/request-worker.php
  • crates/tests/fixtures/dispatcher/verbs-worker.php
  • crates/tests/fixtures/dispatcher/worker-singleton.php
  • crates/tests/fixtures/http_values/construct.php
  • crates/tests/src/lib.rs
  • crates/tests/tests/async_tests.rs
  • crates/tests/tests/basic_tests.rs
  • crates/tests/tests/dispatcher.rs
  • crates/tests/tests/dispatcher_loop.rs
  • crates/tests/tests/extension_tests.rs
  • crates/tests/tests/failboot_worker_tests.rs
  • crates/tests/tests/general_tests.rs
  • crates/tests/tests/http_values.rs
  • crates/tests/tests/observer_teardown_tests.rs
  • crates/tests/tests/observer_tests.rs
  • crates/tests/tests/php_ext_tests.rs
  • crates/tests/tests/ported_tests.rs
  • crates/tests/tests/timeout_tests.rs
  • src/main.rs
💤 Files with no reviewable changes (1)
  • crates/php_sys/src/scoreboard.rs
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: test (ubuntu-latest, 8.5)
🧰 Additional context used
🪛 checkmake (0.3.2)
Makefile

[warning] 75-75: Target body for "php" exceeds allowed length of 5 lines (13).

(maxbodylength)

🪛 Cppcheck (2.21.0)
crates/php_sys/rapira_classes.c

[error] 7-7: syntax error

(syntaxError)

crates/php_sys/module.c

[style] 85-85: The function 'rapira_exchange_from' is never used.

(unusedFunction)


[style] 93-93: The function 'rapira_dispatcher_info_from' is never used.

(unusedFunction)


[style] 79-79: The function 'PHP_RSHUTDOWN_FUNCTION' should have static linkage since it is not used outside of its translation unit.

(staticFunction)


[style] 162-162: The function 'rapira_receive_untimed' is never used.

(unusedFunction)


[style] 176-176: The function 'rapira_receive_timed' is never used.

(unusedFunction)

crates/php_sys/rapira_exchange.c

[error] 78-78: There is an unknown macro here somewhere. Configuration is required. If ZEND_PARSE_PARAMETERS_START is a macro then please configure it.

(unknownMacro)

crates/php_sys/rapira_http.c

[error] 32-32: There is an unknown macro here somewhere. Configuration is required. If ZEND_PARSE_PARAMETERS_START is a macro then please configure it.

(unknownMacro)

🪛 PHPMD (2.15.0)
crates/php_sys/rapira.stub.php

[warning] 75-75: Avoid variables with short names like $ip. Configured minimum length is 3. (undefined)

(ShortVariable)


[warning] 78-78: Avoid variables with short names like $ip. Configured minimum length is 3. (undefined)

(ShortVariable)


[warning] 78-78: Avoid unused parameters such as '$ip'. (undefined)

(UnusedFormalParameter)


[warning] 78-78: Avoid unused parameters such as '$port'. (undefined)

(UnusedFormalParameter)


[warning] 91-91: Avoid unused parameters such as '$path'. (undefined)

(UnusedFormalParameter)

crates/php_sys/rapira_http.stub.php

[warning] 24-24: Avoid unused parameters such as '$version'. (undefined)

(UnusedFormalParameter)


[warning] 25-25: Avoid unused parameters such as '$cipher'. (undefined)

(UnusedFormalParameter)


[warning] 26-26: Avoid unused parameters such as '$negotiatedProtocol'. (undefined)

(UnusedFormalParameter)


[warning] 27-27: Avoid unused parameters such as '$requestedServerName'. (undefined)

(UnusedFormalParameter)


[warning] 28-28: Avoid unused parameters such as '$certSerial'. (undefined)

(UnusedFormalParameter)


[warning] 29-29: Avoid unused parameters such as '$certOrganization'. (undefined)

(UnusedFormalParameter)


[warning] 30-30: Avoid unused parameters such as '$certFingerprint'. (undefined)

(UnusedFormalParameter)


[warning] 48-48: Avoid unused parameters such as '$name'. (undefined)

(UnusedFormalParameter)


[warning] 48-48: Avoid unused parameters such as '$value'. (undefined)

(UnusedFormalParameter)


[warning] 48-48: Avoid unused parameters such as '$headers'. (undefined)

(UnusedFormalParameter)


[warning] 69-69: Avoid unused parameters such as '$name'. (undefined)

(UnusedFormalParameter)


[warning] 70-70: Avoid unused parameters such as '$clientFilename'. (undefined)

(UnusedFormalParameter)


[warning] 71-71: Avoid unused parameters such as '$clientMediaType'. (undefined)

(UnusedFormalParameter)


[warning] 72-72: Avoid unused parameters such as '$headers'. (undefined)

(UnusedFormalParameter)


[warning] 73-73: Avoid unused parameters such as '$tmpPath'. (undefined)

(UnusedFormalParameter)


[warning] 74-74: Avoid unused parameters such as '$size'. (undefined)

(UnusedFormalParameter)


[warning] 91-91: Avoid unused parameters such as '$fields'. (undefined)

(UnusedFormalParameter)


[warning] 91-91: Avoid unused parameters such as '$files'. (undefined)

(UnusedFormalParameter)


[warning] 115-127: The method __construct has 11 parameters. Consider reducing the number of parameters to less than 10. (undefined)

(ExcessiveParameterList)


[warning] 116-116: Avoid unused parameters such as '$method'. (undefined)

(UnusedFormalParameter)


[warning] 117-117: Avoid unused parameters such as '$uri'. (undefined)

(UnusedFormalParameter)


[warning] 118-118: Avoid unused parameters such as '$target'. (undefined)

(UnusedFormalParameter)


[warning] 119-119: Avoid unused parameters such as '$authority'. (undefined)

(UnusedFormalParameter)


[warning] 120-120: Avoid unused parameters such as '$protocol'. (undefined)

(UnusedFormalParameter)


[warning] 121-121: Avoid unused parameters such as '$headers'. (undefined)

(UnusedFormalParameter)


[warning] 122-122: Avoid unused parameters such as '$body'. (undefined)

(UnusedFormalParameter)


[warning] 123-123: Avoid unused parameters such as '$remote'. (undefined)

(UnusedFormalParameter)


[warning] 124-124: Avoid unused parameters such as '$server'. (undefined)

(UnusedFormalParameter)


[warning] 125-125: Avoid unused parameters such as '$tls'. (undefined)

(UnusedFormalParameter)


[warning] 126-126: Avoid unused parameters such as '$receivedAt'. (undefined)

(UnusedFormalParameter)

🪛 PHPStan (2.2.7)
crates/tests/fixtures/dispatcher/echo-loop-worker.php

[warning] 5-5: While loop condition is always true.

(while.alwaysTrue)

crates/tests/fixtures/dispatcher/host-created-only.php

[warning] 4-4: Call to new Rapira\Internal\Http\Dispatcher() on a separate line has no effect.

(new.resultUnused)


[warning] 4-4: Cannot instantiate class Rapira\Internal\Http\Dispatcher via private constructor Rapira\Internal\Http\Dispatcher::__construct().

(new.privateConstructor)

crates/tests/fixtures/dispatcher/worker-singleton.php

[warning] 6-6: Expression "clone $d" on a separate line does not do anything.

(expr.resultUnused)


[warning] 8-8: Dead catch - Error is never thrown in the try block.

(catch.neverThrown)


[warning] 19-19: Instanceof between Rapira\Dispatcher and Rapira\Dispatcher will always evaluate to true.
If Rapira\Dispatcher::name() is impure, add @phpstan-impure PHPDoc tag above its declaration. Learn more: https://phpstan.org/blog/remembering-and-forgetting-returned-values

(instanceof.alwaysTrue)

crates/tests/fixtures/http_values/construct.php

[warning] 35-35: Cannot access property $fields on Rapira\Http\Multipart|string.

(property.nonObject)


[warning] 35-35: Cannot access property $fields on Rapira\Http\Multipart|string.

(property.nonObject)


[warning] 36-36: Cannot access property $files on Rapira\Http\Multipart|string.

(property.nonObject)


[warning] 36-36: Cannot access property $files on Rapira\Http\Multipart|string.

(property.nonObject)


[warning] 37-37: Cannot access property $certSerial on Rapira\Http\Tls|null.

(property.nonObject)


[warning] 37-37: Cannot access property $negotiatedProtocol on Rapira\Http\Tls|null.

(property.nonObject)


[warning] 43-43: Readonly property Rapira\Http\Request::$method is assigned outside of its declaring class.

(property.readOnlyAssignOutOfClass)


[warning] 45-45: Dead catch - Error is never thrown in the try block.

(catch.neverThrown)


[warning] 50-50: Call to new Rapira\Http\Request() on a separate line has no effect.

(new.resultUnused)


[warning] 50-50: Class Rapira\Http\Request constructor invoked with 1 parameter, 11 required.

(arguments.count)


[warning] 57-57: Call to new Rapira\Http\Request() on a separate line has no effect.

(new.resultUnused)


[warning] 57-57: Parameter #8 $remote of class Rapira\Http\Request constructor expects Rapira\InetAddress|Rapira\UnixAddress, string given.

(argument.type)

crates/tests/fixtures/dispatcher/request-worker.php

[warning] 7-7: While loop condition is always true.

(while.alwaysTrue)

crates/tests/fixtures/dispatcher/verbs-worker.php

[warning] 39-39: Dead catch - Error is never thrown in the try block.

(catch.neverThrown)


[warning] 132-132: While loop condition is always true.

(while.alwaysTrue)

crates/php_sys/rapira.stub.php

[warning] 75-75: Class Rapira\InetAddress has an uninitialized readonly property $ip. Assign it in the constructor.

(property.uninitializedReadonly)


[warning] 76-76: Class Rapira\InetAddress has an uninitialized readonly property $port. Assign it in the constructor.

(property.uninitializedReadonly)


[warning] 89-89: Class Rapira\UnixAddress has an uninitialized readonly property $path. Assign it in the constructor.

(property.uninitializedReadonly)

crates/php_sys/rapira_http.stub.php

[warning] 110-110: Class Rapira\Http\Request has an uninitialized readonly property $remote. Assign it in the constructor.

(property.uninitializedReadonly)


[warning] 111-111: Class Rapira\Http\Request has an uninitialized readonly property $server. Assign it in the constructor.

(property.uninitializedReadonly)


[warning] 112-112: Class Rapira\Http\Request has an uninitialized readonly property $tls. Assign it in the constructor.

(property.uninitializedReadonly)


[warning] 113-113: Class Rapira\Http\Request has an uninitialized readonly property $receivedAt. Assign it in the constructor.

(property.uninitializedReadonly)

🔇 Additional comments (55)
.clang-tidy (1)

2-20: LGTM!

Cargo.toml (1)

3-4: LGTM!

Also applies to: 31-33

Makefile (1)

18-18: LGTM!

Also applies to: 65-88

crates/api/Cargo.toml (1)

3-4: LGTM!

crates/config/Cargo.toml (1)

3-4: LGTM!

crates/master/Cargo.toml (1)

3-4: LGTM!

crates/php_sys/Cargo.toml (1)

3-4: LGTM!

Also applies to: 13-13

crates/php_sys/allowed_bindings.rs (1)

13-16: LGTM!

crates/php_sys/build.rs (1)

41-53: LGTM!

Also applies to: 89-97

crates/php_sys/module.c (1)

1-9: LGTM!

Also applies to: 79-93, 156-182, 551-559

crates/php_sys/src/lib.rs (1)

9-9: LGTM!

Also applies to: 47-51

crates/php_sys/wrapper.h (2)

38-64: LGTM!

Also applies to: 89-91


66-87: 🎯 Functional Correctness

Keep the typedef declarations.

crates/php_sys/wrapper.h contains one declaration of each type. No removal is required.

			> Likely an incorrect or invalid review comment.
crates/tests/fixtures/dispatcher/echo-loop-worker.php (1)

1-16: LGTM!

crates/tests/fixtures/dispatcher/host-created-only.php (1)

1-10: LGTM!

crates/tests/fixtures/dispatcher/recv-probes-worker.php (1)

1-25: LGTM!

crates/tests/fixtures/dispatcher/request-worker.php (1)

1-29: LGTM!

crates/tests/fixtures/dispatcher/verbs-worker.php (1)

1-139: LGTM!

crates/tests/fixtures/dispatcher/worker-singleton.php (1)

1-21: LGTM!

crates/tests/src/lib.rs (1)

57-57: LGTM!

crates/tests/tests/async_tests.rs (1)

8-8: LGTM!

Also applies to: 24-24, 50-50, 97-97, 119-121, 172-172, 215-215, 252-252, 300-302, 352-352, 366-366, 387-387

crates/tests/tests/basic_tests.rs (1)

46-46: LGTM!

Also applies to: 62-62, 88-88, 123-123, 145-147, 187-187, 225-225, 262-262, 310-312, 370-370, 400-400, 421-423, 477-477, 511-513, 545-547, 587-589, 616-618, 661-661, 698-700, 715-717, 741-743, 772-774, 798-800, 814-816, 860-862

crates/tests/tests/php_ext_tests.rs (1)

9-9: LGTM!

crates/tests/fixtures/http_values/construct.php (1)

1-64: LGTM!

crates/tests/tests/dispatcher.rs (1)

4-4: LGTM!

Also applies to: 34-66, 68-84

crates/tests/tests/dispatcher_loop.rs (1)

1-415: LGTM!

crates/tests/tests/extension_tests.rs (1)

77-79: LGTM!

Also applies to: 154-156, 212-214, 314-316

crates/tests/tests/failboot_worker_tests.rs (1)

20-22: LGTM!

Also applies to: 50-52

crates/tests/tests/general_tests.rs (1)

33-33: LGTM!

Also applies to: 64-64, 94-96, 130-130, 157-159, 190-192, 220-222, 249-251, 271-273, 294-296, 336-338, 357-359

crates/tests/tests/http_values.rs (1)

1-35: LGTM!

crates/tests/tests/observer_teardown_tests.rs (1)

23-25: LGTM!

crates/tests/tests/observer_tests.rs (1)

22-24: LGTM!

crates/tests/tests/ported_tests.rs (1)

84-86: LGTM!

Also applies to: 148-150, 178-180, 220-220, 320-320, 330-332, 367-369, 409-409, 488-490, 510-510, 571-573, 646-646, 666-666, 701-703, 731-733, 755-757, 844-844, 870-872

crates/php_sys/rapira.stub.php (1)

42-45: LGTM!

Also applies to: 67-93

crates/php_sys/rapira_arginfo.h (1)

40-54: LGTM!

Also applies to: 84-93, 140-173

crates/php_sys/rapira_classes.h (1)

6-11: LGTM!

Also applies to: 27-51, 53-70, 72-80, 82-99

crates/php_sys/rapira_exchange.c (1)

21-27: LGTM!

Also applies to: 30-51, 56-73, 75-147, 149-198, 202-216, 248-283

crates/php_sys/rapira_http.c (1)

7-27: LGTM!

Also applies to: 29-54, 56-101, 103-123, 125-162, 164-178, 180-194

crates/php_sys/rapira_http_arginfo.h (1)

2-46: LGTM!

Also applies to: 85-87, 97-105, 123-136, 146-170, 189-189, 198-205, 217-221, 273-273, 297-297, 341-341, 363-363, 412-430

crates/php_sys/rapira_classes.c (1)

5-85: LGTM!

Also applies to: 106-179

crates/php_sys/rapira_dispatcher.c (1)

4-4: LGTM!

Also applies to: 20-25, 72-82, 93-105, 173-204, 206-250, 252-271

crates/scoreboard/Cargo.toml (1)

3-4: LGTM!

crates/php_sys/rapira_http.stub.php (3)

22-31: LGTM!

Also applies to: 47-48, 67-75, 90-91


223-225: 🔒 Security & Privacy

Reachability path
● Entry
  crates/runtime/src/lib.rs:164
  to_request: Carried as raw bytes, like every other header value: php-src takes the
│
▼
● Hop
  crates/php_sys/src/exchange.rs:473
  state
│
▼
● Hop
  crates/php_sys/src/handler.rs:48
  handle: Bounded: spawn_blocking tasks cannot be cancelled and the
│
▼
● Sink
  crates/php_sys/rapira_http.stub.php

No change is required. The generated arginfo registers the Dispatcher, DispatcherInfo, and Exchange constructors as private.


110-127: 🗄️ Data Integrity & Integration

No change required. The generated arginfo contains both fully qualified address types, and C code assigns both remote and server.

crates/php_sys/src/exchange.rs (2)

98-146: LGTM!

Also applies to: 192-233, 240-256, 261-318, 371-409, 411-430, 435-465, 467-527


334-366: 🔒 Security & Privacy

Reachability path
● Entry
  crates/php_sys/src/rapira_worker.rs:120
  rapira_worker: Can't run PHP. Answer one queued job with 503, then loop to
│
▼
● Hop
  crates/php_sys/src/start.rs:71
  start_worker: SAFETY: safe, trust me, I'm a developer
│
▼
● Hop
  crates/php_sys/src/handler.rs:48
  handle: Bounded: spawn_blocking tasks cannot be cancelled and the
│
▼
● Sink
  crates/php_sys/src/exchange.rs

The C caller already screens Exchange response headers. writeHead rejects invalid names with wire_token and rejects CR, LF, and NUL in values with wire_value before calling rapira_rs_exchange_write_head; no Rust-side change is required.

crates/php_sys/src/handler.rs (1)

1-4: LGTM!

Also applies to: 19-42, 101-114

crates/runtime/src/lib.rs (1)

194-194: LGTM!

crates/php_sys/src/callbacks.rs (1)

17-20: LGTM!

Also applies to: 73-82, 97-102, 117-121, 194-196, 230-233, 285-290, 322-322, 333-333, 345-345, 354-357, 400-401, 442-442, 460-461, 476-476

crates/php_sys/src/rapira_worker.rs (1)

68-78: LGTM!

Also applies to: 154-156

crates/php_sys/src/start.rs (1)

2-7: LGTM!

Also applies to: 17-28, 42-42, 70-70, 86-92, 100-112, 172-192, 194-205, 207-236, 238-257, 259-264

crates/php_sys/src/types.rs (2)

64-64: LGTM!

Also applies to: 241-241


12-12: 🎯 Functional Correctness

No Mode::Worker references remain.

			> Likely an incorrect or invalid review comment.
crates/runtime/Cargo.toml (1)

3-4: 📐 Maintainability & Code Quality

No manifest change is required.

The root Cargo.toml defines version and edition under [workspace.package], so both inherited keys are valid.

			> Likely an incorrect or invalid review comment.

Comment thread crates/php_sys/rapira_exchange.c
Comment thread crates/php_sys/rapira_http.c
Comment thread crates/php_sys/src/exchange.rs
Comment thread crates/php_sys/src/handler.rs
Comment thread crates/php_sys/src/rapira_worker.rs
Comment thread crates/php_sys/src/start.rs
Comment thread crates/tests/tests/timeout_tests.rs
Comment thread crates/tests/tests/timeout_tests.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

2 participants