Skip to content

fix: Sends plural data source list query params during pagination - #4680

Merged
EspenAlbert merged 2 commits into
CLOUDP-435981_autogen-wait-error-descriptionfrom
CLOUDP-433211_query-param-support
Aug 26, 2026
Merged

fix: Sends plural data source list query params during pagination#4680
EspenAlbert merged 2 commits into
CLOUDP-435981_autogen-wait-error-descriptionfrom
CLOUDP-433211_query-param-support

Conversation

@EspenAlbert

@EspenAlbert EspenAlbert commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • HandleDataSourceReadList kept only pageNum and dropped list filters already built by BuildQueryParamMap.
  • Clone existing query params, set pageNum on the copy (WithPageNum).
  • Unblocks integration_type on mongodbatlas_log_integrations and integration_type / provider_type on mongodbatlas_metric_integrations.
  • Collection-restore plural filters stay optional; the schema hook that hid them is dropped on feat: Adds cloud backup collection restore job resource #4669.

Does not close CLOUDP-433211. Codegen getQueryParams still skips computed_optional (include_system_managed on service accounts).

Test plan

  • go test ./internal/common/autogen/ -count=1
  • Acc: TestAccCloudBackupCollectionRestoreJob_snapshotSameClusterDatabaseRename second step (source_namespace filter, results.# = 1) on test: Adds collection restore job acceptance tests #4671
  • Optional local: TestAccCloudBackupCollectionRestoreJobCollections_envRead (skipped in CI)

@EspenAlbert
EspenAlbert requested a review from a team as a code owner August 26, 2026 12:22
@github-actions github-actions Bot added the bug label Aug 26, 2026
@augmentcode

augmentcode Bot commented Aug 26, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Fixes pagination for auto-generated plural data sources that use query filters.

Changes:

  • Retains the query-parameter map built from data-source configuration on every paginated request.
  • Introduces WithPageNum to clone that map and apply the paginator’s current pageNum without mutating the original call parameters.
  • Adds unit coverage for nil, empty, filtered, and pre-paginated maps, including input immutability.
  • This enables list filters such as integration and collection-restore filters to remain effective across pages.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

Copilot AI lite review requested due to automatic review settings August 26, 2026 12:28
@EspenAlbert
EspenAlbert requested a review from a team as a code owner August 26, 2026 12:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 WithPageNum to clone existing query params and set pageNum without mutating the original map.
  • Updates HandleDataSourceReadList to use WithPageNum(req.CallParams.QueryParams, pageNum) so pagination retains previously built filters.
  • Adds unit tests for WithPageNum behavior (nil/empty inputs, overwrites pageNum, 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 AgustinBettati left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice, thanks for quickly triaging and driving this fix

EspenAlbert and others added 2 commits August 26, 2026 14:39
…ation

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@EspenAlbert
EspenAlbert force-pushed the CLOUDP-433211_query-param-support branch from a734612 to 3c00729 Compare August 26, 2026 13:39

@erabil-mdb erabil-mdb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@EspenAlbert
EspenAlbert merged commit f9b5c40 into master Aug 26, 2026
97 of 99 checks passed
@EspenAlbert
EspenAlbert deleted the CLOUDP-433211_query-param-support branch August 26, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants