Skip to content

Commit 2e61cf8

Browse files
authored
Merge pull request #1785 from j5ik2o/remote-graceful-flush
feat(remote): add graceful flush lifecycle
2 parents 1e09749 + f8493d3 commit 2e61cf8

43 files changed

Lines changed: 4380 additions & 134 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/gap-analysis/remote-gap-analysis.md

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# remote モジュール ギャップ分析
22

3-
更新日: 2026-05-14 (13th edition / payload serialization 接続後)
3+
更新日: 2026-05-14 (14th edition / remote graceful flush 接続後)
44

55
## 比較スコープ定義
66

@@ -44,27 +44,27 @@ raw declaration count は Scala / Java / JVM 固有 API を含む参考値であ
4444

4545
remote は address primitives、failure detector、association state、wire PDU、TCP transport shell、resolve cache、remote `ActorRef` materialization、actor-core serialization registry backed payload の outbound / inbound delivery まで実装済みである。
4646

47-
一方で、残ギャップは compression table application、remote deployment、`AddressTerminated` integration、flush lifecycle に集中している。remote DeathWatch の watch / unwatch / notification deliveryACK/NACK redelivery`remote-reliable-deathwatch` で接続済みである
47+
一方で、残ギャップは compression table application、remote deployment、`AddressTerminated` integration に集中している。remote DeathWatch の watch / unwatch / notification deliveryACK/NACK redelivery、shutdown / DeathWatch 前 flush lifecycle は接続済みである
4848

4949
| 指標 ||
5050
|------|-----|
5151
| Pekko 固定スコープ対象概念 | 75 |
52-
| fraktor-rs 固定スコープ対応概念 | 70 |
53-
| 固定スコープ概念カバレッジ | 70/75 (93.3%) |
52+
| fraktor-rs 固定スコープ対応概念 | 72 |
53+
| 固定スコープ概念カバレッジ | 72/75 (96.0%) |
5454
| raw Pekko public type declarations | 361(Scala / Java、protobuf 除外) |
5555
| raw Pekko `def` declarations | 1594 |
56-
| raw fraktor public type declarations | 86`remote-core`: 70 / `remote-adaptor-std`: 16|
57-
| raw fraktor public method declarations | 352`remote-core`: 312 / `remote-adaptor-std`: 40|
58-
| hard / medium / easy / trivial gap | 5 / 0 / 0 / 0 |
56+
| raw fraktor public type declarations | 87`remote-core`: 73 / `remote-adaptor-std`: 14、簡易再計測|
57+
| raw fraktor public method declarations | 346`remote-core`: 328 / `remote-adaptor-std`: 18、簡易再計測|
58+
| hard / medium / easy / trivial gap | 3 / 0 / 0 / 0 |
5959

6060
`todo!()` / `unimplemented!()` / `panic!("not implemented")` と production code 上の明示 TODO は remote core / adaptor から検出されない。`modules/remote-core/src/wire/primitives.rs:12` の header placeholder は encode 時の長さ埋め戻しであり、未実装ギャップには分類しない。
6161

6262
## 層別カバレッジ
6363

6464
|| Pekko 対応範囲 | fraktor-rs 現状 | 評価 |
6565
|----|----------------|-----------------|------|
66-
| core | address、unique address、association、wire PDU、failure detector、watcher state、provider contract、typed config | `modules/remote-core/src/` に整理済み。no_std 側の状態機械と PDU は揃っている | 公開 primitive は強い。compression / deployment / flush は残る |
67-
| std / adaptor | TCP listener/client、association 実行系、remoting lifecycle、inbound dispatch、reconnect/backoff、serialized payload delivery、watcher task | `TcpRemoteTransport``run_inbound_dispatch``run_remote_with_delivery``StdRemoteActorRefProvider`、watcher task は存在 | bind / handshake / reconnect / quarantine filter / actor-core serializer backed payload delivery / remote DeathWatch は動く。flush driver はない |
66+
| core | address、unique address、association、wire PDU、failure detector、watcher state、provider contract、typed config | `modules/remote-core/src/` に整理済み。no_std 側の状態機械と PDU は揃っている | 公開 primitive は強い。compression / deployment は残る |
67+
| std / adaptor | TCP listener/client、association 実行系、remoting lifecycle、inbound dispatch、reconnect/backoff、serialized payload delivery、watcher task | `TcpRemoteTransport``run_inbound_dispatch``run_remote_with_delivery``StdRemoteActorRefProvider`、watcher task は存在 | bind / handshake / reconnect / quarantine filter / actor-core serializer backed payload delivery / remote DeathWatch / flush driver は動く |
6868
| actor-core integration | serialization registry、ActorRefProvider、DeathWatch、event stream、routing/deploy | misc serializer、scheme provider lookup、remote `ActorRef` materialization、routee expansion、registered payload remote send、remote DeathWatch 通知は接続済み | remote deployment と `AddressTerminated` integration が残る |
6969

