openrewrite / openrewrite/rewrite
RPC-backed languages: parsed source files have no FileAttributes
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 570
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 261
Description
A source file parsed through any RPC-backed language comes back with getFileAttributes() == null. Anything downstream reasoning about a source file's size, last-modified time or permissions gets nothing, and a guard written against those values silently disables itself rather than failing — which is how this was noticed, as a size-based freshness check that had been a no-op for every Python file it ever saw.
Measured on a real project parse: all 195 Py.CompilationUnits came back with null FileAttributes.
Where it goes missing
FileAttributes.fromPath is called on exactly one branch in each language's project-parse path — the Quark branch, for oversize files the peer declines to parse:
| language | call site |
|---|---|
| Python | PythonRewriteRpc.java:260 |
| JavaScript | JavaScriptRewriteRpc.java:210 |
| C# | CSharpRewriteRpc.java:168 |
| Go | GoRewriteRpc.java:296 |
A compilation unit takes the other branch, getObject(...), and gets whatever the peer sent. The peers do not set the field — in rewrite-python, parse_python_source builds the LST and never populates it, and a parsed unit reports file_attributes = None in-process.
The shared parseInputs path is worse off: RewriteRpc.parse contains no reference to FileAttributes at all, so neither branch of neither path populates it.
The plumbing already exists. Every peer's sender and receiver carries the slot — PythonSender:66 / PythonReceiver:73, and the equivalents in the other three — so a value set on either side would survive the wire. Nothing sets one.
Two ways to fix it, and they are not equivalent
- The peer populates the slot it already has. The peer stats the file it just read, so the attributes describe the bytes that produced the LST. Costs a stat per file on the peer and a little more on the wire.
- The Java side stats the path after
getObject. Matches what theQuarkbranch already does and needs no peer changes, but it stats a file the peer may have read some time earlier, so the attributes can disagree with the LST — which defeats the freshness-guard use case that surfaced this.
Worth deciding once and applying to all four languages rather than per-language, since the shape is identical in each.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with RewriteRpc.parse and the listed PythonRewriteRpc.java, JavaScriptRewriteRpc.java, CSharpRewriteRpc.java, and GoRewriteRpc.java call sites, then trace each peer's sender and receiver. Decide which side should provide attributes, apply that choice consistently to compilation-unit and parseInputs paths, and verify that parsed units from all four languages report non-null attributes matching the parsed source.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, go, java, javascript, python
- Domain
- backend, compilers, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100