Skip to content

feat: add onWarn callback to BusClient.connect() #17#18

Merged
four-bytes-robby merged 1 commit into
mainfrom
feat/17-busclient-onwarn
Jun 15, 2026
Merged

feat: add onWarn callback to BusClient.connect() #17#18
four-bytes-robby merged 1 commit into
mainfrom
feat/17-busclient-onwarn

Conversation

@four-bytes-robby

@four-bytes-robby four-bytes-robby commented Jun 15, 2026

Copy link
Copy Markdown
Member

Closes #17

Changes

  • BusClient.connect() now accepts an optional opts object with timeoutMs and onWarn callback
  • Replaced both console.warn(...) calls with the user-supplied warn(...) callback
  • Plumbed warn through connect()startBus()spawnBus() (Option A: parameter passing)

Testing

  • Build: ✅ passes
  • Tests: ⚠️ 2 integration tests fail pre-existing (require Go bus binary not present in CI-less env) — unrelated to this change

Version

0.6.60.7.0 (feature bump)


Summary by cubic

Adds an optional opts object to BusClient.connect() with timeoutMs and onWarn, and routes all warnings through the callback instead of console.warn. This enables custom logging for bus startup, stderr, and fallback warnings.

  • New Features

    • BusClient.connect(opts) now supports { timeoutMs?: number; onWarn?: (msg: string, ...args: unknown[]) => void }.
    • Defaults: timeoutMs = 5000, onWarn = console.warn.
    • Warning flow is wired through connectstartBusspawnBus (including bus stderr).
  • Migration

    • Replace BusClient.connect(2000) with BusClient.connect({ timeoutMs: 2000 }).
    • To hook warnings: BusClient.connect({ onWarn: (msg, ...args) => logger.warn(msg, ...args) }).

Written for commit 79c8848. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

Release Notes

  • Chores

    • Version bumped to 0.7.0
  • New Features

    • Connection configuration now accepts an options object with customizable warning handler callback for improved error reporting control

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

Recent review info
Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c06207b4-8664-4801-8862-993cff1b10b5

Commits

Reviewing files that changed from the base of the PR and between 88cd19a and 79c8848.

Files selected for processing (2)
  • package.json
  • src/bus-client.ts

Walkthrough

Walkthrough

BusClient.connect signature changes from a positional timeoutMs parameter to an options object adding an optional onWarn callback. The callback defaults to console.warn and is threaded through startBus and spawnBus, replacing all direct console.warn calls. The package version is bumped to 0.7.0.

Changes

BusClient onWarn callback and version bump

Layer / File(s) Summary
BusClient.connect public API and internal call sites
src/bus-client.ts
connect now accepts opts?: { timeoutMs?: number; onWarn?: (...) => void }, resolves warn with console.warn as default, and passes it to startBus and the in-memory fallback warning path.
startBus and spawnBus warn parameter threading
src/bus-client.ts
Both internal helpers gain a warn parameter; spawnBus routes bus process stderr through warn(...) instead of console.warn(...), completing the threading through the full spawn lifecycle.
Package version bump
package.json
Version field incremented from 0.6.6 to 0.7.0 to reflect the breaking change to the public connect signature.

Estimated code review effort

3 (Moderate) | ~15 minutes

Possibly related issues

  • #17 — BusClient.connect(): replace console.warn with configurable logger callback: This PR implements exactly the proposed change: an onWarn callback parameter on connect, defaulting to console.warn, threaded through startBus and spawnBus.

Possibly related PRs

Pre-merge checks | ✅ 4
✅ 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 accurately summarizes the main change: adding an onWarn callback to BusClient.connect(), which is the primary feature introduced in this PR.
Linked Issues check ✅ Passed All requirements from issue #17 are met: the onWarn callback parameter is added to connect(), accepts message and args, and replaces console.warn calls throughout the call chain.
Out of Scope Changes check ✅ Passed All changes are directly related to the stated objectives: the callback implementation, version bump, and parameter signature changes align with issue #17 requirements with no extraneous modifications.

Tip: You can configure your own custom pre-merge checks in the settings.

Finishing Touches
Generate docstrings
  • Create stacked PR
  • Commit on current branch
Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/17-busclient-onwarn
Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feat/17-busclient-onwarn

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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 2 files

Re-trigger cubic

@four-bytes-robby four-bytes-robby merged commit 8298d31 into main Jun 15, 2026
4 checks passed
@four-bytes-robby four-bytes-robby deleted the feat/17-busclient-onwarn branch June 15, 2026 10:58
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.

BusClient.connect(): replace console.warn with configurable logger callback

1 participant