fix: resolve 8 bugs affecting real users
- Fix KeyError 'root' in FileGrouper when merging groups with no root-level files - Fix changelog commit parsing breaking on multiline bodies (use %x00 separator) - Add empty choices/content checks in OpenAI, Anthropic, OpenRouter providers - Fix config edit crash when config is empty - Fix validate command using wrong color for 'no staged files' - Add type check for corrupted YAML config (non-dict returns empty dict)
This commit is contained in:
8 files changed
+29
-10
No files matched your search
@@ -32,17 +32,21 @@ class ChangelogGenerator:
|
||||
else:
|
||||
cmd = self._resolve_range(to_ref)
|
||||
try:
|
||||
return run_git_command(cmd).split("\n")
|
||||
output = run_git_command(cmd)
|
||||
# Use %x00 as separator to avoid splitting on newlines in commit bodies
|
||||
# Then filter out empty strings
|
||||
return [c for c in output.split("\0") if c.strip()]
|
||||
except subprocess.CalledProcessError as e:
|
||||
self.logger.error(f"Git command failed: {e}")
|
||||
raise RuntimeError(f"Git command failed: {e}") from e
|
||||
|
||||
def _log_cmd(self, range_spec: str) -> List[str]:
|
||||
# Format: hash|author|date|subject|body
|
||||
# Format: hash|author|date|subject|body (separated by %x00 to avoid
|
||||
# splitting on newlines within commit bodies)
|
||||
return [
|
||||
"git",
|
||||
"log",
|
||||
"--format=%H|%an|%ad|%s|%b",
|
||||
"--format=%H|%an|%ad|%s|%b%x00",
|
||||
"--date=short",
|
||||
range_spec,
|
||||
]
|
||||
|
||||
@@ -129,10 +129,7 @@ class FileGrouper:
|
||||
parent_path = str(Path(deepest).parent)
|
||||
new_key = "root" if parent_path == "." else parent_path
|
||||
files = groups.pop(deepest)
|
||||
if new_key in groups:
|
||||
groups[new_key].extend(files)
|
||||
else:
|
||||
groups["root"].extend(files)
|
||||
groups.setdefault(new_key, []).extend(files)
|
||||
return groups
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user