Skip to content

test(server): pin the tailnet identity read after the Node probe - #1400

Merged
devswha merged 1 commit into
mainfrom
test/startup-order
Oct 19, 2026
Merged

devswha merged 1 commit into
mainfrom
test/startup-order

Conversation

@devswha

@devswha devswha commented Oct 19, 2026

Copy link
Copy Markdown
Owner

This answers one open question from the server/index.ts split: what keeps createServer's start-up order from breaking. Nothing pinned it, and #1384 broke it. That PR started the first tailnet identity read before the PTY sidecar's Node probe, and #1393 moved the read back. This PR pins the order that broke.

The order and why it matters

  • The Node probe (sidecarAvailable → isRealNode) is a Bun.spawnSync with a 3 s timeout.
  • The identity read times itself (2.5 s) from the moment it starts.
  • If the read starts first, the probe's wait counts against the read's limit.
  • A read cut short leaves the owner unknown for five minutes. With no token and nothing paired, another tailnet user then gets open access.

What changes

  • server/startup-order.test.ts (new). The test runs createServer with a probe that records itself and a TailnetIdentitySource whose status reader records itself. It waits for the read, then expects the probe first. I moved identityOf(false, null) back before createCore, as it was in refactor(server): route socket frames by type and build the core in createCore #1384, and the test failed with ["identity read", "probe"]. With the code as it is, the test passes.
  • The sidecar option also takes a function, a probe to run in place of the real one, the way terminalAttach already takes a value or a function. A boolean works exactly as before, so nothing else changes.
  • No changelog fragment. The change is a test seam and a test, and no user sees it.

The handoff's other order question was about the collector's first frame carrying live OmO and Claude status. It is left to createCore's comment: nothing has broken there, and it would need a much heavier test.

Verification

  • bun run typecheck is clean. The conventions tests pass.
  • Pins were every contract test that passes sidecar (conversation-push, api, usage-login) plus device-access (the tailnet access paths). Each ran with --rerun-each 3, on main first and then on this branch: 495 pass, 0 fail on main, 495 pass, 0 fail on the branch.
  • bun run check fast: 4,502 pass, 0 fail, 8 skip. bun run check integration: 589 pass, 0 fail, 1 skip.

🤖 Generated with Claude Code

#1384 started the first tailnet identity read before the PTY sidecar's
Node probe, a spawnSync that can hold the thread longer than the read's
own timeout; #1393 moved it back. Nothing tested that order. The sidecar
option now also takes a probe to run in place of the real one, and
startup-order.test.ts records the probe and the identity read and
expects the probe first. With the read moved back before createCore, it
fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6f03912b-ae4b-43f9-b911-df3e3d36e44b
📥 Commits

Reviewing files that changed from the base of the PR and between d5a74c0 and d3d345d.

📒 Files selected for processing: 3
  • server/core/server-core.ts
  • server/index.ts
  • server/startup-order.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Summary

Summary by CodeRabbit

  • New Features
    • Server configuration now accepts either a fixed on/off setting or a synchronous availability check for the sidecar. When no custom setting is provided, the existing default behavior remains unchanged. This gives deployments more flexibility in determining whether the sidecar is available at startup.

CoreOptions.sidecar and the createServer sidecar option accept a boolean or a synchronous boolean-returning function. createCore invokes the function when supplied and retains the existing fallback behavior. A startup test checks that the probe precedes the tailnet identity read.

Changes: Sidecar Probe Option

Layer / File(s) Summary
Sidecar probe option and startup order
server/index.ts, server/core/server-core.ts, server/startup-order.test.ts
The public option accepts a boolean or synchronous function. createCore invokes the function when supplied and preserves the existing fallback behavior. The startup test checks that the probe runs before the tailnet identity read.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to d3d34

The startup probe remains ahead of the tailnet identity read, and the new test checks that order. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: pinning the tailnet identity read after the Node probe.
Description check Passed The description directly explains the startup-order regression, the new test seam, the expected ordering, and the reported verification results.
Docstring Coverage Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@devswha
devswha merged commit 39c7bd1 into main Oct 19, 2026
17 checks passed
@devswha
devswha deleted the test/startup-order branch October 19, 2026 15:02
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