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

Abierto Apto para principiantes
#840 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
80/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
ruby
Área
api

Línea de trabajo

Empieza en lib/auth0/logs/client.rb en Auth0::Logs::Client#list y observa cómo se copian los query_params incluidos en la lista blanca (page, per_page, sort, fields, include_fields, include_totals, search) fuera de **params; añade from y take de la misma forma. Comprueba si el código se ramifica entre paginación por offset y por checkpoint, y si include_totals entra en conflicto con take. Actualiza spec/auth0/logs/client_spec.rb con una expectativa de petición para from/take, luego ejecútala mediante rspec; terminado cuando la cadena de consulta emitida lleve ambos parámetros y las pruebas de paginación existentes sigan pasando.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Ruby
Estrellas
205
Forks
144
Merge medio
1 d 6 h
PR fusionados (30 d)
12

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de auth0/ruby-auth0

Todos los issues de auth0/ruby-auth0

Issues similares

Más issues de Ruby

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.