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

未关闭 适合新手
#840 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
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 分页和 checkpoint 分页之间分支,以及 include_totals 是否与 take 冲突。用针对 from/take 的请求期望更新 spec/auth0/logs/client_spec.rb,然后通过 rspec 运行它;当发出的 query string 带有这两个参数且现有分页测试仍然通过时完成。

由索引模型根据 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 小时
30 天内合并 PR
12

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

auth0/ruby-auth0 的其他 Issue

查看 auth0/ruby-auth0 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。