Skip to content

Python: Add RPC codecs for PythonResolutionResult marker#6832

Merged
knutwannheden merged 1 commit intomainfrom
python-resolution-result-codec
Feb 26, 2026
Merged

Python: Add RPC codecs for PythonResolutionResult marker#6832
knutwannheden merged 1 commit intomainfrom
python-resolution-result-codec

Conversation

@knutwannheden
Copy link
Copy Markdown
Contributor

Summary

  • When PythonRewriteRpc.parseProject() adds a PythonResolutionResult marker to setup.py (for projects with no pyproject.toml/setup.cfg), the subsequent printAll() sends this modified tree back to Python via the RPC diff protocol. Without Python-side codecs, the marker couldn't be deserialized, causing a message stream desync ("Expected positions array" error).
  • Adds Python dataclasses and bidirectional RPC codecs (send + receive) for PythonResolutionResult and its nested types: Dependency, ResolvedDependency, SourceIndex, and PackageManager.
  • Field order in the codecs matches the Java rpcSend/rpcReceive exactly.

Test plan

  • Verified codec registration: all four types registered with both Java and Python qualnames, with factories, receive codecs, and send codecs
  • parseFabricProject test passes: all 67 files from the fabric project parse and print correctly via parseProject(), including setup.py which previously failed
  • printAll() output matches bytes on disk for all files

When PythonRewriteRpc.parseProject() adds a PythonResolutionResult
marker to setup.py on the Java side, the subsequent printAll() sends
this modified tree back to Python via the RPC diff protocol. Without
Python-side codecs, the marker couldn't be deserialized, causing a
message stream desync ("Expected positions array" error).

Add Python dataclasses and bidirectional RPC codecs (send + receive)
for PythonResolutionResult and its nested types: Dependency,
ResolvedDependency, SourceIndex, and PackageManager.
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Feb 26, 2026
@knutwannheden knutwannheden changed the title Python: Add RPC codecs for PythonResolutionResult marker Python: Add RPC codecs for PythonResolutionResult marker Feb 26, 2026
@knutwannheden knutwannheden merged commit 640dd28 into main Feb 26, 2026
1 check passed
@knutwannheden knutwannheden deleted the python-resolution-result-codec branch February 26, 2026 13:43
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant