Skip to content

fix: docs corrections and dead code cleanup#172

Open
dorukardahan wants to merge 1 commit into0gfoundation:mainfrom
dorukardahan:fix/docs-and-code-cleanup
Open

fix: docs corrections and dead code cleanup#172
dorukardahan wants to merge 1 commit into0gfoundation:mainfrom
dorukardahan:fix/docs-and-code-cleanup

Conversation

@dorukardahan
Copy link

Summary

Small fixes found during SDK audit — all verified against source code.

Changes

1. README: Node.js version mismatch

  • README said >= 22.0.0, package.json says >= 20.0.0, CI tests both 20.x and 22.x
  • Fixed to >= 20.0.0

2. getRequestHeaders JSDoc example (broker.ts)

The @example had two bugs:

  • Called getServiceMetadata instead of getRequestHeaders for the headers call
  • Passed non-existent serviceName parameter
- const headers = await broker.getServiceMetadata(providerAddress, serviceName, content);
+ const headers = await broker.inference.getRequestHeaders(providerAddress, content);

Also fixed role: "system"role: "user" and headers placement in the OpenAI SDK call.

3. Dead code in response.ts

Duplicate if (!chatID) check — line 38 already returns null, so the second check at line 54 was unreachable:

- if (!chatID) {
-     throw new Error('Chat ID does not exist')
- }

Also replaced 3 console.warn calls with the existing logger.warn import (per CLAUDE.md SDK rules).

4. Commented-out import in request.ts

Removed // import { Verifier } from './verifier'

Verification

All changes verified against actual TypeScript signatures before committing. No behavioral changes — only docs and dead code removal.

🤖 Generated with Claude Code

1. README: Node.js requirement 22.0.0 → 20.0.0 (matches package.json
   engines field and CI matrix which tests both 20.x and 22.x)

2. getRequestHeaders JSDoc: fix wrong method call in @example
   - Was calling getServiceMetadata twice (second should be getRequestHeaders)
   - Remove non-existent serviceName parameter
   - Fix message role from "system" to "user"
   - Fix headers placement in OpenAI SDK call

3. response.ts: remove duplicate chatID null check (dead code)
   - Line 38 already returns null if !chatID
   - Second check at line 54 was unreachable
   - Replace console.warn with existing logger.warn (3 occurrences)

4. request.ts: remove commented-out import

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 20, 2026

@dorukardahan is attempting to deploy a commit to the 0g-Frontend Team on Vercel.

A member of the Team first needs to authorize it.

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

Comments