Skip to content

lore-aws: return proper error for invalid dynamo query instead of panic - #54

Open
subbareddypalagiri wants to merge 1 commit into
EpicGames:mainfrom
subbareddypalagiri:fix-dynamo-pagination-loop
Open

lore-aws: return proper error for invalid dynamo query instead of panic#54
subbareddypalagiri wants to merge 1 commit into
EpicGames:mainfrom
subbareddypalagiri:fix-dynamo-pagination-loop

Conversation

@subbareddypalagiri

Copy link
Copy Markdown
Contributor

Changed the panic condition to instead return a proper error.

@subbareddypalagiri
subbareddypalagiri force-pushed the fix-dynamo-pagination-loop branch 2 times, most recently from 6b22a1d to d9fc475 Compare June 22, 2026 17:12
@mjansson

mjansson commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Seems this PR needs a bit of cleaning up or rebasing

@mjansson mjansson changed the title fix: return proper error for invalid dynamo query instead of panic lore-aws: return proper error for invalid dynamo query instead of panic Jul 7, 2026
Copilot AI review requested due to automatic review settings July 7, 2026 17:37
@subbareddypalagiri
subbareddypalagiri force-pushed the fix-dynamo-pagination-loop branch from d9fc475 to 04e4234 Compare July 7, 2026 17:37

Copilot AI 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.

Pull request overview

This PR adjusts DynamoDB query pagination behavior in lore-aws to avoid panicking on an invalid query configuration and instead surface an error to callers.

Changes:

  • Added a validation guard in query_paginated for the invalid combination of Select::Count with limit.
  • Removed the feature-flag gate (LORE_ENABLE_QUERY_PAGINATION) so pagination follow-up queries are no longer conditional on an env var.
  • Updated pagination continuation logic/comments accordingly.
Comments suppressed due to low confidence (1)

lore-aws/src/dynamodb.rs:657

  • This change removes the LORE_ENABLE_QUERY_PAGINATION feature flag and makes pagination behavior unconditional whenever LastEvaluatedKey is present. That’s a behavioral/operational change beyond “replace panic with error” described in the PR metadata; please either (a) update the PR description/scope (or split into a separate PR), or (b) reintroduce the flag if it’s still needed for rollout/debugging.
                    if let Some(last_evaluated_key) = r.last_evaluated_key
                        && !last_evaluated_key.is_empty()
                        && (query.limit().is_none()
                            || matches!(query.select(), Some(Select::Count))
                            || query.limit().is_some_and(|l| output.count < l))

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lore-aws/src/dynamodb.rs
Comment on lines +569 to +575
if matches!(query.select(), Some(Select::Count)) && query.limit().is_some() {
return Err(crate::aws_error::AwsError::AwsSdkError(aws_sdk_dynamodb::error::SdkError::construction_failure("Combining Select::Count and a limit is disallowed for paginated queries")));
}

if matches!(query.select(), Some(Select::Count)) && query.limit().is_some() {
panic!("Combining Select::Count and a limit is disallowed for paginated queries to avoid fetching count one row at a time.");
}
@subbareddypalagiri
subbareddypalagiri force-pushed the fix-dynamo-pagination-loop branch from 04e4234 to 3de3cf2 Compare July 7, 2026 18:15
@mjansson

Copy link
Copy Markdown
Collaborator

@subbareddypalagiri seems to conflict again with the removal of the pagination toggle - could you update?

@ajcarberry ajcarberry added the area:server Server, provider integrations, telemetry label Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:server Server, provider integrations, telemetry

Development

Successfully merging this pull request may close these issues.

4 participants