Skip to content

Conversation

@deflis
Copy link
Owner

@deflis deflis commented Dec 10, 2025

Summary

  • resolve executeWithFields argument parsing so ExecuteOptions are forwarded to underlying calls
  • add coverage ensuring ExecuteOptions headers reach ranking and novel requests when using executeWithFields

Testing

  • pnpm test

Codex Task

Copilot AI review requested due to automatic review settings December 10, 2025 04:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes ExecuteOptions handling in the ranking executeWithFields method and adds comprehensive test coverage. The changes enable passing custom fetch options (like headers) through the entire API call chain, from high-level builder methods down to the underlying fetch implementation.

Key changes:

  • Introduced ExecuteOptions type with fetchOptions property for passing RequestInit options
  • Updated executeWithFields to accept ExecuteOptions through flexible overload signatures using a new resolveExecuteArgs helper method
  • Threaded ExecuteOptions parameter through all API execution methods (search, ranking, user search)

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/narou.ts Added ExecuteOptions type definition and updated all execute methods to accept and forward options parameter
src/narou-fetch.ts Updated execute method to pass ExecuteOptions.fetchOptions to the fetch call
src/narou-jsonp.ts Updated execute method signature to accept ExecuteOptions (marked unused with void pattern since JSONP doesn't support fetch options)
src/ranking.ts Added ExecuteOptions parameter to execute and executeWithFields methods; implemented resolveExecuteArgs helper to parse flexible argument patterns
src/search-builder.ts Updated execute method to accept and forward ExecuteOptions
src/search-builder-r18.ts Updated execute method to accept and forward ExecuteOptions
src/user-search.ts Updated execute method to accept and forward ExecuteOptions
src/index.common.ts Exported ExecuteOptions type for public API usage
src/index.ts Fixed error handling in rankingHistory to throw error strings directly instead of wrapping in Error object
test/ranking.test.ts Added comprehensive tests verifying ExecuteOptions propagation through executeWithFields calls
test/narou.test.ts Added MSW setup for mocking API responses in integration tests
test/narou-fetch.test.ts Added test verifying fetch options are properly passed to fetch implementation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 88 to 92
// MEMO: このファイルのテストは外部APIを利用するため、結果が変わる可能性がある。
// そのため、結果が変わる可能性が少ないものを選択してテストを行っているが、落ちるようになったら修正が必要。
describe("narou-test", () => {
// まれに時間がかかるので30秒に設定
vi.setConfig({ testTimeout: 30000 });
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

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

このコメントは古くなっています。MSWを使用してAPIをモックするようになったため、テストは外部APIを利用せず、結果が変わることはありません。このコメントと、30秒のタイムアウト設定を削除するか、テストがモックを使用していることを反映するように更新してください。

Translation: This comment is outdated. Since the tests now use MSW to mock the APIs, they no longer use external APIs and the results will not change. Consider removing this comment and the 30-second timeout setting, or update them to reflect that the tests now use mocks.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants