Repository navigation
refactor(hyperlane): route field accessors through Data macros - #45
Merged
Merged
Conversation
Minor version bump for the accessor refactor and the new body parser. - 21.12.1 -> 21.13.0, minor bump as defined by `crate bump --minor` - `[workspace.package].version` is the single source of truth: all eight members use `version.workspace = true` - `crate sync` realigned the nine `[workspace.dependencies]` entries, and is idempotent on a second run 🤖 Generated with [Hermes](https://hermes-agent.nousresearch.com)
Add multipart/form-data and URL-encoded body parsing, and replace every hand-written field accessor in the workspace with lombok `Data` accessors, so field access has one source of truth. Body parsing: - new `type/src/body` module parsing multipart/form-data parts and URL-encoded forms, exposed through `Request` body entry points - parser failures return `Option` instead of a bespoke `BodyError`, matching the existing `try_get_*` accessor convention in the project - a multipart body without its closing boundary is rejected rather than silently accepted as a short upload Request fixes found while wiring the new body API: - `RequestQuerysValue` is now a `VecDeque<String>` so repeated query keys keep every value; the previous map silently dropped all but the last one - header lookup is now case-insensitive, matching the lowercased keys the header parser stores Accessor and visibility pass across the workspace: - 21 hand-written `get_*` / `set_*` accessors removed and replaced by `Data` derives; `request/src/request/config/impl.rs` is deleted outright - business code no longer touches struct fields directly, going through generated accessors instead - field visibility reduced to the narrowest level each field actually needs: `pub(super)` within a module tree, `pub(crate)` across sibling modules, `pub` for cross-crate and integration-test consumers - accessor visibility kept aligned with the visibility of its field `WebSocketConfig` keeps its hand-written `set_*` methods: they are fluent builders taking `mut self` and returning `Self`, not field setters, so they are marked `#[set(skip)]` rather than converted. 🤖 Generated with [Hermes](https://hermes-agent.nousresearch.com)
The rebase onto master brought the workspace back to full scan coverage and surfaced two audit failures. One was inherited debt; both are fixed here so the branch passes all 51 checks. Check 16 (R1.3a) — `impl Default for Tmp` lived in the keyword file `request/src/request/tmp/struct.rs`. It now lives in a sibling `impl.rs`, registered in `mod.rs` in the house declaration order. Check 18 (R1.3c) — literals moved out of function bodies into `const.rs`: - `type/src/body/impl.rs`: the header separator, the URL-encoded space, plus and percent bytes, and the six hex digit bounds - `request/src/request/http_request/impl.rs`: the header value separator and the CRLF pattern, which were pre-existing debt on master 🤖 Generated with [Hermes](https://hermes-agent.nousresearch.com)
vshengbro
force-pushed
the
refactor/lombok-data-macros
branch
from
October 12, 2026 13:01
84d69cc to
57b9aed
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds multipart/form-data and URL-encoded body parsing to
http-type, andreplaces every hand-written struct field accessor in the workspace with
lombok
Data-generated accessors so field access has one source of truth.Two request defects surfaced while wiring up the new body API and are
fixed here: repeated query keys silently lost every value but the last,
and header lookup failed for any key that was not already lowercase.
Changes
Body parsing (new):
type/src/body/struct.rs—BodyPartandMultipartFormDatatype/src/body/impl.rs— multipart and URL-encoded parsing, pluspart-level and form-value access
type/src/body/const.rs,type/src/body/type.rs— internal constantsand the
BodyFormValue/ content-type aliasestype/tests/body/— multipart and form testsRequest correctness:
type/src/request/type.rs—RequestQuerysValuebecomesVecDeque<String>so a repeated key keeps all its valuestype/src/request/impl.rs— query parser and accessors handle themulti-value case; header lookup is case-insensitive to match the
lowercased keys the header parser stores
type/tests/request/fn.rs— multi-value query coverageAccessors and visibility (workspace-wide):
get_*/set_*accessors removed in favour ofDataderives acrossRequestConfig,HttpRequest,WebSocket,WebSocketConfig,BodyandRequestBuilderrequest/src/request/config/impl.rsdeleted outright once its accessorsbecame generated
accessors instead
pub(super)inside a module tree,
pub(crate)across sibling modules,pubonlyfor cross-crate and integration-test consumers
RequestBuilder::requestkeeps its public mutable accessor becauserequest/tests/builderconsumes itVerification
cargo test --workspace— 724 passed, 0 failedcargo clippy --all-targets— 0 warningscrate fmt --check— clean, idempotentaudit_rust_standards.py .— 51/51 PASS0 after
git commitran the realpre-commitgate (no--no-verify);0 new violations
vshengbro <root@ltpp.vip>Notes
WebSocketConfigdeliberately keeps its hand-writtenset_*methods.They are fluent builders taking
mut selfand returningSelf, notfield setters, so converting them to macro-generated setters would change
their meaning. Those fields are marked
#[set(skip)]; their getters aregenerated like everything else.
type(clone)is required rather than redundant on the 13Option<T>andMethodfields that carry it. Checked against lombok 10.2.2 source:ReturnType::Referenceis the default, so aClonefield without theattribute yields
&T; and forOption<T>the default branch generatesself.field.clone().unwrap(), which would turn "unset" into a panic.Removing the attribute from each of four representative fields was tried
and all four failed to compile, so it stays.
WebSocketConfigholds&mutreferences and therefore cannot deriveClone,DebugorDefault; it was previously carrying no derives atall and nothing in the workspace depends on those traits for it.
Parser failures return
Option, following the existingtry_get_*convention, rather than a bespoke error type.
🤖 Generated with Hermes