Skip to content

feat(rust): support pagination overrides with modules config#4077

Open
suzmue wants to merge 1 commit intogoogleapis:mainfrom
suzmue:pagination
Open

feat(rust): support pagination overrides with modules config#4077
suzmue wants to merge 1 commit intogoogleapis:mainfrom
suzmue:pagination

Conversation

@suzmue
Copy link
Contributor

@suzmue suzmue commented Feb 17, 2026

Pagination overrides need to be propagated when converting from a modules configuration for rust. This feature was already available for crates defined using library configuration, but is missing for modules.

Fixes #4076

@suzmue suzmue requested a review from a team as a code owner February 17, 2026 05:14
@codecov
Copy link

codecov bot commented Feb 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.93%. Comparing base (e323d45) to head (fb09e3e).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4077   +/-   ##
=======================================
  Coverage   81.93%   81.93%           
=======================================
  Files          78       78           
  Lines        6516     6516           
=======================================
  Hits         5339     5339           
  Misses        832      832           
  Partials      345      345           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for propagating pagination overrides for Rust modules. A logical issue was found where library-level pagination overrides are duplicated for every module within a library, leading to incorrect configuration. The current test case also needs improvement as it doesn't cover this scenario. Please address the duplication bug in moduleToModelConfig and enhance the test case to ensure correct functionality for libraries with multiple modules.

Comment on lines +272 to +280
if len(library.Rust.PaginationOverrides) > 0 {
modelCfg.PaginationOverrides = make([]sidekickconfig.PaginationOverride, len(library.Rust.PaginationOverrides))
for i, override := range library.Rust.PaginationOverrides {
modelCfg.PaginationOverrides[i] = sidekickconfig.PaginationOverride{
ID: override.ID,
ItemField: override.ItemField,
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This logic adds the library-level PaginationOverrides to the model config for each module. Since moduleToModelConfig is called from a loop that iterates over all modules in a library, this will cause the same set of overrides to be duplicated for each module.

These overrides are defined at the library level and should be applied only once. Applying them to every module's config will result in incorrect, duplicated configuration downstream.

Please adjust the logic to ensure these overrides are not duplicated. The overrides should be handled once at the library level, rather than inside this per-module function.

Comment on lines +794 to +825
{
name: "with pagination overrides in rust module",
library: &config.Library{
Name: "google-cloud-example",
Rust: &config.RustCrate{
PaginationOverrides: []config.RustPaginationOverride{
{
ID: ".google.cloud.example.v1.Example.ListExamples",
ItemField: "examples",
},
},
Modules: []*config.RustModule{
{
Template: "prost",
},
},
},
},
want: &parser.ModelConfig{
Language: "rust",
Source: map[string]string{
"googleapis-root": absPath(t, googleapisRoot),
"roots": "googleapis",
},
PaginationOverrides: []sidekickconfig.PaginationOverride{
{
ID: ".google.cloud.example.v1.Example.ListExamples",
ItemField: "examples",
},
},
},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This new test case only covers the scenario with a single module, which masks a duplication bug in moduleToModelConfig. The library-level PaginationOverrides are incorrectly applied to every module, leading to duplicates.

The test runner logic (lines 847 and 852-854) will collect these duplicates. Please strengthen this test case by adding a second module, which will cause the test to fail and properly validate the fix.

Example update:

Modules: []*config.RustModule{
    {
        Template: "prost",
    },
    {
        Template: "prost", // Add a second module
    },
},

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.

rust: pagination overrides should also apply to modules

1 participant