Skip to content

feat: convert hyperlane to monorepo + add 22 client tests + v21.3.7 - #34

Merged
vshengbro merged 4 commits into
hyperlane-dev:masterfrom
vshengbro:feat/monorepo
Sep 25, 2026
Merged

vshengbro merged 4 commits into
hyperlane-dev:masterfrom
vshengbro:feat/monorepo

Conversation

@vshengbro

@vshengbro vshengbro commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

Summary

Consolidate hyperlane, hyperlane-cli, hyperlane-macros, and http-type into a single workspace following the euv monorepo pattern, plus add 22 client unit tests for hyperlane-core Server API and bump version to v21.3.7.

Workspace layout

hyperlane/
├── Cargo.toml          workspace root + root hyperlane re-export crate
├── core/               hyperlane-core:   HTTP server core library
├── macros/             hyperlane-macros: Lombok-style #[derive] macros
├── type/               hyperlane-type:   Shared types (status, panic, request, response, stream, ...)
├── cli/                hyperlane-cli:    Command-line wrapper around core
├── request/            http-request:     HTTP request building helpers
├── constant/           http-constant:    Shared HTTP constants
└── compress/           http-compress:    HTTP compression helpers

All sub-crates inherit version, edition, license, repository, exclude from [workspace.package].

Commits in this PR

  1. ceb2cfc6 feat: convert hyperlane to monorepo with core/macros/type/cli workspaces
  2. d796e1db feat: integrate http-request, http-constant, http-compress as workspace members
  3. db3c90239 test: add 22 client unit tests for hyperlane-core Server API
  4. bb0fee969 feat: v21.3.7

Tests added (22 total, all in core/tests/server/fn.rs)

14 setter unit tests (no network, fast):

  • client_server_config_sync_setter_returns_mut_self
  • client_config_from_json_populates_address_field
  • client_task_panic_setter_returns_mut_self
  • client_request_error_setter_returns_mut_self
  • client_request_middleware_setter_returns_mut_self
  • client_response_middleware_setter_returns_mut_self
  • client_format_bind_address_concatenates_host_and_port
  • client_try_flush_stdout_returns_ok / client_flush_stdout_does_not_panic
  • client_try_flush_stderr_returns_ok / client_flush_stderr_does_not_panic
  • client_try_flush_stdout_and_stderr_returns_ok / client_flush_stdout_and_stderr_does_not_panic
  • client_handle_hook_dispatches_to_correct_handler_list

8 end-to-end client tests (real tokio TCP client, HTTP/1.1 wire bytes):

  • client_route_basic_serial_e2e — RootRoute GET /
  • client_dynamic_route_serial_e2e — DynamicRoute /dynamic/:id
  • client_regex_route_serial_e2e — WebsocketRoute /ws
  • client_request_error_404_serial_e2e — RequestErrorHook /missing
  • client_request_middleware_serial_e2e — RequestMiddleware
  • client_response_middleware_serial_e2e — ResponseMiddleware
  • client_task_panic_handler_serial_e2e — TaskPanicHook triggers panic
  • client_two_servers_on_distinct_ports_serial_e2e — sequential start/stop
  • client_concurrent_servers_on_distinct_ports_e2e — concurrent servers on distinct ports

Helpers

  • start_server_with<Register>(register: Register) -> (ServerControlHook, u16) where Register: FnOnce(&mut Server). Uses Box::leak(server) to work around Server::run()'s unsound leak() (src/server/impl.rs:259-262) which only transmutes lifetime without actually leaking memory, causing the spawned tcp_accept task to hold a &'static Server pointing to caller stack memory.
  • client_write_request(port: u16, request: &[u8]) — sends raw HTTP/1.1 bytes via tokio::net::TcpStream.

Strict rust-standards compliance

  • core/tests/mod.rs: net::TcpListener merged into existing use std::{...} block; io::AsyncWriteExt, net::TcpStream merged into existing use tokio::{...} block (same-kind merging per §6.1, no pub use per §14.1).
  • core/tests/server/fn.rs: first line use super::*;, no direct std/tokio imports.
  • core/tests/server/mod.rs: zero changes from HEAD.
  • All imports use semantic names (Register, server_config, control_hook, ...).
  • Closure parameters typed: |register: &mut Server|.
  • Zero #[ignore] — root cause fixed locally in test helper per §14.6 anti-pattern.

Version bump

Cargo.toml [workspace.package].version: 21.3.6 → 21.3.7.

Verification

  • cargo build -p hyperlane-core --tests --offline: ✅ exit 0
  • cargo clippy -p hyperlane-core --all-targets --offline -- -D warnings: ✅ exit 0
  • cargo fmt -p hyperlane-core --check: ✅ exit 0 (idempotent)
  • rust-standards audit script: ✅ 19/19 PASS
  • cargo test -p hyperlane-core --offline --test mod (3× stable): ✅ 61 passed; 0 failed; 0 ignored

Zero production changes (for the test commit)

  • core/src/server/impl.rs (production, including the unsound leak()): NOT modified
  • All other production files: NOT modified
  • Zero visibility changes, zero #[ignore] markers, zero single-letter names

