Skip to main content

SHEET 16 OF 49

/WORKFLOW

PART:
03 DOCUMENTATION
CIRCULATION:
PUBLIC
SOURCE:
pages/Workflow.astro
AS OF:
2026-12-03

TWO PATHS ACROSS THE BOUNDARY, AND WHAT EACH DOES WHEN IT FAILS

LAYOUT READING

GIVES:
RAIL MEASURE MARGIN
FOR:
THE CALL
TRACKS:
RAIL MEASURE

# READING_18

  1. a rail (the document's own contents, or the set it belongs to)
  2. a measure (72-88ch of prose, or `full` for a page that also carries grids)
  3. a margin (the notes, the facts, the aside) - or nothing, and then the measure takes the rail's side

LAND / FIELD RECORD / TECHNICAL

# WORKFLOW_01

TWO PATHS, ONE DESTINATION

The two paths a call takes across the boundary, the branch that decides between them, and what each one does when it fails.

WORKFLOWTRACED

STATUSACTIVE
PATHS:
2 a Tauri command from the renderer, a gRPC request from the host
STAGES:
5 per path, the same five questions answered at the same step
COMMANDS:
154 distinct command literals, across 277 match arms in one file
BRANCHES:
8 three tier values, a per-subsystem override, and four in-flight conditions
FAILURES:
5 the variants a caller can act on, of fourteen declared
LICENCE:
CC0

LAND:

FOLLOW THE CALL

/THE TWO PATHS

A call leaves by one of two doors

The workbench is one process and the extension host is another, and each has its own way of asking the host for something. The renderer sends a Tauri command: a name and a JSON array. The extension host sends a gRPC request: a name, an identifier and a JSON byte array. Both end in the same place.

/THE CALL

PATHS:

2

SOURCE: SOURCE/CONTENT/DOC/ARCHITECTURE.MD

STAGES:

5 PER PATH

SOURCE: SOURCE/CONTENT/DOC/ARCHITECTURE.MD

COMMANDS:

154

SOURCE: LAND/ELEMENT/MOUNTAIN/SOURCE/IPC/WINDSERVICEHANDLERS/DISPATCHMATCH.RS

ARMS:

277

SOURCE: LAND/ELEMENT/MOUNTAIN/SOURCE/IPC/WINDSERVICEHANDLERS/DISPATCHMATCH.RS

SUBSYSTEMS:

31 MODULES

SOURCE: LAND/ELEMENT/MOUNTAIN/SOURCE/IPC/WINDSERVICEHANDLERS/MOD.RS

TIER VALUES:

3

SOURCE: SOURCE/CONTENT/DOC/ARCHITECTURE.MD

ERROR VARIANTS:

14

SOURCE: LAND/ELEMENT/VINE/SOURCE/ERROR.RS

The 7 extents of the call this page can count. The stage figure is per path rather than a total: the two paths are read separately, and a sum of their stages would imply they run one after the other.

PATH A / THE RENDERER

STATUS: ACTIVE

A workbench service in `Wind` calls a Tauri command through `invoke()`. The command is a string and the arguments are a JSON array, and both land in one function in `Mountain` - `mountain_ipc_invoke` - whose match block routes the string to a handler. The answer is a JSON value or a string, and there is no port involved: this is in-process IPC between the webview and its host.

SOURCE: SOURCE/CONTENT/DOC/ARCHITECTURE.MD

  BOTH END IN THE HOST

PATH B / THE EXTENSION HOST

STATUS: ACTIVE

An extension calls `vscode.*` in `Cocoon`, and the shim turns it into a `GenericRequest` - an identifier, a method name and a JSON byte array - and sends it over gRPC to port 50051. `Mountain` answers with a `GenericResponse` carrying either a result or an `RPCError`. When `Mountain` has no handler for the method, the shim runs a Node implementation in `Cocoon` instead.

SOURCE: LAND/ELEMENT/COCOON/SOURCE/SERVICES/DUAL/TRACK.TS

Two paths, one destination. A renderer call and an extension call both end in `Mountain`, and the difference is the mechanism: a Tauri command on a named string, or a protobuf request on a method name. The extension path has a third ending the renderer path does not - the Node fallback - and it is the next chapter's subject.

STARTS IN:
WIND OR COCOON the renderer's service layer, or the extension host's `vscode` shim
CARRIES:
A NAME AND A PAYLOAD a command string plus a JSON array, or a method name plus a JSON byte array
ANSWERS:
MOUNTAIN one handler per name, in a match block or behind a gRPC service
OR:
COCOON, IN NODE only on the extension path, and only when `Mountain` reports the method unknown
NEVER:
A REFERENCE nothing crosses a boundary by pointer - every argument is serialised on one side and read on the other

SOURCE: SOURCE/CONTENT/DOC/ARCHITECTURE.MD NEITHER PATH IS A FAST PATH AND A SLOW ONE THE FALLBACK IS THE NEXT CHAPTER

/THE RENDERER PATH

Five moves, and the fourth is a match block

A workbench service picks a command name from a constant, hands it to `invoke()`, and the host matches it against one of 154 command names across 277 arms in one file. The rail is five one-line steps because that is what a reader debugging a call needs: the position, not a paragraph about the position.

  1. 01 THE SERVICE STATUS: VERIFIED
    A `Wind` effect service is asked for the capability.

    `Wind` implements roughly forty effect services - `IPC`, `Configuration`, `Editor`, `Terminal`, `Clipboard`, `Dialog`, `FileSystem`, `Window` - composed into three layer stacks. `TauriLiveLayer` is the one a shipped build uses, backed by an eager `ManagedRuntime` held on `globalThis.__CEL_WIND_RUNTIME__` so a service lookup costs no construction.

  2. 02 THE WIRE STRING STATUS: VERIFIED
    The service picks its command name from a constant.

    A read picks its wire string from `MountainCommands.READ` rather than typing the string at the call site - which is what makes a command name a fact with one owner instead of a literal in two files that can drift.

  3. 03 THE INVOKE STATUS: VERIFIED
    `invoke()` crosses the webview boundary with a name and a JSON array.

    `@tauri-apps/api`'s `invoke()` is the only door out of the renderer. It takes the command string and a JSON array of arguments, and it has no port and no socket: the webview and its host share a process boundary the platform provides.

  4. 04 THE DISPATCH STATUS: VERIFIED
    `mountain_ipc_invoke` matches the string against one of 154 command names.

    One file in `DispatchMatch.rs` - 2,669 lines, 277 match arms - holds the routing table, and 154 distinct command literals are its keys. Its own header forbids adding an arm there: a new command is a subsystem atom under `WindServiceHandlers/<Subsystem>/` and the arm delegates to it.

  5. 05 THE HANDLER STATUS: VERIFIED
    A subsystem atom runs, and answers with a JSON value.

    Thirty-one modules - `FileSystem`, `Terminal`, `Search`, `Git`, `Storage`, `TreeView`, `Update` and the rest - each hold their own atoms. The return type is `Result<serde_json::Value, String>`, so a failure is a string at this boundary and not a typed error.

THE ENTRY POINT rust
pub async fn mountain_ipc_invoke(
    ApplicationHandle: tauri::AppHandle,
    command: String,
    Arguments: Vec<serde_json::Value>,
) -> Result<serde_json::Value, String>

pub fn register_wind_ipc_handlers(
    ApplicationHandle: &tauri::AppHandle,
) -> Result<(), String>

`register_wind_ipc_handlers` is what makes the arms reachable at all: a handler that is declared and never registered is a command that fails on the first call.

SOURCE: LAND/ELEMENT/MOUNTAIN/SOURCE/IPC/WINDSERVICEHANDLERS/DISPATCHMATCH.RS TWO SIGNATURES, VERBATIM

# TRACE / /THE CALL 04 STEPS

  1. 01 Source/Content/doc/architecture.md THE PROCESS MODEL, THE IPC MATRIX AND THE TIER SWITCH
  2. 02 Land/Element/Mountain/Source/IPC/WindServiceHandlers/DispatchMatch.rs THE RENDERER PATH'S ROUTING TABLE
  3. 03 Land/Element/Cocoon/Source/Services/Dual/Track.ts THE EXTENSION PATH'S BRANCH AND ITS THREE LOG LINES
  4. 04 Land/Element/Vine/Source/Error.rs THE FOURTEEN VARIANTS AND THEIR RECOVERABILITY

SOURCE: LAND/ELEMENT/MOUNTAIN/SOURCE/IPC/WINDSERVICEHANDLERS/DISPATCHMATCH.RS LAND/ELEMENT/COCOON/SOURCE/SERVICES/DUAL/TRACK.TS A STAGE IS A DECLARATION READ OUT OF SOURCE, NOT A CAPTURED RUN

SOURCE: LAND/ELEMENT/MOUNTAIN/SOURCE/IPC/WINDSERVICEHANDLERS/DISPATCHMATCH.RS THE DISPATCH TABLE'S OWN HEADER FORBIDS A NEW ARM THERE A FAILURE AT THIS BOUNDARY IS A STRING

/THE EXTENSION PATH

The same five questions, one field different

The extension path answers the same five questions at the same five steps, which is what makes the two rails comparable. The divergence is at stage three: a method name instead of a command string, and a protobuf field instead of a JSON array - so the frame is checked by the schema and the contents are checked by nobody until the far side decodes them.

  1. 01 THE EXTENSION STATUS: VERIFIED
    An extension calls a `vscode.*` method in the extension host.

    `Cocoon` loads the stock VS Code `extHost*.ts` sources and supplies the RPC glue beside them, so the API an extension was written against is the API it calls.

  2. 02 THE SHIM STATUS: VERIFIED
    The shim decides: `Mountain` first, Node second.

    `TryMountainThenNode` wraps the call. It is the only decision on this path, and it is made per method rather than per namespace.

  3. 03 THE REQUEST STATUS: VERIFIED
    A `GenericRequest` carries the identifier, the method and a JSON byte array.

    `RequestIdentifier` is a `uint64` the response must carry back; `Method` is the handler name, spelled as the host knows it - `Workspace.FindTextInFiles`, not `workspace.findTextInFiles`; `Parameter` is the arguments JSON-serialised into `bytes`.

  4. 04 THE CROSSING STATUS: VERIFIED
    gRPC carries it to port 50051, or to 50052 in the other direction.

    `Mountain` binds 50051 and `Cocoon` binds 50052, and each hosts the service the other calls. The streaming channel multiplexes every notification, request and response over one h2 stream, routing by `correlation_id` or by channel.

  5. 05 THE ANSWER STATUS: VERIFIED
    A `GenericResponse` carries the result, or an `RPCError`.

    `Result` is the JSON-serialised value; `error` is present only on failure, and it is a `RPCError` with a numeric `Code`, a `Message` and optional `Data` - shaped as a JSON-RPC error object rather than as a string.

THE EXCHANGE proto
message GenericRequest {
  uint64 RequestIdentifier = 1;
  string Method = 2;
  bytes Parameter = 3;   // JSON-serialised arguments
}

message GenericResponse {
  uint64 RequestIdentifier = 1;
  bytes Result = 2;      // JSON-serialised result
  optional RPCError error = 3;
}

`error` is `optional`, so a successful response carries no error field at all rather than an empty one - which is why a client must test for presence and not for emptiness.

SOURCE: LAND/ELEMENT/VINE/PROTO/VINE.PROTO

SOURCE: LAND/ELEMENT/VINE/PROTO/VINE.PROTO LAND/ELEMENT/COCOON/SOURCE/SERVICES/DUAL/TRACK.TS THE SCHEMA CHECKS THE FRAME, NOT THE CONTENTS

/THE BRANCHES

Where the path forks

Eight conditions change what a call does, and they are of three kinds: a switch read before the call leaves, a branch taken on the answer, and four conditions that belong to a call already in flight. The switch is a runtime variable - no rebuild - which is why the same build can serve every handler from the host or from the extension host.

SOURCE: SOURCE/CONTENT/DOC/ARCHITECTURE.MD LAND/ELEMENT/COCOON/SOURCE/SERVICES/DUAL/TRACK.TS A TIER VARIABLE IS READ AT RUNTIME AND NEVER AT BUILD
BRANCH CONDITION WHAT HAPPENS OWNER
TierIPC=Mountain the default every IPC call routes to `Mountain` `.env.Land`
TierIPC=NodeDeferred a gradual migration `Mountain` first; on a miss or an `undefined` return, the `cocoon:request` bridge `.env.Land`
TierIPC=Node a handler that lives in the extension host every call routes to `Cocoon` directly and `Mountain` is bypassed `.env.Land`
Tier<Subsystem> one channel prefix differs from the global the per-subsystem variable wins - `TierTasks=Node` and `TierAuth=Node` are the defaults even when `TierIPC=Mountain` `.env.Land`
Unknown method `Mountain` has no handler for the name `IsUnknownMethodError` is true, `LogRoute` records `node-fallback`, and the Node implementation runs LAND/ELEMENT/COCOON/SOURCE/SERVICES/DUAL/TRACK.TS
Both fail the Node fallback throws too the original error propagates and `LogRoute` records `route=error` LAND/ELEMENT/COCOON/SOURCE/SERVICES/DUAL/TRACK.TS
Stale channel a frame arrives on a pre-reconnect stream `ChannelId` no longer matches the id observed at channel-open time, so the frame is detectable as stale LAND/ELEMENT/VINE/PROTO/VINE.PROTO
Cancel a long-running request must stop `CancelOperation` asks by identifier, best-effort - the receiver chooses whether to honour it LAND/ELEMENT/VINE/PROTO/VINE.PROTO

SOURCE: SOURCE/CONTENT/DOC/ARCHITECTURE.MD LAND/ELEMENT/COCOON/SOURCE/SERVICES/DUAL/TRACK.TS A TIER VARIABLE IS READ AT RUNTIME AND NEVER AT BUILD

/THE FAILURES

Five conditions with a next step

`Error.rs` declares fourteen variants and gives each a recoverability predicate. These are the five a caller has to decide about, because the other nine are conditions it cannot act on. Each row prints the variant's own message, the cause the tree states, and the step its recovery names - a failure written as prose loses the next step.

FAILURE_01 THE SIDECAR IS NOT IN THE POOL

STATUS: UNAVAILABLE

SYMPTOM:
SideCar '<name>' not found or its gRPC client channel is not ready.
CAUSE:
`ClientNotConnected` - the connection pool has no entry for that sidecar, which happens when the call is made before `ConnectToSideCar` has completed. `Cocoon` binds its own server before it connects for exactly this reason.
NEXT:
Wait for `WaitForClientConnection` rather than retrying the call: the pool is the readiness signal, and a retry against an unconnected pool burns the same failure.

SOURCE: LAND/ELEMENT/VINE/SOURCE/ERROR.RS LAND/ELEMENT/VINE/SOURCE/CLIENT/WAITFORCLIENTCONNECTION.RS

FAILURE_02 THE CONNECTION DROPS

STATUS: INTERRUPTED

SYMPTOM:
Connection to sidecar '<name>' was lost
CAUSE:
`ConnectionLost` - an established channel went away, typically because the sidecar process exited. It is recoverable, which is why the pool reconnects with exponential backoff instead of surfacing it.
NEXT:
Treat it as recoverable and let the pool reconnect; a caller that surfaces this failure to the reader is reporting a state the client is already fixing.

SOURCE: LAND/ELEMENT/VINE/SOURCE/ERROR.RS

FAILURE_03 THE CALL OUTLIVES ITS BUDGET

STATUS: INTERRUPTED

SYMPTOM:
Request to sidecar '<name>' (method: '<method>') timed out after <n>ms
CAUSE:
`RequestTimeout` - the request exceeded the timeout its dispatch was given. The message carries the sidecar, the method and the budget, so a reader can tell a slow handler from a short timeout without reading the caller.
NEXT:
Retry with a longer budget only if the method is known to be slow; otherwise the timeout is the finding, and the handler is the place to look.

SOURCE: LAND/ELEMENT/VINE/SOURCE/CLIENT/SENDREQUEST.RS

FAILURE_04 THE PAYLOAD IS TOO LARGE

STATUS: UNAVAILABLE

SYMPTOM:
Message size <actual> bytes exceeds maximum allowed size <max> bytes
CAUSE:
`MessageTooLarge` - the encoded message exceeded `MAX_MESSAGE_SIZE`, which is 4 MB. The limit is applied per service wrapper before `add_service`, so the failure is raised at the envelope boundary rather than inside a handler.
NEXT:
Nothing on the wire is chunked - a payload over the limit has to be sent as a reference the far side can fetch, or the operation has to move to a channel that is not one message.

SOURCE: LAND/ELEMENT/VINE/SOURCE/ERROR.RS LAND/ELEMENT/VINE/SOURCE/SERVER/CONSTANTS.RS

FAILURE_05 THE MESSAGE WILL NOT DECODE

STATUS: INTERRUPTED

SYMPTOM:
JSON serialization error for gRPC payload: <detail>
CAUSE:
`SerializationError` - `Parameter` and `Result` are JSON inside a `bytes` field, so a payload that is not valid JSON fails on the far side rather than at the call site. This is the cost of a generic envelope: the schema checks the frame and not the contents.
NEXT:
Read the `detail` against the method's own argument shape - the failure names the decode, not the argument, and the argument is what a reader has to compare.

SOURCE: LAND/ELEMENT/VINE/SOURCE/ERROR.RS

SOURCE: LAND/ELEMENT/VINE/SOURCE/ERROR.RS A RECOVERABLE FAILURE IS THE POOL'S TO FIX, NOT THE READER'S A DEAD END WOULD BE THE ABSENCE OF A DESIGN

NEXT: /BLOG 04 BLOG

NOTES FROM THE BUILD, NEWEST FIRST

〈16〉 /WORKFLOW 49 SHEETS AS OF: 2026-12-03