Skip to content

Conversation

@robstax
Copy link
Contributor

@robstax robstax commented Dec 17, 2025

This pull request addresses

u2c service will start returning -1 host priority values indicating that the host should not be used. the current services implementation does not correctly handle negative values.

by making the following changes

This is a bug fix, not a breaking change. The core logic is preserved:

homeCluster filtering - Still filters by host.homeCluster when no clusterId is provided
clusterId filtering - Still filters by host.id === clusterId when provided
Priority selection - Still selects the host with the lowest priority number (priority 1 > priority 5)
Failed host handling - Still resets failed flags when all hosts have failed
What the fix actually does
The only behavioral difference is for hosts with priority <= 0:

Before: A host with priority: -1 could "win" the reduce because -1 > undefined is false, and the comparison logic was flawed with the empty object {} initial value
After: Hosts with priority <= 0 are excluded upfront, and if no valid hosts remain, it falls back to defaultUrl

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios were tested

< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >

The GAI Coding Policy And Copyright Annotation Best Practices

  • GAI was not used (or, no additional notation is required)
  • Code was generated entirely by GAI
  • GAI was used to create a draft that was subsequently customized or modified
  • Coder created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code)
  • Tool used for AI assistance (GitHub Copilot / Other - specify)
    • Github Copilot
    • Other - Please Specify
  • This PR is related to
    • Feature
    • Defect fix
    • Tech Debt
    • Automation

I certified that

  • I have read and followed contributing guidelines
  • I discussed changes with code owners prior to submitting this pull request
  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the documentation accordingly

Make sure to have followed the contributing guidelines before submitting.

@robstax robstax requested review from a team as code owners December 17, 2025 18:39
@robstax robstax added the validated If the pull request is validated for automation. label Dec 17, 2025
@aws-amplify-us-east-2
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-4621.d3m3l2kee0btzx.amplifyapp.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

validated If the pull request is validated for automation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant