Refactor: Fix unwrap issues, dynamo pagination loops, and enforce CLI validation - #41
Refactor: Fix unwrap issues, dynamo pagination loops, and enforce CLI validation#41subbareddypalagiri wants to merge 2 commits into
Conversation
| T: DynamoDbQuery + 'static, | ||
| { | ||
| 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."); |
There was a problem hiding this comment.
A panic is not an appropriate way to handle this. This should either be a combination that's structurally not possible and verified at compile time or it should be a properly handled runtime error.
|
I would prefer if these unrelated changes are all broken up into separate PRs (and don't forget the DCO sign-off, see the contributing doc for instructions) |
|
Thank you both @ragnarula and @mjansson for the thorough review and constructive feedback! You are completely right on all points. I have gone ahead and addressed your concerns:
To keep the history clean and to respect your workflow, I will be closing this tangled PR now in favor of the new, separated ones. Thanks again for your time and for maintaining this awesome project! Best regards, |
Hey team! This Pull Request bundles a few structural backend improvements and cleanups:
1. Replace
unwrap()withexpect()inlore/build.rsThis is a small refactor, but it ensures that if the build script ever fails (for example, missing
OUT_DIRenvironment variables), it will provide a clear, actionable error message rather than a generic panic.2. Fix Degenerate DynamoDB Pagination Query Bug
Currently, combining
Select::Countwith alimitin paginated queries causes DynamoDB to fetch the total count one row at a time, resulting in a degenerate performance loop. This adds a strict guard clause toquery_paginatedto panic/fail-fast if this combination is used, protecting cloud resources.3. Remove Legacy
ENABLE_QUERY_PAGINATIONTech DebtPagination support has been stable for some time. This removes the legacy environment variable check (
ENABLE_QUERY_PAGINATION) and its associatedTODO(jcohen), hardcoding the pagination logic to always run and reducing technical debt.4. Mutually Exclusive CLI Logging Arguments (Closes UCS-12558)
Resolves the open Jira ticket
TODO(UCS-12558): Cleanup logging args. The CLI previously allowed contradictory logging arguments (e.g. running with--debugand--silentsimultaneously). This addsconflicts_with_allbounds to the clap parser forlevel,debug, andsilentto strictly enforce mutually exclusive input validation.This is my first major contribution here, looking forward to any feedback!