Skip to content

Commit 717d693

Browse files
authored
refactor(kernel-routing): Extract phase-1 routing helper leaf (#1230)
Add the new :kernel-routing leaf module and move the compile-neutral routing helper slice out of :runtime-node. Update ownership metadata, direct dependencies, boundary documentation, and the filesystem-based routing boundary test so the partial extraction is enforced without introducing runtime-node cycles.
1 parent 4a4a1a9 commit 717d693

31 files changed

Lines changed: 365 additions & 86 deletions

.agents/skills/cryptad-architecture/SKILL.md

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,15 @@ Use this skill when you need to:
5252
`network.crypta.io`, `network.crypta.io.comm`, and `network.crypta.io.xfer` helpers such as
5353
address matchers, allow-list parsing, listener abstractions, I/O statistics collection,
5454
throttling, and partially received block assembly
55+
- `:kernel-routing` → the compile-neutral phase-1 routing/helper slice across selected
56+
`network.crypta.node` value, exception, callback, and request-item helper types such as
57+
`BaseRequestThrottle`, `LowLevelGetException`, `LowLevelPutException`, `RequestClient`,
58+
`PeerStatusCounts`, `RecentlyFailedReturn`, and `SendableRequestItem*`
5559
- `:runtime-spi``network.crypta.runtime.spi` (JDK-only runtime/config boundary)
5660
- `:runtime-node` → extracted daemon runtime body across the remaining cyclic/high-level
57-
`network.crypta.client` body, large `network.crypta.node` and `network.crypta.runtime.*`
58-
slices, the retained node-coupled transport/message execution code in `network.crypta.io*`,
59-
and the remaining daemon-coupled
61+
`network.crypta.client` body, the remaining peer/request/routing-engine and transport-heavy
62+
`network.crypta.node` / `network.crypta.runtime.*` slices, the retained node-coupled
63+
transport/message execution code in `network.crypta.io*`, and the remaining daemon-coupled
6064
`network.crypta.support` / `network.crypta.support.io` / `network.crypta.support.api` subset
6165
- `:adapter-fcp``network.crypta.clients.fcp`, including
6266
`network.crypta.clients.fcp.bridge`
@@ -89,6 +93,7 @@ Use this skill when you need to:
8993
- The daemon runtime body now spans extracted leaves plus a thin root composition layer:
9094
`:kernel-content` owns the compile-neutral phase-1 client/content slice,
9195
`:kernel-transport` owns the compile-neutral phase-1 transport helper slice,
96+
`:kernel-routing` owns the compile-neutral phase-1 routing/helper slice,
9297
`:runtime-node` owns the remaining runtime/node/client/support body, `:adapter-fcp` owns the
9398
FCP adapter tree, `:adapter-http-legacy-admin` owns the legacy HTTP adapter tree and resources,
9499
and the root project keeps tests, packaging, tool entrypoints, and remaining composition glue.
@@ -112,16 +117,19 @@ Use this skill when you need to:
112117
`:foundation-store-contracts` just as much as any future extraction.
113118
- Root boundary tests now freeze the extracted layout. In particular,
114119
`RuntimeNodeKernelSplitPrepBoundaryTest`, `KernelContentBoundaryTest`,
115-
`KernelTransportBoundaryTest`, and `HttpLegacyAdminBoundaryTest` guard leaf ownership/import
116-
rules, and the runtime/kernel-content tests require `package-info.java` in every production
117-
package under those leaves.
120+
`KernelTransportBoundaryTest`, `KernelRoutingBoundaryTest`, and
121+
`HttpLegacyAdminBoundaryTest` guard leaf ownership/import rules, and the runtime/kernel-content
122+
tests require `package-info.java` in every production package under those leaves.
118123

119124
## Architecture overview (by package)
120125
### Core network layer (`network.crypta.node`)
121126
- Node coordination: `Node.java`
122127
- Peer management: `PeerNode`, `PeerManager`
123128
- Network transport: `PacketSender`, `FNPPacketMangler`
124129
- Request orchestration: `RequestStarter`, `RequestScheduler`
130+
- `:kernel-routing` now owns the compile-neutral phase-1 helper/value slice inside
131+
`network.crypta.node`, including request client metadata, low-level routing exceptions,
132+
lightweight peer-status summaries, and sendable-request item helper interfaces.
125133
- Updates now bootstrap through `network.crypta.runtime.updater.NodeUpdateManager`
126134

127135
### Runtime orchestration packages (`network.crypta.runtime.*`)
@@ -169,9 +177,13 @@ Use this skill when you need to:
169177
`network.crypta.io`, `network.crypta.io.comm`, and `network.crypta.io.xfer` classes such as
170178
`AllowedHosts`, `NetworkInterface`, `IOStatisticCollector`, `SocketHandler`,
171179
`PortForwardSensitiveSocketHandler`, `PacketThrottle`, and `PartiallyReceivedBlock`.
180+
- `:kernel-routing` owns the compile-neutral phase-1 `network.crypta.node` helper/value slice,
181+
including `BaseRequestThrottle`, `LowLevelGetException`, `LowLevelPutException`,
182+
`RequestClient`, `PeerStatusCounts`, `RecentlyFailedReturn`, and `SendableRequestItem*`.
172183
- `:runtime-node` keeps the node-coupled transport-facing code such as `PeerContext`,
173-
`MessageCore`, packet filters, active socket handlers, transfer send/receive code, and runtime
174-
helpers like `network.crypta.runtime.core.SSL`.
184+
`MessageCore`, packet filters, active socket handlers, transfer send/receive code, and the
185+
remaining peer/request/routing-engine side of `network.crypta.node`, plus runtime helpers like
186+
`network.crypta.runtime.core.SSL`.
175187

176188
### Client APIs
177189
- High-level client: `network.crypta.client`
@@ -328,11 +340,13 @@ Use this skill when you need to:
328340
classes plus `network.crypta.support.MediaType`
329341
- `:kernel-transport`: compile-neutral phase-1 transport slice across selected
330342
`network.crypta.io*` helpers
343+
- `:kernel-routing`: compile-neutral phase-1 routing/helper slice across selected
344+
`network.crypta.node` helper/value types
331345
- `:runtime-spi`: `network.crypta.runtime.spi`
332346
- `:runtime-node`: extracted daemon runtime body across the remaining cyclic/high-level
333-
`network.crypta.client` body, large `network.crypta.node` / `network.crypta.runtime.*` slices,
334-
the retained node-coupled transport/message execution code, and the remaining daemon-coupled
335-
support helpers
347+
`network.crypta.client` body, the remaining peer/request/routing-engine
348+
`network.crypta.node` / `network.crypta.runtime.*` slices, the retained node-coupled
349+
transport/message execution code, and the remaining daemon-coupled support helpers
336350
- `:adapter-fcp`: `network.crypta.clients.fcp`
337351
- `:adapter-http-legacy-admin`: `network.crypta.clients.http`
338352

.agents/skills/cryptad-build-test/SKILL.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Use this skill when you need to:
2121
- Current leaf projects are `:foundation-support`, `:foundation-store`,
2222
`:foundation-store-contracts`, `:foundation-crypto-keys`, `:interop-wire`,
2323
`:foundation-config`, `:foundation-fs`, `:foundation-compat`, `:kernel-content`,
24-
`:kernel-transport`, `:runtime-spi`,
24+
`:kernel-transport`, `:kernel-routing`, `:runtime-spi`,
2525
`:runtime-node`, `:adapter-fcp`, `:adapter-http-legacy-admin`, `:thirdparty-onion`,
2626
`:thirdparty-legacy`, and `:launcher-desktop`.
2727
- The extracted leaf projects compile separately, but `buildJar`, `run`, `runLauncher`,
@@ -55,6 +55,10 @@ Use this skill when you need to:
5555
`network.crypta.io`, `network.crypta.io.comm`, and `network.crypta.io.xfer` helpers such as
5656
allow-list parsing, listener abstraction, I/O statistics collection, throttling, and partially
5757
received block assembly.
58+
- `:kernel-routing` owns the compile-neutral phase-1 routing/helper slice across selected
59+
`network.crypta.node` value, exception, callback, and request-item helper types such as
60+
`BaseRequestThrottle`, `LowLevelGetException`, `LowLevelPutException`, `RequestClient`,
61+
`PeerStatusCounts`, `RecentlyFailedReturn`, and `SendableRequestItem*`.
5862
- Every extracted internal leaf must keep leaf-owned aggregated-output metadata in sync at
5963
`<leaf>/gradle/owned-output-patterns.txt`, even for structurally separate package/resource
6064
moves. Non-clean builds and branch switches can leave stale non-owner aggregated outputs behind,
@@ -63,16 +67,18 @@ Use this skill when you need to:
6367
leaf's `owned-output-patterns.txt` and validate with
6468
`./gradlew verifySelectiveLeafOwnershipMetadata buildJar`.
6569
- Root boundary tests now freeze the current extracted layout. `RuntimeNodeKernelSplitPrepBoundaryTest`,
66-
`KernelContentBoundaryTest`, `KernelTransportBoundaryTest`, and `HttpLegacyAdminBoundaryTest`
67-
are the focused regression checks for leaf ownership/import boundaries, and the
70+
`KernelContentBoundaryTest`, `KernelTransportBoundaryTest`, `KernelRoutingBoundaryTest`, and
71+
`HttpLegacyAdminBoundaryTest` are the focused regression checks for leaf ownership/import
72+
boundaries, and the
6873
runtime/kernel-content tests enforce `package-info.java` coverage for production packages in
6974
those leaves.
7075
- `:runtime-spi` is the JDK-only runtime/config API leaf. Its focused unit tests still live in the
7176
root test tree and run through the root build.
7277
- `:runtime-node` is the extracted daemon runtime leaf. It now owns the remaining cyclic/high-level
73-
`network.crypta.client` body, `network.crypta.node`, the retained node-coupled transport/message
74-
execution code in `network.crypta.io*`, `network.crypta.runtime.*`, and the remaining
75-
daemon-coupled support helpers.
78+
`network.crypta.client` body, the remaining peer/request/routing-engine side of
79+
`network.crypta.node`, the retained node-coupled transport/message execution code in
80+
`network.crypta.io*`, `network.crypta.runtime.*`, and the remaining daemon-coupled support
81+
helpers.
7682
- `:adapter-fcp` owns `network.crypta.clients.fcp`, including
7783
`network.crypta.clients.fcp.bridge`.
7884
- `:adapter-http-legacy-admin` owns the current legacy `network.crypta.clients.http` tree and the
@@ -108,7 +114,7 @@ When running ./gradlew test via OpenCode bash, set timeout ≥ 15 minutes (≥ 9
108114
- Run one test method:
109115
- `./gradlew test --tests *TestClassName.methodName`
110116
- For extracted-leaf or boundary work, run the focused boundary tests:
111-
- `./gradlew test --tests *KernelTransportBoundaryTest --tests *KernelContentBoundaryTest --tests *RuntimeNodeKernelSplitPrepBoundaryTest --tests *HttpLegacyAdminBoundaryTest`
117+
- `./gradlew test --tests *KernelTransportBoundaryTest --tests *KernelContentBoundaryTest --tests *KernelRoutingBoundaryTest --tests *RuntimeNodeKernelSplitPrepBoundaryTest --tests *HttpLegacyAdminBoundaryTest`
112118

113119
## Compile-only / quick checks
114120
- Compile only:
@@ -137,6 +143,9 @@ When running ./gradlew test via OpenCode bash, set timeout ≥ 15 minutes (≥ 9
137143
- Compile the phase-1 kernel-transport leaf when you touched extracted compile-neutral transport
138144
helpers:
139145
- `./gradlew :kernel-transport:compileJava`
146+
- Compile the phase-1 kernel-routing leaf when you touched extracted compile-neutral routing/helper
147+
classes:
148+
- `./gradlew :kernel-routing:compileJava`
140149
- Compile only the runtime SPI leaf when you touched just that JDK-only API surface:
141150
- `./gradlew :runtime-spi:compileJava`
142151
- Compile the extracted runtime-node leaf when you touched daemon runtime, node, client, xfer, or

README.md

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,19 @@ Cryptad now uses a partial multi-project Gradle build.
201201
address matching, allow-list parsing, listener abstraction, I/O statistics collection, transfer
202202
throttling, and partially received block assembly that stay free of `:runtime-node`, adapters,
203203
and root-composition dependencies.
204+
- `:kernel-routing` owns the compile-neutral phase-1 routing/helper slice across selected
205+
`network.crypta.node` value, exception, callback, and request-item helper types such as
206+
`BaseRequestThrottle`, `LowLevelGetException`, `LowLevelPutException`, `RequestClient`,
207+
`PeerStatusCounts`, and `SendableRequestItem*` that stay free of `:runtime-node`, adapters, and
208+
root-composition dependencies.
204209
- `:runtime-spi` owns `network.crypta.runtime.spi` and the JDK-only runtime/config boundary used
205210
by higher layers, including detached FCP peer management plus the admin-HTTP config,
206211
connectivity, connections, queue, security-levels, shared page-chrome, core-update action,
207212
first-time-wizard, symlinker, and welcome-page slices.
208213
- `:runtime-node` owns the remaining daemon runtime body across the still-cyclic
209214
`network.crypta.client` async/request engine and high-level client APIs, large slices of
210-
`network.crypta.node`, the retained node-coupled transport/message execution code in
215+
`network.crypta.node` after the phase-1 routing/helper move, the retained node-coupled
216+
transport/message execution code in
211217
`network.crypta.io`, `network.crypta.io.comm`, and `network.crypta.io.xfer`,
212218
`network.crypta.runtime.*`, and the remaining daemon-coupled
213219
`network.crypta.support` / `network.crypta.support.io` / `network.crypta.support.api` subset
@@ -235,7 +241,7 @@ Cryptad now uses a partial multi-project Gradle build.
235241
- Higher-level infrastructure now crosses a narrower boundary through
236242
`network.crypta.runtime.spi.RuntimePorts`, the minimal wire-side `MessageSource` seam used by
237243
leaf-owned messages, the new phase-1 `:kernel-content` content slice, the phase-1
238-
`:kernel-transport` helper slice, client-owned seams such as
244+
`:kernel-transport` helper slice, the phase-1 `:kernel-routing` helper slice, client-owned seams such as
239245
`network.crypta.client.async.alerts` and `network.crypta.client.async.persistence`, and
240246
runtime-owned seams such as
241247
`network.crypta.runtime.alerts.feed`, `network.crypta.runtime.fcp`,
@@ -280,7 +286,7 @@ For extraction and boundary work, run the focused root boundary tests that freez
280286
ownership and import rules:
281287

282288
```bash
283-
./gradlew test --tests *KernelTransportBoundaryTest --tests *KernelContentBoundaryTest --tests *RuntimeNodeKernelSplitPrepBoundaryTest --tests *HttpLegacyAdminBoundaryTest
289+
./gradlew test --tests *KernelTransportBoundaryTest --tests *KernelContentBoundaryTest --tests *KernelRoutingBoundaryTest --tests *RuntimeNodeKernelSplitPrepBoundaryTest --tests *HttpLegacyAdminBoundaryTest
284290
```
285291

286292
Those tests also enforce the current extracted-leaf documentation convention that production
@@ -551,12 +557,17 @@ Root build also includes:
551557
`network.crypta.io`, `network.crypta.io.comm`, and `network.crypta.io.xfer` helpers such as
552558
allow-list parsing, listener abstraction, statistics collection, throttling, and partially
553559
received block assembly.
560+
- `:kernel-routing`: compile-neutral phase-1 routing/helper leaf spanning selected
561+
`network.crypta.node` value, exception, callback, and request-item helper types such as
562+
`BaseRequestThrottle`, `LowLevelGetException`, `LowLevelPutException`, `RequestClient`,
563+
`PeerStatusCounts`, and `SendableRequestItem*`.
554564
- `:runtime-spi`: JDK-only runtime ports plus immutable config snapshot/value types used by FCP
555565
and other infrastructure code.
556566
- `:runtime-node`: extracted daemon runtime body across the remaining cyclic/high-level
557-
`network.crypta.client` body, large `network.crypta.node` and `network.crypta.runtime.*`
558-
slices, the retained node-coupled transport/message execution code in `network.crypta.io*`, and
559-
the remaining daemon-coupled support helpers.
567+
`network.crypta.client` body, the remaining peer/request/routing-engine and transport-heavy
568+
`network.crypta.node` / `network.crypta.runtime.*` slices, the retained node-coupled
569+
transport/message execution code in `network.crypta.io*`, and the remaining daemon-coupled
570+
support helpers.
560571
- `:adapter-fcp`: extracted `network.crypta.clients.fcp` adapter code, including
561572
`network.crypta.clients.fcp.bridge`.
562573
- `:adapter-http-legacy-admin`: extracted legacy `network.crypta.clients.http` adapter code plus
@@ -614,7 +625,7 @@ Tip: Keep the Spotless formatter at the intended version (currently `googleJavaF
614625
- Leaf subprojects are `:foundation-support`, `:foundation-store`,
615626
`:foundation-store-contracts`, `:foundation-crypto-keys`, `:interop-wire`,
616627
`:foundation-config`, `:foundation-fs`, `:foundation-compat`, `:kernel-content`,
617-
`:kernel-transport`, `:runtime-spi`,
628+
`:kernel-transport`, `:kernel-routing`, `:runtime-spi`,
618629
`:runtime-node`, `:adapter-fcp`, `:adapter-http-legacy-admin`, `:thirdparty-onion`,
619630
`:thirdparty-legacy`, and `:launcher-desktop`.
620631
- Core network (`network.crypta.node`): `Node`, `PeerNode`, `PeerManager`, `PacketSender`, `RequestStarter`, `RequestScheduler`, `NodeUpdateManager`.
@@ -634,9 +645,13 @@ Tip: Keep the Spotless formatter at the intended version (currently `googleJavaF
634645
compile-neutral transport helper slice across selected `network.crypta.io`,
635646
`network.crypta.io.comm`, and `network.crypta.io.xfer` classes such as `AllowedHosts`,
636647
`NetworkInterface`, `IOStatisticCollector`, `SocketHandler`, `PacketThrottle`, and
637-
`PartiallyReceivedBlock`. `:runtime-node` keeps the node-coupled transport/socket/filter and
638-
transfer-execution side of `network.crypta.io*`, and `Message` now depends on the minimal
639-
`MessageSource` seam rather than directly on `PeerContext`.
648+
`PartiallyReceivedBlock`. `:kernel-routing` now owns the compile-neutral phase-1
649+
`network.crypta.node` helper/value slice, including `BaseRequestThrottle`,
650+
`LowLevelGetException`, `LowLevelPutException`, `RequestClient`, `PeerStatusCounts`,
651+
`RecentlyFailedReturn`, and `SendableRequestItem*`. `:runtime-node` keeps the node-coupled
652+
transport/socket/filter side of `network.crypta.io*` plus the remaining peer, scheduler,
653+
request-sender, and routing-engine side of `network.crypta.node`, and `Message` now depends on
654+
the minimal `MessageSource` seam rather than directly on `PeerContext`.
640655
- Clients: `network.crypta.client`, FCP (`network.crypta.clients.fcp`), HTTP
641656
(`network.crypta.clients.http`). `:kernel-content` now owns the compile-neutral phase-1 content
642657
slice: selected client value/archive/helper classes, immutable client event values, a
@@ -720,11 +735,14 @@ Tip: Keep the Spotless formatter at the intended version (currently `googleJavaF
720735
- Runtime boundary leaves: `:kernel-content` provides the compile-neutral phase-1 content slice
721736
across selected `network.crypta.client*` classes plus `network.crypta.support.MediaType`;
722737
`:kernel-transport` provides the compile-neutral phase-1 transport slice across selected
723-
`network.crypta.io*` helpers; `:runtime-spi` provides `network.crypta.runtime.spi`;
724-
`:runtime-node` provides the extracted daemon runtime body across the remaining cyclic/high-level
725-
`network.crypta.client` body, large `network.crypta.node` / `network.crypta.runtime.*` slices,
726-
the retained node-coupled transport/message execution code, and the remaining daemon-coupled
727-
support helpers; `:adapter-fcp` provides `network.crypta.clients.fcp`; and
738+
`network.crypta.io*` helpers; `:kernel-routing` provides the compile-neutral phase-1
739+
`network.crypta.node` helper slice across selected request/routing value, exception, callback,
740+
and request-item types; `:runtime-spi` provides `network.crypta.runtime.spi`; `:runtime-node`
741+
provides the extracted daemon runtime body across the remaining cyclic/high-level
742+
`network.crypta.client` body, the remaining peer/request/routing-engine
743+
`network.crypta.node` / `network.crypta.runtime.*` slices, the retained node-coupled
744+
transport/message execution code, and the remaining daemon-coupled support helpers;
745+
`:adapter-fcp` provides `network.crypta.clients.fcp`; and
728746
`:adapter-http-legacy-admin` provides the current legacy `network.crypta.clients.http` classes
729747
and resources.
730748
- Vendored libraries: `:thirdparty-onion` provides `com.onionnetworks`,

adapter-fcp/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dependencies {
1212
implementation(project(":interop-wire"))
1313
implementation(project(":kernel-content"))
1414
implementation(project(":kernel-transport"))
15+
implementation(project(":kernel-routing"))
1516
implementation(project(":runtime-spi"))
1617
implementation(project(":runtime-node"))
1718

adapter-http-legacy-admin/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ dependencies {
1414
implementation(project(":interop-wire"))
1515
implementation(project(":kernel-content"))
1616
implementation(project(":kernel-transport"))
17+
implementation(project(":kernel-routing"))
1718
implementation(project(":runtime-spi"))
1819
implementation(project(":runtime-node"))
1920
implementation(project(":thirdparty-onion"))

build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ val internalLeafProjects =
2626
project(":foundation-compat"),
2727
project(":kernel-content"),
2828
project(":kernel-transport"),
29+
project(":kernel-routing"),
2930
project(":runtime-spi"),
3031
project(":runtime-node"),
3132
project(":adapter-fcp"),
@@ -53,6 +54,7 @@ dependencies {
5354
implementation(project(":foundation-compat"))
5455
implementation(project(":kernel-content"))
5556
implementation(project(":kernel-transport"))
57+
implementation(project(":kernel-routing"))
5658
implementation(project(":runtime-spi"))
5759
implementation(project(":runtime-node"))
5860
implementation(project(":adapter-fcp"))

0 commit comments

Comments
 (0)