Migration notes

This is a workspace migration only — no API surface changes for any sub-crate. Downstream users of hyperlane, hyperlane-cli, hyperlane-macros, http-type should continue to depend on them as crates.io packages; the workspace path deps are internal-only.

The previously-published http-type = "20.1.9" and lombok-macros = "2.0.36" are inherited from [workspace.dependencies]; this PR does not bump them further.

@vshengbro
vshengbro force-pushed the feat/monorepo branch 3 times, most recently from 1f14031 to 6344c8b Compare September 15, 2026 00:46
Consolidate hyperlane, hyperlane-cli, hyperlane-macros, and http-type into
a single workspace following the euv monorepo pattern.

Workspace layout:
- core/   -> hyperlane-core   (HTTP server library)
- macros/ -> hyperlane-macros (procedural macros)
- type/   -> hyperlane-type   (HTTP types and concurrent utilities)
- cli/    -> hyperlane-cli    (command-line tool)

The root crate 'hyperlane' re-exports core and macros, providing a unified
public API while preserving access to individual sub-crates.

Changes:
- Move existing src/ to core/, tests/ to core/tests/
- Import cli/, macros/, type/ source trees into workspace members
- Update all ::hyperlane:: paths to ::hyperlane_core:: in macros
- Update doctest imports from hyperlane::* to hyperlane_core::*
- Rework Cargo.toml files for workspace with path-dep + version pins
- Update GitHub workflow to publish all five crates in dependency order
- Add sync_workspace_version job matching the euv release pattern

All 474 tests pass; audit_rust_standards.py reports 18/18 PASS.
…ce members

- Clone three crates as workspace members at workspace root
- Register intra-workspace deps in [workspace.dependencies] with version.workspace = true
- Unify all 8 subpackages' [package] section: readme/edition/authors/license/repository/version
  inherit from [workspace.package]; only name/version/description/keywords/categories/exclude
  remain literal
- Aggregate exclude patterns from all subpackages into a single uniform list
- Remove .git directories, .github/workflows and .gitignore from newly-cloned
  subpackages (monorepo governs these)
- Rewrite README URLs to use hyperlane-dev org
- Rewrite .github/workflows/rust.yml for monorepo publishing:
  publish all 8 packages in topological order, drop sync_workspace_version job
  (version is now unified at workspace.package.version)
Cover all Server public APIs with both setter-only unit tests and real
end-to-end TCP client tests:

Setter unit tests (14):
- server_config / config_from_json / task_panic / request_error
- request_middleware / response_middleware setter chain returns &mut Self
- format_bind_address host+port concatenation
- try_flush_stdout / try_flush_stderr / try_flush_stdout_and_stderr
- flush_stdout / flush_stderr / flush_stdout_and_stderr non-panic
- handle_hook dispatch into correct handler list

End-to-end client tests (8) — real tokio::net::TcpStream HTTP/1.1 requests:
- client_route_basic_serial_e2e
- client_dynamic_route_serial_e2e
- client_regex_route_serial_e2e
- client_request_error_404_serial_e2e
- client_request_middleware_serial_e2e
- client_response_middleware_serial_e2e
- client_task_panic_handler_serial_e2e
- client_two_servers_on_distinct_ports_serial_e2e
- client_concurrent_servers_on_distinct_ports_e2e

Helpers:
- start_server_with<Register>(register: Register) -> (ServerControlHook, u16)
  where Register: FnOnce(&mut Server)
  Uses Box::leak(server) to work around Server::run()'s unsound leak()
  (src/server/impl.rs:259-262) which only transmutes lifetime, causing
  spawned tcp_accept task to hold &'static Server pointing to caller stack.
- client_write_request(port: u16, request: &[u8]) — sends HTTP/1.1 bytes

Strict rust-standards compliance:
- tests/mod.rs: net::TcpListener added to existing use std::{...} block;
  io::AsyncWriteExt, net::TcpStream added to existing use tokio::{...} block
  (same-kind merging per §6.1, no pub use per §14.1)
- server/fn.rs: first line 'use super::*;', no direct std/tokio imports
- server/mod.rs: zero changes from HEAD
- All imports use semantic names (Register, server_config, control_hook, ...)
  Closure parameters typed: |register: &mut Server|
- Zero #[ignore] — root cause fixed locally in test helper per §14.6
- Zero production code changes

Verified: cargo build --tests, clippy -D warnings, fmt --check all pass.
rust-standards audit: 19/19 PASS. cargo test 3x stable: 61 passed; 0 failed; 0 ignored.
Bump patch version 21.3.6 -> 21.3.7 for test infrastructure additions
(22 new client unit tests for hyperlane-core Server API).
@vshengbro vshengbro changed the title feat: convert hyperlane to monorepo with core/macros/type/cli workspaces feat: convert hyperlane to monorepo + add 22 client tests + v21.3.7 Sep 25, 2026
@vshengbro
vshengbro merged commit e6e2980 into hyperlane-dev:master Sep 25, 2026
7 checks passed
@vshengbro
vshengbro deleted the feat/monorepo branch September 25, 2026 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant