Skip to content

Cover automatic runtime selection in package QA - #32

Open
ndizazzo wants to merge 1 commit into
mainfrom
feat/client-auto-readiness-lane
Open

ndizazzo wants to merge 1 commit into
mainfrom
feat/client-auto-readiness-lane

Conversation

@ndizazzo

@ndizazzo ndizazzo commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Why

Package QA only ran plain client, and tests/client-readiness-smoke.test.ts explicitly asserted assert.doesNotMatch(source, /client --auto/). So the automatic runtime-selection path had no downstream coverage at all, even though upstream tests it in ci-client-auto-test.sh.

That upstream script can't be copied here. It is deliberately a public-mesh join test: it waits up to 300s for Nostr discovery and rejects the standalone fallback as evidence, on the grounds that only a real peer proves discovery works end to end. Correct for upstream, wrong as a gate on every package row.

What changed

MESH_LLM_SMOKE_MODE on the shared smoke, client (default) or auto. Auto mode adds:

--auto --disable-iroh-relays --nostr-relay ws://127.0.0.1:1/

The relay URL parses, so the client registers it without dialing (which avoids the "zero relays registered" hard error), but it cannot connect. Discovery fails closed after its own bounded timeout, auto-selection takes its local-mesh fallback, and the client API comes up emitting the same structured passive_mode / status=ready / role=client event the direct path already asserts. Nothing reaches the public mesh.

native-package-qa.sh runs the direct client smoke and then the auto smoke, so every row proves both paths and no row waits on a live mesh. Auto mode defaults to a 90s readiness budget instead of 45 to cover the discovery timeout.

MESH_LLM_SMOKE_AUTO_RELAY is the seam for a local relay fixture that would extend this into real join coverage later.

QA

Run end to end against a real mesh-llm 0.76.1 binary, not just fixtures:

client  exit=0 elapsed=5s
auto    exit=0 elapsed=10s

The 5s difference is the bounded Nostr fetch timeout. I confirmed the log shows Connection failed url=ws://127.0.0.1:1/ and no attempt against any public relay, then No meshes found yet — starting client API while discovery continues, then the readiness event.

Unit coverage: auto mode passes the auto-selection and offline-relay flags (the fixture exits 64 if the relay is not loopback), an unknown mode is rejected with exit 2, and package QA runs both modes. The old doesNotMatch(/client --auto/) guard is replaced by assertions that the default stays the direct client and that auto stays pinned to loopback, which is the property that actually mattered.

Full suite 162/165; the 2 workflow-provenance failures reproduce on unmodified origin/main on macOS and were green on ubuntu CI in #30 and #31.

Caveat

One thing worth a second opinion: this proves auto-selection starts, not that it joins. Upstream's argument is that the standalone fallback is exactly the failure mode a weak predicate hides. That is a real gap, and closing it honestly needs the local relay fixture rather than a looser assertion.

Summary by CodeRabbit

  • New Features

    • Added automatic runtime-selection coverage for readiness checks.
    • Automatic selection now handles unavailable relay discovery gracefully and falls back to local operation.
    • Readiness checks confirm successful startup across both direct-client and automatic-selection modes.
  • Bug Fixes

    • Added validation for unsupported smoke-test modes, providing a clear error instead of proceeding.
  • Documentation

    • Updated native package QA documentation to describe both supported readiness paths and optional local relay testing.

Package QA only ran plain client mode, and its test explicitly forbade
client --auto, so the automatic runtime-selection path upstream tests
had no downstream coverage at all.

Add MESH_LLM_SMOKE_MODE to the shared readiness smoke. Auto mode runs
--auto --disable-iroh-relays --nostr-relay ws://127.0.0.1:1/. That relay
parses, so the client registers it without dialing, but it cannot
connect, so discovery fails closed after its own bounded timeout and
auto-selection reaches its local-mesh fallback. Readiness is the same
structured passive_mode/status=ready/role=client event the direct client
path already asserts. Nothing touches the public mesh.

native-package-qa.sh now runs the direct client smoke and then the auto
smoke, so every row proves both paths without waiting on a live mesh.
Auto mode gets a 90-second default readiness budget rather than 45 to
cover the discovery timeout.

MESH_LLM_SMOKE_AUTO_RELAY is the seam for a local relay fixture that
would extend this into real join coverage. Asserting a genuine
public-mesh join stays upstream's ci-client-auto-test.sh, which is not
something package rows should depend on.
@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 9a2e7eb6-7967-44d0-a8a7-31a327b700e0

📥 Commits

Reviewing files that changed from the base of the PR and between d004918 and 2617537.

📒 Files selected for processing (5)
  • TODO.md
  • docs/native-packages.md
  • scripts/client-readiness-smoke.sh
  • scripts/native-package-qa.sh
  • tests/client-readiness-smoke.test.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The readiness smoke now supports client and automatic runtime-selection modes. Package QA runs both modes. Auto mode uses bounded offline discovery through a pinned loopback relay, and tests validate its arguments, readiness, shutdown, and error handling.

Changes

Runtime readiness coverage

Layer / File(s) Summary
Mode-aware readiness smoke
scripts/client-readiness-smoke.sh
Adds client and auto modes, mode-specific readiness timeouts, unsupported-mode handling, and auto-selection flags with a loopback relay.
Package QA and readiness records
scripts/native-package-qa.sh, docs/native-packages.md, TODO.md
Runs the auto smoke in package QA and records the auto-selection coverage and observed timing results.
Auto-mode test coverage
tests/client-readiness-smoke.test.ts
Validates environment propagation, auto launch arguments, readiness and shutdown, unsupported modes, QA invocations, and shell defaults.

Priority: ⬇️ Low

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

Change: Other

Sequence Diagram(s)

sequenceDiagram
  participant NativePackageQA
  participant ReadinessSmoke
  participant MeshLLM
  participant LoopbackRelay
  NativePackageQA->>ReadinessSmoke: run with MESH_LLM_SMOKE_MODE=auto
  ReadinessSmoke->>MeshLLM: launch --auto --disable-iroh-relays
  MeshLLM->>LoopbackRelay: attempt pinned relay connection
  LoopbackRelay-->>MeshLLM: connection unavailable
  MeshLLM-->>ReadinessSmoke: emit status=ready role=client
Loading

Merge Risk: ⚪ Minimal · up to 26175

No actionable current-head risk remains from this change.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding package QA coverage for automatic runtime selection.
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 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/client-auto-readiness-lane

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.

@ndizazzo
ndizazzo marked this pull request as ready for review September 16, 2026 22:42
@ndizazzo

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 59 minutes.

@ndizazzo

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

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.

2 participants