Commit 547bfef
feat(p2p): export P2PStatusInfo and DrainStatusInfo via ts-rs
The seeder's wait-for-drain helper previously hand-rolled the
P2PStatusInfo / DrainStatusInfo interfaces locally -- exactly the
kind of type-drift source the project has been burned by before.
Adds TS derives to P2PStatusInfo, DrainStatusInfo, and
ReplicationStatus so cargo test export_bindings generates canonical
TypeScript types into the storage-client-ts sdk. Seeder now imports
from the generated bindings instead of declaring its own.
P2PStatusInfo intentionally keeps snake_case on the wire because
multiple existing consumers (doorway federation/main/server routes,
elohim-app connection-indicator, simulate.sh, genesis Jenkinsfile)
already read snake_case field names from /p2p/status. Adding
rename_all = "camelCase" would have been a breaking wire change
for a polish commit. ts-rs emits the TypeScript type with snake_case
field names to match. DrainStatusInfo and ReplicationStatus keep
their existing camelCase (all their fields are single-word anyway).
usize fields on P2PStatusInfo and ReplicationStatus use
#[ts(type = "number")] to avoid the ts-rs bigint trap -- peer and
row counts here fit comfortably in a JS number.
Also fixes a latent bug in wait-for-drain: the log line referenced
status.connectedPeers, but the wire format is connected_peers, so
the peers suffix never rendered. Now uses the correct field.
Seeder @elohim/storage-client dependency flipped from "^0.1.0" to
"workspace:*" so pnpm actually resolves it from the monorepo workspace
instead of whatever registry snapshot was pinned. Without this the
new generated types would never reach the seeder's node_modules.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent b2296c0 commit 547bfef
File tree
9 files changed
+117
-35
lines changed- elohim
- elohim-storage/src/p2p
- sdk/storage-client-ts/src/generated
- genesis/seeder
- src
9 files changed
+117
-35
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
219 | 220 | | |
220 | 221 | | |
221 | 222 | | |
222 | | - | |
| 223 | + | |
223 | 224 | | |
| 225 | + | |
224 | 226 | | |
225 | 227 | | |
226 | 228 | | |
| |||
230 | 232 | | |
231 | 233 | | |
232 | 234 | | |
233 | | - | |
234 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
235 | 245 | | |
236 | 246 | | |
237 | 247 | | |
| 248 | + | |
238 | 249 | | |
239 | 250 | | |
| 251 | + | |
240 | 252 | | |
241 | 253 | | |
242 | 254 | | |
243 | 255 | | |
| 256 | + | |
244 | 257 | | |
245 | 258 | | |
246 | 259 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | | - | |
| 13 | + | |
13 | 14 | | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
| 21 | + | |
18 | 22 | | |
19 | 23 | | |
| 24 | + | |
20 | 25 | | |
21 | 26 | | |
22 | 27 | | |
| |||
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
111 | 112 | | |
112 | 113 | | |
113 | 114 | | |
| |||
157 | 158 | | |
158 | 159 | | |
159 | 160 | | |
| 161 | + | |
160 | 162 | | |
161 | 163 | | |
162 | 164 | | |
| |||
184 | 186 | | |
185 | 187 | | |
186 | 188 | | |
| 189 | + | |
187 | 190 | | |
188 | 191 | | |
189 | 192 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 29 | + | |
42 | 30 | | |
43 | 31 | | |
44 | 32 | | |
| |||
63 | 51 | | |
64 | 52 | | |
65 | 53 | | |
66 | | - | |
| 54 | + | |
67 | 55 | | |
68 | 56 | | |
69 | 57 | | |
| |||
74 | 62 | | |
75 | 63 | | |
76 | 64 | | |
77 | | - | |
| 65 | + | |
78 | 66 | | |
79 | 67 | | |
80 | 68 | | |
| |||
96 | 84 | | |
97 | 85 | | |
98 | 86 | | |
99 | | - | |
| 87 | + | |
100 | 88 | | |
101 | 89 | | |
102 | 90 | | |
| |||
108 | 96 | | |
109 | 97 | | |
110 | 98 | | |
111 | | - | |
112 | | - | |
| 99 | + | |
| 100 | + | |
113 | 101 | | |
114 | 102 | | |
115 | 103 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments