Skip to content

Conversation

@fern-api
Copy link
Contributor

@fern-api fern-api bot commented Nov 15, 2025

This PR regenerates code to match the latest API Definition.

@jackfischer jackfischer merged commit 4d3b5cb into main Nov 15, 2025
3 checks passed
@greptile-apps
Copy link

greptile-apps bot commented Nov 15, 2025

Greptile Overview

Greptile Summary

This PR is a Fern-generated SDK update that adds comprehensive logging and security enhancements to the TypeScript SDK.

Key Changes

  • Added new logging infrastructure with level-based filtering (LogLevel.Debug, Info, Warn, Error) and silent mode (defaults to silent: true)
  • Implemented sensitive data redaction for authorization headers, API keys, tokens, passwords, session IDs, and other credentials
  • Added custom fetch function support for platform compatibility
  • Extended BaseClientOptions to accept logging and fetch configuration
  • Updated all API resource clients to pass logging and fetch options through to the fetcher
  • Added support for new request types (form, other) in addition to existing types
  • Comprehensive test coverage with 500+ lines of new tests for logging and redaction functionality
  • Version bump to 0.1.11, pnpm upgrade to 10.20.0
  • Added CONTRIBUTING.md with Fern generator documentation

Changes Impact

  • Backward compatible: All new options are optional with sensible defaults
  • Security improvement: Automatic redaction prevents credential leakage in logs
  • Flexibility: Custom loggers and fetch implementations can be provided
  • Well-tested: Extensive test coverage ensures reliability

Confidence Score: 5/5

  • This PR is safe to merge with no issues - well-generated code with extensive test coverage
  • This is a Fern-generated SDK update that adds valuable logging and security features. The changes are backward compatible (all new options are optional), thoroughly tested (1600+ new test lines), and follow established patterns. The logging defaults to silent mode preventing unexpected console output. The redaction logic protects sensitive credentials from accidental exposure. All API clients are updated consistently.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
src/core/fetcher/Fetcher.ts 5/5 Added comprehensive logging infrastructure with redaction for sensitive data (headers, query params, URLs)
src/core/logging/logger.ts 5/5 New logging system with level-based filtering, custom logger support, and silent mode (defaults to silent: true)
src/BaseClient.ts 5/5 Added fetch and logging configuration options to base client interface
tests/unit/fetcher/logging.test.ts 5/5 New comprehensive test suite covering logging integration, level filtering, and request/response logging
tests/unit/fetcher/redacting.test.ts 5/5 Extensive test coverage for sensitive data redaction in headers, query params, and URLs
package.json 5/5 Version bump to 0.1.11, pnpm upgrade to 10.20.0, added empty dependencies field

Sequence Diagram

sequenceDiagram
    participant Client as SDK Client
    participant BaseClient as BaseClient
    participant APIClient as API Resource Client
    participant Fetcher as Fetcher
    participant Logger as Logger
    participant Redactor as Redaction Functions
    participant HTTPClient as HTTP (fetch)

    Client->>BaseClient: Initialize SDK with logging config
    Note over BaseClient: Store fetch & logging options
    
    Client->>APIClient: Call API method (e.g., createCopilot)
    APIClient->>Fetcher: fetcherImpl(args + fetchFn + logging)
    
    Fetcher->>Logger: createLogger(config)
    Note over Logger: Initialize with level, silent mode
    
    alt Debug logging enabled
        Fetcher->>Redactor: redactUrl(url)
        Fetcher->>Redactor: redactHeaders(headers)
        Fetcher->>Redactor: redactQueryParameters(params)
        Redactor-->>Fetcher: Sanitized data
        Fetcher->>Logger: debug("Making HTTP request", metadata)
    end
    
    Fetcher->>HTTPClient: fetch(url, options)
    HTTPClient-->>Fetcher: Response
    
    alt Success (2xx-3xx)
        alt Debug logging enabled
            Fetcher->>Redactor: redactHeaders(response.headers)
            Redactor-->>Fetcher: Sanitized headers
            Fetcher->>Logger: debug("HTTP request succeeded", metadata)
        end
        Fetcher-->>APIClient: APIResponse (ok: true)
    else Error (4xx-5xx)
        alt Error logging enabled
            Fetcher->>Redactor: redactHeaders(response.headers)
            Redactor-->>Fetcher: Sanitized headers
            Fetcher->>Logger: error("HTTP request failed", metadata)
        end
        Fetcher-->>APIClient: APIResponse (ok: false)
    else Network/Timeout Error
        alt Error logging enabled
            Fetcher->>Logger: error("Request error", metadata)
        end
        Fetcher-->>APIClient: APIResponse (ok: false)
    end
    
    APIClient-->>Client: Response with data or error
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

41 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

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