Skip to content

test: pair orchestration federation against the two newest releases - #19816

Open
Jinwoo-H wants to merge 1 commit into
mainfrom
test/cross-version-orchestration-wire
Open

Jinwoo-H wants to merge 1 commit into
mainfrom
test/cross-version-orchestration-wire

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1272 $\color{#cf222e}{\Huge{\mathbf{−}}}$​11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1261
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​46 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​41

What the user notices

Before: A user updates their desktop while their worker host is still on the previous
release (or the reverse — the common case, because the two update on their own schedules).
They run orca orchestration worker-start --on <server> .... The host refuses the attach with
Missing Run ID, the worker never starts, and nothing in CI saw it coming: this is #19689,
shipped 2026-09-08. Every federation "old peer" test in the tree writes a protocol_version
integer into a database row and reads it back with the same build, so a coordinator that
stops sending a field and a host that starts requiring one are both invisible.
git grep -i orchestration tests/e2e/cross-version-wire/* returned nothing.

After: The same skew runs on every PR that touches federation source. A released
coordinator's real startFederatedWorker composes the attach params, a released host's real
dispatcher validates them, and the PR that makes runId required goes red naming the exact
pairing and the exact error. The user's worker-start keeps working across the release boundary.

The delete question

Deleted: nothing was removed from src/. Three things were removed from the shape of the
change rather than added beside it:

  • selectLatestStableReleaseTag is now a one-line delegation to the new
    selectStableReleaseTags(tags, count) instead of a second sort/filter/.at(-1) chain, and
    resolveBaselineReleaseRef a one-line delegation to resolveBaselineReleaseRefs(count).
    There is one tag-selection path, not two, so the single-baseline suites and the two-baseline
    suite cannot disagree about what "newest" means.
  • The PR-workflow pin is derived from readdirSync(tests/e2e/cross-version-wire) rather than a
    hand-maintained list of six paths. A future suite that nobody adds to the job fails the
    contract test instead of quietly covering nothing — which is the class of miss this whole
    workstream exists to close. The one file that was in the directory but not in the job
    (published-field-shape.unit.test.ts) is now in the job, so the derivation is exact.
  • No new comparison oracle: the Rule 3 check reuses comparePublishedFields from
    published-field-shape.ts. The only addition is publishedFieldPaths, which flattens a
    payload to dotted names so a field removed from setup/launch/attachment/observation
    cannot hide behind an intact top level.

What could not be deleted: the two-baseline rule cannot collapse to one. v1.4.199 (cut
2026-09-09) already contains #19689's fix, so a suite pairing only against the newest tag
cannot see the bug it was written for. That is the point, and it is stated in the doc.

Proof

Both scratch edits were local-only and reverted with git checkout -- <that file>.

Proof 1 — runId required again on federationAttachStart (#19689's exact change)

Scratch edit in src/main/runtime/rpc/methods/orchestration/federation/federation-start-schema.ts:
runId: OptionalString → runId: requiredString('Missing Run ID').

$ ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts \
    tests/e2e/cross-version-wire/cross-version-orchestration-wire.unit.test.ts

 ❯ tests/e2e/cross-version-wire/cross-version-orchestration-wire.unit.test.ts (35 tests | 5 failed) 5070ms
 FAIL  ... > against v1.4.198 > starts a federated worker from the old coordinator against the new host
AssertionError: v1.4.198 coordinator -> working-tree host was refused:
  {"code":"invalid_argument","message":"Missing Run ID"}: expected { code: 'invalid_argument', …(1) } to be null

- Expected:
null

+ Received:
{
  "code": "invalid_argument",
  "message": "Missing Run ID",
}

 FAIL  ... > against v1.4.198 > has each build accept the other build’s outgoing attach params
AssertionError: expected [Function] to not throw an error but '[\n  {\n    "origin": "string",\n    …' was thrown
+ Received:
"[
  {
    \"origin\": \"string\",
    \"code\": \"too_small\",
    \"minimum\": 1,
    \"inclusive\": true,
    \"path\": [ \"runId\" ],
    \"message\": \"Missing Run ID\"
  }
]"

 FAIL  ... > against v1.4.198 > reads and shows the worker across the skew in both directions
 FAIL  ... > against v1.4.198 > relays mail both ways across the skew
 FAIL  ... > against v1.4.198 > only ever loses a step the old build genuinely cannot take

 Test Files  1 failed (1)
      Tests  5 failed | 30 passed (35)

Note the v1.4.199 pairing stayed green through all five failures: v1.4.199 already sends
runId. Pairing against the newest tag alone would have shipped this a second time.

Proof 2 — a field removed from what the host publishes in the attach receipt

Scratch edit in .../federation/federation.ts: drop setup, from the ready-receipt return.

$ ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts \
    tests/e2e/cross-version-wire/cross-version-orchestration-wire.unit.test.ts

 FAIL  ... > against v1.4.199 > still publishes every orchestration.federationAttachStart field the old peer reads
AssertionError: orchestration.federationAttachStart dropped fields a v1.4.199 peer reads:
  expected [ 'setup.effective', …(5) ] to deeply equal []

- Expected
+ Received

- []
+ [
+   "setup.effective",
+   "setup.hookFound",
+   "setup.requested",
+   "setup.source",
+   "setup.startupPolicy",
+   "setup.state",
+ ]

 FAIL  ... > against v1.4.198 > still publishes every orchestration.federationAttachStart field the old peer reads
   (identical removed list)

 Test Files  1 failed (1)
      Tests  2 failed | 33 passed (35)

Green on the branch, twice

$ ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts \
    tests/e2e/cross-version-wire/cross-version-orchestration-wire.unit.test.ts \
    tests/e2e/cross-version-wire/release-checkout.unit.test.ts
 Test Files  2 passed (2)
      Tests  50 passed (50)
   Duration  11.38s

$ ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts \
    tests/e2e/cross-version-wire/cross-version-orchestration-wire.unit.test.ts \
    tests/e2e/cross-version-wire/release-checkout.unit.test.ts \
    config/scripts/cross-version-wire-lane-contract.test.mjs \
    config/scripts/pr-code-change-scope.test.mjs \
    config/scripts/pr-e2e-gate-contract.test.mjs
 Test Files  5 passed (5)
      Tests  125 passed (125)
   Duration  10.89s

The whole directory, to prove the release-checkout.ts change did not break the existing four
suites:

$ ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts \
    tests/e2e/cross-version-wire/
 Test Files  7 passed (7)
      Tests  88 passed (88)

Wire / SSH / folder workspace

  • Wire: this PR is wire coverage and changes no wire shape. It adds no field, opcode, or
    capability. It pins three invariants: a released coordinator's attach params stay acceptable
    to the current host's zod schema (Rule 2), every field a released peer's receipt parser reads
    is still published (Rule 3, compared as dotted paths), and the orchestration.* method-name
    set only grows (Rule 3 for an orca CLI or coordinator calling an older verb name). It also
    pins that ORCHESTRATION_CONTRACT_VERSION is equal across all three builds, because a bump
    fences every unupdated peer out of every orchestration mutation at once.
  • SSH: unaffected in behaviour, and deliberately not covered. The journey exercises the
    wire, not the transport: an SSH-hosted worker host exchanges the same params and receipts, but
    ssh-channel-multiplexer re-encodes them and that hop is not in this suite. Liveness stays
    live / unverifiable / exited throughout — the fleet degradation asserted here produces
    capability_unsupported on the host-error channel, never a fabricated verdict.
  • Folder workspace: unaffected. The journey pins the worker to an exact existing worktree
    selector (id:...) and an existing agent terminal, so it never reaches
    assertOrchestrationWorktreeCreationSupported. Folder-vs-git placement is covered by
    federation-folder-placement.test.ts (same-build) and is orthogonal to version skew.

Testing

Gate Result
pnpm tc exit 0
pnpm exec tsc --noEmit -p config/tsconfig.e2e.json, filtered to the new files 0 errors (the two pre-existing errors in this project are cross-version-agent-session-wire.unit.test.ts:610 and release-checkout.ts:9, both on main)
pnpm exec vitest run --config config/vitest.config.ts tests/e2e/cross-version-wire/ 7 files / 88 tests passed
new suite + release-checkout.unit.test.ts, run 1 2 files / 50 tests passed
new suite + release-checkout + 3 CI-contract tests, run 2 (flake) 5 files / 125 tests passed
pnpm run check:code-quality:changed 0 new findings across 9 changed files — passed
pnpm run check:react-doctor:changed exit 0, 0 new findings
pnpm exec oxlint <changed paths> exit 0 (no max-lines; largest new file is 311 lines)
git diff --check clean
git status clean, nothing untracked

Proof commands and their red output are in Proof above.

#19689 shipped because no lane paired two builds over `orchestration.*`. The
cross-version harness only covered the terminal stream and `agentSession.*`, and
every federation "old peer" test wrote a protocol_version integer into a row and
read it back with the same build, so a coordinator that omits a field and a host
that starts requiring it were both invisible.

Pairing against the newest tag alone would not have caught it either: the newest
tag already contains the fix for anything broken and repaired inside the last
release cycle. A worker host and the desktop that dispatches to it update on
their own schedules, so N-1 is an ordinary peer. The suite therefore extracts the
two newest stable tags and runs both skew directions against each.

Each pairing drives one journey through the real coordinator modules —
`startFederatedWorker` composes the attach params, `syncFederatedDispatch` drives
the relay — against the peer build's real dispatcher over its real store, with a
JSON round trip so an `undefined` field drops exactly as on the wire. What the old
side has is read from its checkout; nothing about a release is written down.

`pr-code-change-scope.mjs` did not route orchestration source at this job, so the
lane would not have run on the PR that broke it; the federation source prefixes
are added with cases in its test. The job's file list is now derived from the
directory, so a new suite that is never named in the workflow fails instead of
covering nothing.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — cross-version coverage for the orchestration federation surface, pairing current code against the two newest releases, plus the harness, lane wiring, scope classification, contract test, and docs that keep it honest.

  • cross-version-orchestration-wire.unit.test.ts — new suite (311 lines, 35 tests) pairing federationAttachStart, federationFleetSnapshot, federationShow, federationRead, and the federationPull/Ack/Import relay loop against two baselines.
  • orchestration-federation-peers.ts, orchestration-skew-journey.ts, versioned-orchestration-wire.ts — the peer/journey/loader harness that drives each build's real startFederatedWorker, RpcDispatcher, and OrchestrationDb over a JSON round trip, so it fails on what a release actually sends.
  • release-checkout.ts — selectStableReleaseTags(tags, count) / resolveBaselineReleaseRefs(count) generalize single-baseline selection; the single-baseline paths delegate so the two cannot disagree about "newest".
  • config/scripts/cross-version-wire-lane-contract.test.mjs — new contract test deriving the lane's file list from the directory so a silently-uncovered suite fails CI.
  • config/scripts/pr-code-change-scope.mjs + test — new orchestration federation prefixes so host-side-only changes (the #19542 miss) still select the lane.
  • .github/workflows/pr.yml — adds the two suites to the cross-version lane.
  • docs/reference/remote-wire-compatibility.md — documents the two-baseline rationale and the rules.

ℹ️ Federation module surface becomes a versioned contract for the harness

The MODULE_ALIASES table plus the pick/required calls in versioned-orchestration-wire.ts turn the orchestration federation module layout and export names into an implicit contract. Any future reorganization of those modules — moving a file, renaming one of the twelve picked exports, or folding a new method into the surface — must be updated in the same PR, or the cross-version lane goes red on unrelated PRs the moment that change ships as a release baseline. This is the intended "fail loudly instead of silently covering less" trade-off and it is documented, but it is a recurring maintenance cadence to be deliberate about when reorganizing orchestration RPC files.

Technical details
# Federation module surface is now a versioned contract for the harness

## Affected sites
- tests/e2e/cross-version-wire/versioned-orchestration-wire.ts — MODULE_ALIASES (dispatcher, methodRegistry,
  protocol, db, orchestrationError, federationSync, controlMessage, federatedWorkerStart, workerObservation,
  legacyFederatedRead, attachStartSchema, fleetSnapshot) + pick/required over RpcDispatcher, OrchestrationDb,
  OrchestrationError, FederationAttachStartParams, ALL_RPC_METHODS, startFederatedWorker,
  callFederatedWorkerShow, readLegacyFederatedTerminal, syncFederatedDispatch, encodeFederatedControlMessage,
  readFederatedFleetSnapshots.

## Required outcome
- None for this PR; informational. The hazard is a future PR that renames/moves one of these modules or
  exports and lands without updating the table, reddening the lane for everyone else when that release is
  next picked as a baseline.

## Suggested approach (optional)
- None. The error messages ("add its path to MODULE_ALIASES rather than skipping the pairing") already direct
  the fix; no change requested here.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

📝 Walkthrough

Walkthrough

The change adds release-based orchestration wire testing across two stable baselines and both skew directions. It adds loaders for working-tree and released builds, federation peer fixtures, orchestration journeys, and compatibility assertions for methods, schemas, fields, capabilities, and relay behavior. It updates release-tag selection to support multiple baselines. CI now runs the new suites, lane contracts verify workflow coverage, source-path classification includes federation surfaces, and documentation describes the coverage.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to e442e

The new compatibility lane can either fail before exercising its intended baselines or miss important federation and nested-suite regressions. These coverage gaps should be fixed before relying on the lane for release-skew safety.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 9 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: testing orchestration federation against the two newest releases.
Description check ✅ Passed The description is detailed and directly explains the problem, solution, compatibility scope, proof of failure detection, and test results. It references issue #19689 and explains that visual changes …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 9 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: ce0a6ded-6bdb-41fb-930a-553db4012299

📥 Commits

Reviewing files that changed from the base of the PR and between aac38d6 and e442e4f.

📒 Files selected for processing (11)
  • .github/workflows/pr.yml
  • config/scripts/cross-version-wire-lane-contract.test.mjs
  • config/scripts/pr-code-change-scope.mjs
  • config/scripts/pr-code-change-scope.test.mjs
  • docs/reference/remote-wire-compatibility.md
  • tests/e2e/cross-version-wire/cross-version-orchestration-wire.unit.test.ts
  • tests/e2e/cross-version-wire/orchestration-federation-peers.ts
  • tests/e2e/cross-version-wire/orchestration-skew-journey.ts
  • tests/e2e/cross-version-wire/release-checkout.ts
  • tests/e2e/cross-version-wire/release-checkout.unit.test.ts
  • tests/e2e/cross-version-wire/versioned-orchestration-wire.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.

Comment on lines +19 to +22
const onDisk = readdirSync(join(projectDir, crossVersionDir))
.filter((name) => name.endsWith('.unit.test.ts'))
.map((name) => `${crossVersionDir}/${name}`)
.sort()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Discover nested cross-version suites recursively.

config/vitest.config.ts supports nested tests/e2e/**/*.unit.test.ts files, but the workflow passes suite paths explicitly. A nested suite can therefore remain unlisted and untested while this nonrecursive scan still passes. Recurse while keeping the .unit.test.ts convention.

♻️ Proposed change
- import { join, resolve } from 'node:path'
+ import { join, resolve, sep } from 'node:path'
...
-    const onDisk = readdirSync(join(projectDir, crossVersionDir))
+    const onDisk = readdirSync(join(projectDir, crossVersionDir), { recursive: true })
+      .map((name) => name.split(sep).join('/'))
       .filter((name) => name.endsWith('.unit.test.ts'))
       .map((name) => `${crossVersionDir}/${name}`)
       .sort()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const onDisk = readdirSync(join(projectDir, crossVersionDir))
.filter((name) => name.endsWith('.unit.test.ts'))
.map((name) => `${crossVersionDir}/${name}`)
.sort()
import { join, resolve, sep } from 'node:path'
const onDisk = readdirSync(join(projectDir, crossVersionDir), { recursive: true })
.map((name) => name.split(sep).join('/'))
.filter((name) => name.endsWith('.unit.test.ts'))
.map((name) => `${crossVersionDir}/${name}`)
.sort()

Comment on lines +209 to +215
callOrchestrationWorkerServer: async (
_environmentId: string,
method: string,
params: unknown,
_timeoutMs?: number,
meta?: { orchestrationRequestId?: string }
) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Description: Resolve the callOrchestrationWorkerServer contract and its federation call sites.
set -euo pipefail

# Declaration(s)
rg -nP --type=ts -C6 'callOrchestrationWorkerServer\s*[:(]' src | head -200

# Call sites with argument lists
ast-grep run --pattern '$RUNTIME.callOrchestrationWorkerServer($$$)' --lang typescript src

Repository: stablyai/orca

Length of output: 40211


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- changed test stub ---'
sed -n '170,235p' tests/e2e/cross-version-wire/orchestration-federation-peers.ts

printf '%s\n' '--- runtime contract ---'
sed -n '1,80p' src/main/runtime/orca-runtime-get-runtime-id.ts

printf '%s\n' '--- relevant type definitions ---'
rg -n -P -C4 'type RuntimeOrchestrationEnvelope|interface RuntimeOrchestrationEnvelope|type OrchestrationEnvironmentCallOptions|interface OrchestrationEnvironmentCallOptions' src

printf '%s\n' '--- all test references to the stub ---'
rg -n -P -C5 'callOrchestrationWorkerServer|orchestrationRequestId|expectedEnvironmentPairingRevision' tests/e2e/cross-version-wire/orchestration-federation-peers.ts

Repository: stablyai/orca

Length of output: 9671


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- federation start call and envelope handling ---'
sed -n '150,205p' src/main/runtime/rpc/methods/orchestration/federation/federated-worker-start.ts

printf '%s\n' '--- implementation of callOrchestrationWorkerServer ---'
rg -n -P -C12 'callOrchestrationWorkerServer\s*\(' src/main/runtime | head -160

printf '%s\n' '--- test assertions around recorded calls ---'
rg -n -P -C8 'attach-start|attachStart|requestId|pairing|calls|missing|recorded' tests/e2e/cross-version-wire/orchestration-federation-peers.ts

Repository: stablyai/orca

Length of output: 24200


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- transport implementation and pairing fence use ---'
rg -n -P -C12 'callWorkerServer\s*\(|expectedEnvironmentPairingRevision|pairingRevision' src/main/runtime/orchestration/environment-transport.ts src/main/runtime/orchestration

printf '%s\n' '--- cross-version test entry points and assertions ---'
rg -n -P -C8 'createFederationHomePeer|createFederationHostPeer|calls|federationAttachStart|pairingRevision' tests/e2e/cross-version-wire

Repository: stablyai/orca

Length of output: 50369


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- federation transport call implementation ---'
rg -l -P 'callWorkerServer\s*\(' src/main/runtime/orchestration src/main/runtime | head -20

Repository: stablyai/orca

Length of output: 301


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -P -C18 'callWorkerServer\s*\(' src/main/runtime/orchestration --glob '*.ts' | head -220

Repository: stablyai/orca

Length of output: 151


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -P -C22 'callWorkerServer\s*\(' src/main/runtime/runtime-orchestration-federation.ts

Repository: stablyai/orca

Length of output: 1618


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '66,125p' src/main/runtime/runtime-orchestration-federation.ts

Repository: stablyai/orca

Length of output: 2182


Preserve and validate the sixth internal argument in the stub.

callOrchestrationWorkerServer accepts the request envelope at position 5 and OrchestrationEnvironmentCallOptions at position 6. runtime-orchestration-federation.ts forwards expectedEnvironmentPairingRevision to both transport calls for mutation methods. The stub drops that argument and calls the host directly, so the cross-version harness bypasses the pairing-revision fence. Capture the sixth argument and apply the same revision check before dispatching the host call.

const override = process.env[BASELINE_REF_ENV]?.trim()
if (override) {
return override
return [override]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Keep the override contract compatible with two-baseline callers.

When ORCA_CROSS_VERSION_BASELINE_REF is set, this returns one ref even for resolveBaselineReleaseRefs(2). The new orchestration suite then requires two refs at cross-version-orchestration-wire.unit.test.ts Line 117 and fails before it runs a pairing. Its repository-backed unit test also assumes every override is a release tag, although this function accepts any ref.

Define a multi-ref override, or make the suite and its documentation handle an explicit one-ref pin consistently.

🧰 Tools
🪛 ast-grep (0.45.3)

[warning] Importing child_process exposes a command-execution surface; ensure any command/argument built from input is validated, and prefer execFile/spawn with an argument array over exec.
Context: import { execFileSync } from 'node:child_process'
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(detect-child-process-typescript)

Comment on lines +198 to +205
const methods = methodRegistry.ALL_RPC_METHODS as unknown[]

return {
label,
revision,
capabilities: capabilities as readonly string[],
protocolVersion: protocol.RUNTIME_PROTOCOL_VERSION as number,
orchestrationContractVersion: protocol.ORCHESTRATION_CONTRACT_VERSION as number,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Validate the build exports before constructing the wire snapshot.

The working-tree and release loaders read separate module sources. A missing export in one build fails the comparison. If both builds omit ORCHESTRATION_CONTRACT_VERSION, the contract check compares undefined values and passes. Both protocol values must be validated before they enter the build snapshot and peer status.

A missing ALL_RPC_METHODS currently reaches registeredMethodNames, which calls .flatMap and throws an unlabelled TypeError. It does not make method coverage pass, but the guard gives the build-specific failure used by the other surface checks.

🛡️ Proposed guards
-  const methods = methodRegistry.ALL_RPC_METHODS as unknown[]
+  const methods = methodRegistry.ALL_RPC_METHODS
+  if (!Array.isArray(methods)) {
+    throw new Error(`Build ${label} publishes no ALL_RPC_METHODS registry`)
+  }
+  const versionOf = (name: 'RUNTIME_PROTOCOL_VERSION' | 'ORCHESTRATION_CONTRACT_VERSION'): number => {
+    const value = protocol[name]
+    if (typeof value !== 'number') {
+      throw new Error(`Build ${label} publishes no numeric ${name}`)
+    }
+    return value
+  }
-    protocolVersion: protocol.RUNTIME_PROTOCOL_VERSION as number,
-    orchestrationContractVersion: protocol.ORCHESTRATION_CONTRACT_VERSION as number,
+    protocolVersion: versionOf('RUNTIME_PROTOCOL_VERSION'),
+    orchestrationContractVersion: versionOf('ORCHESTRATION_CONTRACT_VERSION'),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const methods = methodRegistry.ALL_RPC_METHODS as unknown[]
return {
label,
revision,
capabilities: capabilities as readonly string[],
protocolVersion: protocol.RUNTIME_PROTOCOL_VERSION as number,
orchestrationContractVersion: protocol.ORCHESTRATION_CONTRACT_VERSION as number,
const methods = methodRegistry.ALL_RPC_METHODS
if (!Array.isArray(methods)) {
throw new Error(`Build ${label} publishes no ALL_RPC_METHODS registry`)
}
const versionOf = (name: 'RUNTIME_PROTOCOL_VERSION' | 'ORCHESTRATION_CONTRACT_VERSION'): number => {
const value = protocol[name]
if (typeof value !== 'number') {
throw new Error(`Build ${label} publishes no numeric ${name}`)
}
return value
}
return {
label,
revision,
capabilities: capabilities as readonly string[],
protocolVersion: versionOf('RUNTIME_PROTOCOL_VERSION'),
orchestrationContractVersion: versionOf('ORCHESTRATION_CONTRACT_VERSION'),

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant