do not use actual filepath for docgen module#1809
Conversation
Greptile SummaryThis PR separates the concept of a "virtual filepath" (the stable, environment-independent doc path such as Key changes:
Confidence Score: 5/5Safe to merge — the logic change is correct and only one minor dead-code P2 finding remains. The core fix is sound: using a virtual/stable path as the module key instead of an environment-specific absolute path makes the docgen pipeline deterministic. The only remaining finding is a P2 style issue (the pcweb/docgen_pipeline.py — the Important Files Changed
Reviews (1): Last reviewed commit: "do not use actual filepath for docgen mo..." | Re-trigger Greptile |
| def __init__(self, virtual_filepath: str = "", filename: str = "") -> None: | ||
| self.virtual_filepath = virtual_filepath | ||
| self.filename = filename | ||
| self.env: dict = {} |
There was a problem hiding this comment.
Unused
filename parameter and attribute
After this PR, self.filename is stored in __init__ but never read anywhere in ReflexDocTransformer. All former usages of self.filename (in _exec_code calls and error .add_note() strings) have been replaced with self.virtual_filepath. The filename argument (and its assignment) is now dead code.
If the actual filepath is intentionally kept for potential future use or external callers, a comment explaining that would help; otherwise it can be removed to keep the interface clean.
| def __init__(self, virtual_filepath: str = "", filename: str = "") -> None: | |
| self.virtual_filepath = virtual_filepath | |
| self.filename = filename | |
| self.env: dict = {} | |
| def __init__(self, virtual_filepath: str = "") -> None: | |
| self.virtual_filepath = virtual_filepath | |
| self.env: dict = {} |
And in render_docgen_document, the call becomes:
transformer = ReflexDocTransformer(virtual_filepath=str(virtual_filepath))
No description provided.