fix(gitea,projman): type safety for create_label_smart, curl-based debug-report
Fixes multiple issues from diagnostic #123: 1. create_label_smart type safety (labels.py) - Add isinstance(result, dict) checks after API calls - Return structured error dict if API returns unexpected type - Prevents "list indices must be integers" crash 2. debug-report always uses curl with labels - Remove MCP option - always use curl for marketplace issues - Add label ID fetching step (Source/Diagnostic, Type/Bug) - Include labels in curl POST payload - Avoids branch protection restrictions on main branch Fixes #123 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -343,6 +343,15 @@ class LabelTools:
|
||||
None,
|
||||
lambda: self.gitea.create_org_label(owner, name, color, description)
|
||||
)
|
||||
# Handle unexpected response types (API may return list or non-dict)
|
||||
if not isinstance(result, dict):
|
||||
logger.error(f"Unexpected API response type for org label: {type(result)} - {result}")
|
||||
return {
|
||||
'name': name,
|
||||
'error': True,
|
||||
'reason': f"API returned {type(result).__name__} instead of dict: {result}",
|
||||
'level': 'organization'
|
||||
}
|
||||
result['level'] = 'organization'
|
||||
result['skipped'] = False
|
||||
logger.info(f"Created organization label '{name}' in {owner}")
|
||||
@@ -352,6 +361,15 @@ class LabelTools:
|
||||
None,
|
||||
lambda: self.gitea.create_label(name, color, description, target_repo)
|
||||
)
|
||||
# Handle unexpected response types (API may return list or non-dict)
|
||||
if not isinstance(result, dict):
|
||||
logger.error(f"Unexpected API response type for repo label: {type(result)} - {result}")
|
||||
return {
|
||||
'name': name,
|
||||
'error': True,
|
||||
'reason': f"API returned {type(result).__name__} instead of dict: {result}",
|
||||
'level': 'repository'
|
||||
}
|
||||
result['level'] = 'repository'
|
||||
result['skipped'] = False
|
||||
logger.info(f"Created repository label '{name}' in {target_repo}")
|
||||
|
||||
Reference in New Issue
Block a user