Commit d675c17
[rushd] Wire layer: protocol, transport & presentation (WS1) (#5922)
* [rushd] Wire layer: protocol, transport & presentation (WS1, #5896)
Add the engine-agnostic rushd wire layer as three new 0.x packages plus
additive rush-lib engine instrumentation:
- @rushstack/rush-daemon-protocol: frame taxonomy (0x01 control-json,
0x02/0x03 log-stdout/stderr, 0x04 stdin, 0x05 event), length-prefixed
binary codec, DAEMON_PROTOCOL_VERSION, hello/version negotiation with
typed mismatch errors, and per-subscription verbosity filtering at
serialization. Event envelope mirrors the @rushstack/reporter contract
as a placeholder pending its merge (#5858).
- @rushstack/rush-daemon-transport: workspace-key hashing, per-user
runtime-dir socket/pipe paths, net listener/connector with
backpressure, and PID/lockfile stale-socket reclaim.
- @rushstack/rush-terminal-renderer: client reporter host with
StreamCollator-backed per-op collation (byte-parity with legacy),
per-client verbosity, and FORCE_COLOR/COLUMNS child-env threading.
- rush-lib: optional internal IOperationGraphEventSink dual-emit
(structured status/activity/header events + per-op raw output tap)
with byte-identical legacy output.
- build-tests/rushd-wire-e2e-test: cross-layer conformance suite
(golden parity over a real socket, raw-stream integrity, verbosity
isolation, failure propagation).
- rigs: shared strict-codegen ESLint mixin for the new packages, with
inline suppression disabled (noInlineConfig).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 47388e8f-8d41-4ca4-819b-688ea6c510a2
* [rushd] Address WS1 review: protocol hardening, performance, and safety
Review pass over the wire-layer packages (#5922):
Protocol (@rushstack/rush-daemon-protocol):
- kind/payload naming throughout (frames + control messages); control
messages are a uniform { kind, payload } discriminated union so kind
reads stay monomorphic.
- Uint8Array wire payloads instead of Buffer, so the protocol is
platform-agnostic and drops the @types/node peer dependency.
- FrameDecoder uses ECMAScript private fields and accumulates received
bytes in a SegmentBuffer (no per-push Buffer.concat); payloads copy out
once per completed frame.
- encodeDaemonFrames returns a Uint8Array[] (no batch concat); the
transport writes parts sequentially.
- Containment checks use numeric ranges/Sets; the event-type list is
as-const with the union derived from it (list and type cannot drift).
- Error codes are a plain string union; DaemonProtocolError accepts
{ cause } per the standard Error convention.
- decodeDaemonEventFrame structurally validates envelopes (typed error
instead of routing malformed input); new isDaemonEventEnvelope guard.
- Envelope optional fields moved to the end of the layout; log chunk
encoding measures the id once and allocates the payload once; TS target
ES2022.
Transport (@rushstack/rush-daemon-transport):
- Decoder/handler failures in the socket callback now fail the connection
closed instead of crashing the daemon (new ConnectionRobustness test).
- Reclaim is serialized through a dedicated .reclaim mutex (wx create,
dead-PID steal) so a concurrent starter cannot unlink a socket another
process just bound; the daemon lockfile is written after bind so a
stale record never reads as a live owner.
Renderer/e2e: track the renames and Uint8Array decode boundary.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 47388e8f-8d41-4ca4-819b-688ea6c510a2
* [rushd] Fix CI: annotate literal lists to clear typedef warnings
rush retest runs with warnings-as-failures; the reviewer-requested
as-const literal lists tripped the friendly-locals @typescript-eslint/typedef
rule (variableDeclaration). Annotate DAEMON_EVENT_TYPES and
DAEMON_CONTROL_MESSAGE_KINDS with explicit literal-tuple types and derive the
unions from them, preserving the single-source-of-truth invariant (adding a
member requires updating the tuple annotation, which the compiler enforces via
the derived union) with zero lint warnings.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 47388e8f-8d41-4ca4-819b-688ea6c510a2
* chore: regenerate README package table (repo-toolbox readme)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 47388e8f-8d41-4ca4-819b-688ea6c510a2
* [rushd] Fix e2e golden comparison on Windows (OS newline normalization)
The renderer pipeline normalizes newlines to the OS default (CRLF on
Windows) via colorsNewlinesTransform, but the e2e test sink compared the
raw LF-carrying chunks, so the byte-parity assertions failed only on
Windows. Normalize the captured golden to the OS newline before
comparing so the test is platform-correct.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 47388e8f-8d41-4ca4-819b-688ea6c510a2
* [rushd] Fix e2e golden newline normalization to not double-apply CRLF
The previous OS-newline normalization mapped every LF to CRLF, producing
CRCRLF on Windows for text that already carried CRLF. Normalize only
lone-LF newlines (leave existing CRLF intact) so the golden comparison is
correct on both platforms.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 47388e8f-8d41-4ca4-819b-688ea6c510a2
* [rushd] Make e2e golden newline normalization idempotent
Collapse existing CRLF to LF before re-applying the OS newline, so the
golden comparison is correct on Windows (no CRCRLF) and a no-op on POSIX.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 47388e8f-8d41-4ca4-819b-688ea6c510a2
* [rushd] Emit OS newline for renderer global activity lines
The legacy collated pipeline normalizes to OS newlines via
TextRewriterTransform(OsDefault), but the renderer wrote global
activityChanged lines with a raw LF, producing mixed LF/CRLF output on
Windows. Write the client OS newline instead so global status lines and
collated blocks are byte-consistent.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 47388e8f-8d41-4ca4-819b-688ea6c510a2
---------
Co-authored-by: TheLarkInn <TheLarkInn@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 47388e8f-8d41-4ca4-819b-688ea6c510a21 parent c106ea9 commit d675c17
139 files changed
Lines changed: 7481 additions & 234 deletions
File tree
- build-tests/rushd-wire-e2e-test
- config
- src
- test
- common
- changes
- @microsoft/rush
- @rushstack
- rush-daemon-protocol
- rush-daemon-transport
- rush-terminal-renderer
- config
- rush
- subspaces/default
- reviews/api
- libraries
- rush-daemon-protocol
- config
- src
- test
- rush-daemon-transport
- config
- src
- test
- rush-lib/src
- logic/operations
- test
- rush-terminal-renderer
- config
- src
- test
- rigs
- decoupled-local-node-rig/profiles/default/includes/eslint/flat/mixins
- local-node-rig/profiles/default/includes/eslint/flat/mixins
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
| 107 | + | |
105 | 108 | | |
106 | 109 | | |
107 | 110 | | |
| |||
226 | 229 | | |
227 | 230 | | |
228 | 231 | | |
| 232 | + | |
229 | 233 | | |
230 | 234 | | |
231 | 235 | | |
| |||
| 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 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 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 | + | |
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
Lines changed: 57 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 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
Lines changed: 60 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 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
Lines changed: 43 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 | + | |
| 42 | + | |
| 43 | + | |
0 commit comments