Skip to content

refactor(rds): name the arguments to db_instance_xml's format string#317

Merged
vieiralucas merged 1 commit intomainfrom
worktree-cleanup+rds-db-instance-xml
Apr 13, 2026
Merged

refactor(rds): name the arguments to db_instance_xml's format string#317
vieiralucas merged 1 commit intomainfrom
worktree-cleanup+rds-db-instance-xml

Conversation

@vieiralucas
Copy link
Copy Markdown
Member

@vieiralucas vieiralucas commented Apr 12, 2026

Summary

db_instance_xml builds the XML body for a single DescribeDBInstances entry. The format string at the bottom used twenty-eight positional arguments aligned with {} holes in a thirty-line template. Verifying that a particular field lands in the right tag required counting.

This PR switches to named format arguments so that <MultiAZ>{multi_az}</MultiAZ> is self-explanatory and the positional list becomes a labeled binding block. Also lifts the inline latest_restorable_time .map().unwrap_or_default() chain out of the argument list into a named variable, for consistency with the other pre-built XML fragments (db_name_xml, vpc_security_groups_xml, etc.).

No output change.

Test plan

  • cargo build --workspace
  • cargo fmt --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace --exclude fakecloud-e2e --exclude fakecloud-conformance — 1102 passed, 0 failed
  • CI green

Summary by cubic

Refactored fakecloud-rds XML builder to use named format arguments in db_instance_xml and extracted latest_restorable_time into a variable. Improves readability and reduces mistakes; no output change.

  • Refactors
    • Replaced 28 positional format! args with named bindings (e.g., <MultiAZ>{multi_az}</MultiAZ>).
    • Moved latest_restorable_time mapping into latest_restorable_time_xml alongside other prebuilt fragments.

Written for commit e1c28b6. Summary will update on new commits.

``db_instance_xml`` builds the XML body for a single ``DescribeDBInstances``
entry. The format string at the bottom takes twenty-eight positional
arguments that a reader has to mentally align with the ``{}`` holes in a
thirty-line template. Verifying that a particular field lands in the
right tag requires counting.

Switches to named format arguments. ``<MultiAZ>{multi_az}</MultiAZ>`` is
self-explanatory now; the rest of the positional list becomes a labeled
binding block. Also lifts the inline ``latest_restorable_time``
``.map().unwrap_or_default()`` chain out of the argument list into a
named variable alongside the other pre-built XML fragments, for
consistency with ``db_name_xml`` / ``vpc_security_groups_xml`` / etc.

No output change. All 1102 unit tests still pass.
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

@vieiralucas vieiralucas merged commit 2b2a0a9 into main Apr 13, 2026
22 checks passed
@vieiralucas vieiralucas deleted the worktree-cleanup+rds-db-instance-xml branch April 13, 2026 00:02
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.

1 participant