Skip to content

Remove onLog from @relayburn/sdk@2.x option types (#374)#384

Merged
willwashburn merged 1 commit into
mainfrom
claude/fix-issue-374-ajfLs
May 8, 2026
Merged

Remove onLog from @relayburn/sdk@2.x option types (#374)#384
willwashburn merged 1 commit into
mainfrom
claude/fix-issue-374-ajfLs

Conversation

@willwashburn

Copy link
Copy Markdown
Member

Closes #374.

Summary

The 1.x SDK accepted onLog to surface archive-fallback messages from the JS-side fallback path. The 2.x Node facade is SQLite-native and silently dropped the callback at the napi boundary — there is no fallback to log. Per the issue's first acceptance option, the option is removed rather than wiring a structured diagnostic hook for events that don't fire.

  • Drop onLog?: from SummaryOptions, SessionCostOptions, OverheadOptions, HotspotsOptions, and CompareOptions in packages/sdk-node/src/index.d.ts.
  • Update the trailing comment block to explain why onLog is intentionally absent (replaces the prior reference to it as a measured TS-vs-napi gap).
  • Add a [Unreleased] / Breaking Changes entry to packages/sdk-node/CHANGELOG.md.

The 1.x SDK (packages/sdk) and its consumers in @relayburn/cli / @relayburn/mcp are unchanged — they still depend on @relayburn/sdk (workspace) and use the working 1.x onLog.

Test plan

  • pnpm run build (TS workspace builds clean)
  • pnpm run test (875 tests pass)
  • New packages/sdk-node/test/no-onlog.test.js:
    • asserts src/index.d.ts no longer declares onLog?: on any option type (regression guard)
    • asserts the 2.x verbs still accept a stray onLog property at runtime (skips when the napi binding isn't built, like the conformance suite — picks up automatically in CI under RELAYBURN_SDK_NAPI_BUILT=1)

Generated by Claude Code

The 1.x SDK accepted `onLog` to surface archive-fallback messages from
the JS-side fallback path. The 2.x Node facade is SQLite-native and
silently dropped the callback at the napi boundary — there is no
fallback to log. Drop the option from `summary`, `sessionCost`,
`overhead`, `overheadTrim`, `hotspots`, and `compare` rather than wire
a hook for events that don't fire.

Adds a regression test asserting the d.ts no longer declares `onLog`
on any option type, plus a runtime tolerance test that the verbs still
accept a stray `onLog` property (so embedders mid-migration from 1.x
don't blow up at runtime when their TS shape lags).
@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR removes the onLog callback option from four exported TypeScript option interfaces in the Node SDK (SummaryOptions, SessionCostOptions, OverheadOptions, HotspotsOptions), documents the breaking change, updates comments explaining that 2.x SQLite-native architecture no longer supports logging callbacks, and adds tests enforcing the removal and validating runtime compatibility.

Changes

Remove onLog Callback from SDK Option Types

Layer / File(s) Summary
Type Surface Changes
packages/sdk-node/src/index.d.ts
onLog?: (msg: string) => void is removed from SummaryOptions, SessionCostOptions, OverheadOptions, and HotspotsOptions option interfaces.
Breaking Change Documentation
packages/sdk-node/src/index.d.ts, packages/sdk-node/CHANGELOG.md
The "2.x extensions" documentation block is updated to explain that onLog is intentionally omitted in 2.x because the SQLite-native stack has no archive-fallback path. The changelog records the breaking change removal across summary, sessionCost, overhead, overheadTrim, hotspots, and compare option types.
Validation Tests
packages/sdk-node/test/no-onlog.test.js
A new test file enforces via static declaration check that onLog does not reappear in index.d.ts, and includes a runtime regression test verifying that SDK methods accept options with an unrecognized onLog property without error.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • AgentWorkforce/burn#354: Shapes the initial 1.x-compatible TS type surface for the Node SDK, including earlier handling of the onLog option that is now being removed in this PR.

Poem

🐰 The callback bids adieu,
No logs on SQLite's native brew,
Tests ensure the path stays true,
Two-point-oh breaks free and new! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: removing onLog from the 2.x SDK option types.
Description check ✅ Passed The description is directly related to the changeset, explaining the rationale for removing onLog and detailing what was changed.
Linked Issues check ✅ Passed The PR fully addresses #374 by choosing option (a): removing onLog from 2.x types, documenting the decision, and adding regression/runtime tests.
Out of Scope Changes check ✅ Passed All changes are directly scoped to #374: updating type definitions, changelog, and adding the regression test for the onLog removal.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 claude/fix-issue-374-ajfLs

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/sdk-node/CHANGELOG.md`:
- Line 7: Edit the Unreleased changelog entry to a concise, impact-first
sentence that states the API change and migration effect only: remove the
architecture backstory and PR/issue link and keep just that the `onLog` option
has been removed from the `summary`, `sessionCost`, `overhead`, `overheadTrim`,
`hotspots`, and `compare` option types (and note any direct migration
instruction if needed). Ensure the line replaces the current verbose entry so it
reads as a short, user-facing change about the breaking/API update.

In `@packages/sdk-node/test/no-onlog.test.js`:
- Around line 35-56: The test only checks runtime tolerance for sdk.summary,
sdk.sessionCost, and sdk.hotspots but misses the other verbs that had onLog
removed; update the test to also call and assert no rejection for sdk.overhead,
sdk.overheadTrim, and sdk.compare using the same stray = { onLog: () => {} }
input so the runtime forgiveness is validated for all affected functions (look
for the test function named 'verbs tolerate a stray onLog property at runtime'
and add the three additional await assert.doesNotReject calls for overhead,
overheadTrim, and compare).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b7fea610-05e5-4057-8478-c40a96ac8e91

📥 Commits

Reviewing files that changed from the base of the PR and between dc35146 and 09e2789.

📒 Files selected for processing (3)
  • packages/sdk-node/CHANGELOG.md
  • packages/sdk-node/src/index.d.ts
  • packages/sdk-node/test/no-onlog.test.js


### Breaking Changes

- Removed the `onLog` option from `summary`, `sessionCost`, `overhead`, `overheadTrim`, `hotspots`, and `compare` option types. The 2.x stack is SQLite-native and has no archive-fallback path to surface, so the callback was already a no-op at the napi boundary. (#374)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Make the Unreleased entry concise and impact-first.

This line includes architecture backstory and an issue link; keep it to API impact and migration effect only.

Suggested edit
-- Removed the `onLog` option from `summary`, `sessionCost`, `overhead`, `overheadTrim`, `hotspots`, and `compare` option types. The 2.x stack is SQLite-native and has no archive-fallback path to surface, so the callback was already a no-op at the napi boundary. (`#374`)
+- Removed `onLog` from 2.x option types for `summary`, `sessionCost`, `overhead`, `overheadTrim`, `hotspots`, and `compare`; TypeScript callers should remove this field (runtime continues to ignore extra properties).

As per coding guidelines, “Curate [Unreleased] sections … with concise, impact-first entries … drop issue/PR links, internal notes, backstory…”.

📝 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
- Removed the `onLog` option from `summary`, `sessionCost`, `overhead`, `overheadTrim`, `hotspots`, and `compare` option types. The 2.x stack is SQLite-native and has no archive-fallback path to surface, so the callback was already a no-op at the napi boundary. (#374)
- Removed `onLog` from 2.x option types for `summary`, `sessionCost`, `overhead`, `overheadTrim`, `hotspots`, and `compare`; TypeScript callers should remove this field (runtime continues to ignore extra properties).
🧰 Tools
🪛 LanguageTool

[grammar] ~7-~7: Ensure spelling is correct
Context: ...the callback was already a no-op at the napi boundary. (#374) ## [2.1.0] - 2026-05-...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/sdk-node/CHANGELOG.md` at line 7, Edit the Unreleased changelog
entry to a concise, impact-first sentence that states the API change and
migration effect only: remove the architecture backstory and PR/issue link and
keep just that the `onLog` option has been removed from the `summary`,
`sessionCost`, `overhead`, `overheadTrim`, `hotspots`, and `compare` option
types (and note any direct migration instruction if needed). Ensure the line
replaces the current verbose entry so it reads as a short, user-facing change
about the breaking/API update.

Comment on lines +35 to +56
test('verbs tolerate a stray onLog property at runtime', async (t) => {
if (process.env.RELAYBURN_SDK_NAPI_BUILT !== '1') {
t.skip('napi-rs binding not built — set RELAYBURN_SDK_NAPI_BUILT=1');
return;
}
let sdk;
try {
sdk = await import(join(__dirname, '..', 'src', 'index.js'));
} catch (err) {
if (/native binding not found/i.test(String(err && err.message))) {
t.skip('napi-rs binding load failed — build artifact missing');
return;
}
throw err;
}
// Cast through any-shape to bypass the now-stricter option types: the
// contract under test is the runtime forgiveness, not the TS shape.
const stray = { onLog: () => {} };
await assert.doesNotReject(() => sdk.summary(stray));
await assert.doesNotReject(() => sdk.sessionCost(stray));
await assert.doesNotReject(() => sdk.hotspots(stray));
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Runtime tolerance test does not cover all affected 2.x verbs.

The test claims “each verb” but currently checks only summary, sessionCost, and hotspots. Since onLog was removed from six option types, migration safety should also cover overhead, overheadTrim, and compare.

Suggested expansion
   await assert.doesNotReject(() => sdk.summary(stray));
   await assert.doesNotReject(() => sdk.sessionCost(stray));
+  await assert.doesNotReject(() => sdk.overhead(stray));
+  await assert.doesNotReject(() => sdk.overheadTrim(stray));
   await assert.doesNotReject(() => sdk.hotspots(stray));
+  await assert.doesNotReject(() =>
+    sdk.compare({ models: ['model-a', 'model-b'], onLog: () => {} }),
+  );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/sdk-node/test/no-onlog.test.js` around lines 35 - 56, The test only
checks runtime tolerance for sdk.summary, sdk.sessionCost, and sdk.hotspots but
misses the other verbs that had onLog removed; update the test to also call and
assert no rejection for sdk.overhead, sdk.overheadTrim, and sdk.compare using
the same stray = { onLog: () => {} } input so the runtime forgiveness is
validated for all affected functions (look for the test function named 'verbs
tolerate a stray onLog property at runtime' and add the three additional await
assert.doesNotReject calls for overhead, overheadTrim, and compare).

@willwashburn willwashburn merged commit 7f40303 into main May 8, 2026
7 checks passed
@willwashburn willwashburn deleted the claude/fix-issue-374-ajfLs branch May 8, 2026 03:42
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.x gap: add SDK diagnostics hook or remove onLog

2 participants