mirror of
https://github.com/gadievron/raptor.git
synced 2026-04-25 05:56:00 +03:00
[PR #47] [MERGED] Fix JSON serialization of Path objects in CodeQLWorkflowResult #50
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/raptor#50
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/gadievron/raptor/pull/47
Author: @gadievron
Created: 12/22/2025
Status: ✅ Merged
Merged: 12/26/2025
Merged by: @danielcuthbert
Base:
main← Head:fix/bug-41-json-serialization📝 Commits (1)
1de8b0eFix JSON serialization of Path objects in CodeQLWorkflowResult📊 Changes
1 file changed (+42 additions, -2 deletions)
View changed files
📝
packages/codeql/agent.py(+42 -2)📄 Description
Summary
Fixes TypeError during autonomous_summary.json generation by properly converting all Path objects to strings in CodeQLWorkflowResult.to_dict(), enabling successful autonomous analysis completion.
Problem
Autonomous analysis workflow fails at final step when attempting to serialize
CodeQLWorkflowResultto JSON. The error occurs becauseto_dict()usesasdict()which doesn't convertpathlib.Pathobjects to strings, causingTypeError: Object of type PosixPath is not JSON serializable.Root Cause
The
to_dict()method inCodeQLWorkflowResult(agent.py:46-59) manually convertslanguages_detectedbut relies onasdict()for everything else. Python'sasdict()recursively converts dataclasses but does NOT convert non-dataclass types likePath,datetime, etc.Affected Path objects (4 total):
databases_created[lang].database_path(Optional[Path])analyses_completed[lang].database_path(Path)analyses_completed[lang].sarif_path(Optional[Path])sarif_files(List[Path]) - Type annotation incorrectly claims List[str]Changes
File:
packages/codeql/agent.pyMethod:
CodeQLWorkflowResult.to_dict()(lines 46-99)Extended existing method to manually convert all Path objects:
Why This Fix is Correct
Location ✅
Approach ✅
Type of Change
Impact
Fixes #41
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.