fix(plugin-sdk): reject malformed UTF-8 in live provider model catalog responses (#111766)

* fix: reject malformed UTF-8 in live provider model catalog responses

Add { fatal: true } to TextDecoder in readLiveModelCatalogJson so
invalid UTF-8 bytes throw a TypeError before JSON.parse instead of
silently becoming U+FFFD.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* test(plugin-sdk): add fallback proof for malformed UTF-8 in live catalog

Adds a focused test that constructs raw bytes with an invalid 0xFE byte
inside a JSON string value and validates that buildLiveModelProviderConfig
catches the Typeerror and falls back to the static catalog rows.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(pr): classify auto-merge failures without ripgrep

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
chenyangjun-xy
2026-07-28 06:03:09 +08:00
committed by GitHub
parent 8207d016d5
commit 15ae1ddb93
3 changed files with 67 additions and 4 deletions
+24 -3
View File
@@ -28,9 +28,30 @@ print_file_list_with_limit() {
auto_merge_unavailable_error() {
local log_file="$1"
grep -Eqi -- \
'auto[- ]merge.*(not allowed|not enabled|not available|unavailable|not configured|not supported|must be enabled)|(not allowed|not enabled|not available|unavailable|not configured|not supported).*auto[- ]merge' \
"$log_file"
local auto_merge_pattern='[Aa][Uu][Tt][Oo][ -][Mm][Ee][Rr][Gg][Ee]'
local unavailable_pattern
local line
while IFS= read -r line || [ -n "$line" ]; do
case "$line" in
*$auto_merge_pattern*)
for unavailable_pattern in \
'[Nn][Oo][Tt] [Aa][Ll][Ll][Oo][Ww][Ee][Dd]' \
'[Nn][Oo][Tt] [Ee][Nn][Aa][Bb][Ll][Ee][Dd]' \
'[Nn][Oo][Tt] [Aa][Vv][Aa][Ii][Ll][Aa][Bb][Ll][Ee]' \
'[Uu][Nn][Aa][Vv][Aa][Ii][Ll][Aa][Bb][Ll][Ee]' \
'[Nn][Oo][Tt] [Cc][Oo][Nn][Ff][Ii][Gg][Uu][Rr][Ee][Dd]' \
'[Nn][Oo][Tt] [Ss][Uu][Pp][Pp][Oo][Rr][Tt][Ee][Dd]' \
'[Mm][Uu][Ss][Tt] [Bb][Ee] [Ee][Nn][Aa][Bb][Ll][Ee][Dd]'; do
case "$line" in
*$unavailable_pattern*) return 0 ;;
esac
done
;;
esac
done < "$log_file"
return 1
}
mainline_drift_requires_sync() {