7070
## カテゴリ別ギャップ
@@ -111,14 +111,9 @@ remote は address primitives、failure detector、association state、wire PDU
111111

112112
`RemotingLifecycleState`, `Remote`, `RemoteShared`, `EventPublisher`, `RemoteLogMarker`, `RemoteInstrument`, `RemotingFlightRecorder`, `RemoteAuthoritySnapshot`、主要 `RemoteConfig` builder は実装済み。`bind_hostname` / `bind_port` / `inbound_lanes` / `outbound_lanes` / `maximum_frame_size` / `buffer_pool_size` / `untrusted_mode` / log toggle / outbound queue / remove-quarantined / outbound restart budget / inbound restart budget / large-message destinations / compression config は現行コードで確認済み。
113113

114-
### 8. Reliability / lifecycle adaptor ✅ 実装済み 2/4 (50%)
114+
### 8. Reliability / lifecycle adaptor ✅ 実装済み 4/4 (100%)
115115

116-
`InboundQuarantineCheck` 相当の quarantine handling と connection loss recovery は実装済み。shutdown / DeathWatch 前 flush は残る。
117-
118-
| Pekko API / 契約 | Pekko参照 | fraktor対応 | 実装先層 | 難易度 | 備考 |
119-
|------------------|-----------|-------------|----------|--------|------|
120-
| `FlushOnShutdown` | `artery/FlushOnShutdown.scala:30`, `artery/FlushOnShutdown.scala:52`, `artery/FlushOnShutdown.scala:79` | 未対応 | std/extension_installer + std/association | hard | `shutdown_flush_timeout` 設定はあるが、association に termination hint / flush frame を送り ack を待つ driver がない |
121-
| `FlushBeforeDeathWatchNotification` | `artery/FlushBeforeDeathWatchNotification.scala:33`, `artery/FlushBeforeDeathWatchNotification.scala:65`, `artery/FlushBeforeDeathWatchNotification.scala:85` | 未対応 | std/watcher + std/association | hard | DeathWatch 通知前に対象 association を flush する契約がない |
116+
`InboundQuarantineCheck` 相当の quarantine handling、connection loss recovery、`FlushOnShutdown` 相当の shutdown flush wait、`FlushBeforeDeathWatchNotification` 相当の DeathWatch notification 前 flush gate は実装済み。
122117

123118
### 9. Internal helpers / cache ✅ 実装済み 2/2 (100%)
124119

@@ -147,12 +142,11 @@ remote は address primitives、failure detector、association state、wire PDU
147142

148143
## 内部モジュール構造ギャップ
149144

150-
固定スコープ概念カバレッジは 93.3% で 80% を超えるため、公開 API の残ギャップを実装する上での構造差分も記録する。残る API gap はすべて `hard` であり、次の構造ギャップが実装順序を制約している。
145+
固定スコープ概念カバレッジは 96.0% で 80% を超えるため、公開 API の残ギャップを実装する上での構造差分も記録する。残る API gap はすべて `hard` であり、次の構造ギャップが実装順序を制約している。
151146

152147
| 構造ギャップ | Pekko側の根拠 | fraktor-rs側の現状 | 推奨アクション | 難易度 | 緊急度 | 備考 |
153148
|-------------|---------------|--------------------|----------------|--------|--------|------|
154149
| compression table 所有者不足 | `artery/compress/InboundCompressions.scala:39`, `artery/Codecs.scala:260` | `RemoteCompressionConfig` は設定値のみで、table state / advertisement owner がない | core に table state、std に advertisement timer / control delivery を配置 | hard | medium | serializer registry 接続後に実装しやすい |
155-
| flush protocol の PDU / driver 不足 | `FlushOnShutdown.scala:52`, `FlushBeforeDeathWatchNotification.scala:65` | `shutdown_flush_timeout` はあるが、flush frame / ack / wait driver がない | core wire に flush control、std association に wait driver を追加 | hard | medium | DeathWatch 前 flush と shutdown flush の共通基盤 |
156150
| remote deployment の責務境界不足 | `RemoteActorRefProvider.scala:596`, `RemoteDaemon.scala:59` | actor-core に `RemoteScope` はあるが、remote daemon / deployment watcher がない | std provider と actor-core deployer の境界に remote create command を追加 | hard | medium | deployer と serialization の両方にまたがる |
157151

158152
## 実装優先度
@@ -174,13 +168,11 @@ remote は address primitives、failure detector、association state、wire PDU
174168
| actor-ref / manifest compression advertisement and table application | core/wire + std/transport/tcp + actor-core-kernel/serialization | 4 |
175169
| remote deployment daemon / `useActorOnNode` | std/provider + actor-core-kernel | 5 |
176170
| `AddressTerminated` integration | actor-core-kernel + std | 6 |
177-
| `FlushOnShutdown` | std/extension_installer + std/association | 8 |
178-
| `FlushBeforeDeathWatchNotification` | std/watcher + std/association | 8 |
179171

180172
## まとめ
181173

182-
remote は address primitives、association state machine、ACK/NACK redelivery、failure detector + registry、typed `RemoteConfig`、TCP transport shell、inbound quarantine、restart handling、resolve cache、remote `ActorRef` materialization、remote DeathWatch、主要 misc serialization、registered payload の二ノード配送までカバー済みで、基礎部品の parity は進んでいる。
174+
remote は address primitives、association state machine、ACK/NACK redelivery、failure detector + registry、typed `RemoteConfig`、TCP transport shell、inbound quarantine、restart handling、resolve cache、remote `ActorRef` materialization、remote DeathWatch、shutdown / DeathWatch 前 flush、主要 misc serialization、registered payload の二ノード配送までカバー済みで、基礎部品の parity は進んでいる。
183175

184176
Phase 1 / Phase 2 の低コストギャップは現時点ではない。parity を次に進めるには、Phase 3 のうち actor-ref / manifest compression table application を先に通すのが効果的である。
185177

186-
主要ギャップは compression table application、`AddressTerminated` integration、remote deployment、flush lifecycle に集中している。API カバレッジは 90% を超えているため、次のボトルネックは単なる型追加ではなく、compression table / deployment / flush の接続境界にある。
178+
主要ギャップは compression table application、`AddressTerminated` integration、remote deployment に集中している。API カバレッジは 90% を超えているため、次のボトルネックは単なる型追加ではなく、compression table / deployment / actor-core failure notification の接続境界にある。
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# remote-graceful-flush implementation plan
2+
3+
## Objective
4+
5+
Implement OpenSpec change `remote-graceful-flush` with minimal, task-tracked changes.
6+
7+
## Plan
8+
9+
1. Add wire-level flush control PDUs and codec coverage.
10+
Verify with `fraktor-remote-core-rs` wire tests.
11+
2. Add core association flush session state and transport-neutral outcomes.
12+
Verify duplicate ack, timeout, connection loss, and pending queue behavior with core unit tests.
13+
3. Add `Remote` / `RemoteShared` flush start, timer input, inbound ack/request handling, and outcome observation.
14+
Verify the std adaptor can consume outcomes without exposing raw locks or association references.
15+
4. Add lane-targeted flush delivery to `RemoteTransport` and `TcpRemoteTransport`.
16+
Verify writer-lane targeting, lane 0 handling, backpressure, inbound request routing, and ack send failures.
17+
5. Add std flush gate for remote-bound `DeathWatchNotification` and update `RemotingExtensionInstaller::shutdown_and_join`.
18+
Verify timeout/start-failure/completion all release pending shutdown or notification paths.
19+
6. Run the OpenSpec-requested verification commands and update the remote gap analysis when implementation is complete.

modules/remote-adaptor-std/src/extension_installer.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#[path = "extension_installer_test.rs"]
66
mod tests;
77

8+
mod flush_gate;
89
mod remoting_extension_installer;
910

11+
pub(crate) use flush_gate::{StdFlushGate, StdFlushNotification};
12+
pub(crate) use remoting_extension_installer::RemoteProviderFlushHandles;
1013
pub use remoting_extension_installer::RemotingExtensionInstaller;

0 commit comments

Comments
 (0)