Logs client ignores `from` and `take` for checkpoint pagination

オープン 初心者向け
#840 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
80/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
ruby
領域
api

調査の方向性

lib/auth0/logs/client.rb の Auth0::Logs::Client#list から始め、ホワイトリストされた query_params (page, per_page, sort, fields, include_fields, include_totals, search) が **params からどのようにコピーされるかを確認してください。from と take も同じ方法で追加してください。コードが offset pagination と checkpoint pagination の間で分岐するか、また include_totals が take と競合するかを確認してください。spec/auth0/logs/client_spec.rb を from/take のリクエスト期待で更新し、その後 rspec で実行してください。出力される query string が両方のパラメータを含み、既存の pagination テストが引き続き通れば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug
Checklist
  • I have looked into the Readme and Examples, and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.
Description

The Auth0 Management API supports checkpoint pagination for tenant logs using the from and take query parameters.

However, Auth0::Logs::Client#list accepts these arguments through **params, but does not add them to the request query parameters. As a result, the arguments are silently ignored.

I expected the following call:

client.logs.list(
  from: checkpoint_log_id,
  take: 100
)

to send a request equivalent to:

GET /api/v2/logs?from=CHECKPOINT_LOG_ID&take=100

Instead, checkpoint pagination is not applied, and the default offset-pagination parameters are used.

Reproduction
  1. Install version 6.7.0 of the auth0 gem.

    gem "auth0", "6.7.0"
    
  2. Create a Management API client using credentials with the read:logs scope.

    client = Auth0::Client.new(
      domain: ENV.fetch("AUTH0_DOMAIN"),
      client_id: ENV.fetch("AUTH0_CLIENT_ID"),
      client_secret: ENV.fetch("AUTH0_CLIENT_SECRET")
    )
    
  3. Obtain an existing tenant log ID and call logs.list using it as the checkpoint.

    logs = client.logs.list(
      from: checkpoint_log_id,
      take: 100
    ).to_a
    
  4. Inspect the outgoing request or lib/auth0/logs/client.rb.

    Auth0::Logs::Client#list accepts from and take through **params, but does not copy them into query_params.

    The implementation only handles the following query parameters:

    • page
    • per_page
    • sort
    • fields
    • include_fields
    • include_totals
    • search

    Therefore, from and take are not included in the request.

This issue is consistently reproducible.

Additional context

The Auth0 documentation describes from and take as the parameters for retrieving logs by checkpoint:

The method documentation also mentions checkpoint pagination, but the corresponding parameters are not handled by the implementation.

ruby-auth0 version

6.7.0

Ruby version

4.0.10

主要言語
Ruby
スター
205
フォーク
144
平均マージ
1日 6時間
マージ済み PR(30日)
12

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

auth0/ruby-auth0 のほかの issue

auth0/ruby-auth0 の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。