fix: Sends plural data source list query params during pagination - #4680
Conversation
🤖 Augment PR SummarySummary: Fixes pagination for auto-generated plural data sources that use query filters. Changes:
🤖 Was this summary useful? React with 👍 or 👎 |
There was a problem hiding this comment.
Pull request overview
Fixes pagination for auto-generated plural data sources so that existing list filter query parameters are preserved across pages while still sending the correct pageNum. This aligns the autogen list read path with expected Terraform data source filtering behavior and unblocks filtering for several plural data sources.
Changes:
- Introduces
WithPageNumto clone existing query params and setpageNumwithout mutating the original map. - Updates
HandleDataSourceReadListto useWithPageNum(req.CallParams.QueryParams, pageNum)so pagination retains previously built filters. - Adds unit tests for
WithPageNumbehavior (nil/empty inputs, overwritespageNum, preserves filters, and avoids input mutation) and includes release notes.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/common/autogen/query_param.go | Adds WithPageNum helper to clone query params and set pageNum safely. |
| internal/common/autogen/handle_operations.go | Uses WithPageNum during pagination so list filters are not dropped. |
| internal/common/autogen/query_params_test.go | Adds unit coverage validating WithPageNum correctness and immutability. |
| .changelog/4680.txt | Documents the bugfix for plural data source pagination filters. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
AgustinBettati
left a comment
There was a problem hiding this comment.
Nice, thanks for quickly triaging and driving this fix
…ation Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
a734612 to
3c00729
Compare
Summary
HandleDataSourceReadListkept onlypageNumand dropped list filters already built byBuildQueryParamMap.pageNumon the copy (WithPageNum).integration_typeonmongodbatlas_log_integrationsandintegration_type/provider_typeonmongodbatlas_metric_integrations.Does not close CLOUDP-433211. Codegen
getQueryParamsstill skipscomputed_optional(include_system_managedon service accounts).Test plan
go test ./internal/common/autogen/ -count=1TestAccCloudBackupCollectionRestoreJob_snapshotSameClusterDatabaseRenamesecond step (source_namespacefilter,results.# = 1) on test: Adds collection restore job acceptance tests #4671TestAccCloudBackupCollectionRestoreJobCollections_envRead(skipped in CI)