Describe the bug
In src/helpers/bedrockCatalog.js:
profileIdByModelId(inferenceProfileSummaries) and normalizeBedrockCatalog(modelSummaries, inferenceProfileSummaries) iterate directly over inferenceProfileSummaries || [] and modelSummaries || []. When passed non-array objects or primitives, it throws TypeError: (intermediate value) is not iterable.
- When sorting models via
models.sort((a, b) => a.vendor.localeCompare(b.vendor) || a.label.localeCompare(b.label)), if a model summary contains non-string providerName, modelName, or modelId, calling .localeCompare() throws TypeError: a.vendor.localeCompare is not a function.
To Reproduce
- Call
normalizeBedrockCatalog({}, {}) -> throws TypeError.
- Call
normalizeBedrockCatalog(null, undefined) with non-string fields -> throws TypeError.
Expected Behavior
normalizeBedrockCatalog and profileIdByModelId should safely accept non-array inputs, defaulting to empty arrays.
vendor and label should safely be coerced to strings to ensure deterministic sorting without throwing.
Describe the bug
In
src/helpers/bedrockCatalog.js:profileIdByModelId(inferenceProfileSummaries)andnormalizeBedrockCatalog(modelSummaries, inferenceProfileSummaries)iterate directly overinferenceProfileSummaries || []andmodelSummaries || []. When passed non-array objects or primitives, it throwsTypeError: (intermediate value) is not iterable.models.sort((a, b) => a.vendor.localeCompare(b.vendor) || a.label.localeCompare(b.label)), if a model summary contains non-stringproviderName,modelName, ormodelId, calling.localeCompare()throwsTypeError: a.vendor.localeCompare is not a function.To Reproduce
normalizeBedrockCatalog({}, {})-> throwsTypeError.normalizeBedrockCatalog(null, undefined)with non-string fields -> throwsTypeError.Expected Behavior
normalizeBedrockCatalogandprofileIdByModelIdshould safely accept non-array inputs, defaulting to empty arrays.vendorandlabelshould safely be coerced to strings to ensure deterministic sorting without throwing.