ENG-9414: Remove hardcoded docs urls#6395
Conversation
Greptile SummaryThis PR replaces ~230 hardcoded Confidence Score: 4/5Safe to merge; changes are confined to internal documentation infrastructure with no runtime product impact. Only P2 findings: a soft eval sandbox (mitigated by the fully repo-controlled input) and missing error context for NameError/AttributeError in the link resolver. No logic bugs or data-path issues identified. docs/app/reflex_docs/docgen_pipeline.py — the
|
| Filename | Overview |
|---|---|
| docs/app/reflex_docs/docgen_pipeline.py | Converted _render_spans from free function to instance method; added _resolve_link_target using regex + eval to expand {expr} hrefs; updated all call sites. Two P2 concerns: soft eval sandbox and missing error context for NameError/AttributeError. |
| docs/app/reflex_docs/pages/docs/init.py | Copies .path attribute from top-level page objects onto the shadowed SimpleNamespace objects so markdown can reference {library.path} and {custom_components.path} correctly. |
| docs/app/tests/test_docgen_link_targets.py | New test file covering plain URL passthrough, brace expr substitution, and anchor composition. No issues found. |
| docs/getting_started/basics.md | All hardcoded /docs/... URLs replaced with {namespace.path} expressions; corresponding imports added to the python exec block. |
| docs/enterprise/overview.md | All hardcoded enterprise component links replaced with dynamic path references; enterprise namespace imported in exec block. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Markdown source\n[text]({ns.attr.path})"] --> B["_exec_code\nbuilds env namespace"]
B --> C["ReflexDocTransformer\n(holds self.env)"]
C --> D["self._render_spans(spans)"]
D --> E{LinkSpan?}
E -- yes --> F["_resolve_link_target(target, self.env)"]
F --> G["_BRACE_RE.sub(_sub, target)"]
G --> H["eval(expr, {__builtins__:{}}, env)\nresolves ns.attr.path → str"]
H --> I["doclink2(text, href=resolved)"]
E -- no --> J["other span types\n(text, bold, code, img...)"]
I --> K["rx.Component tree"]
J --> K
Reviews (1): Last reviewed commit: "ENG-9414: Remove hardcoded docs urls" | Re-trigger Greptile
|
i would prefer if we didn't, it makes less digestable to AI |
that's true indeed see this @Alek99 |
|
this should instead be a CI/check step that all internal doc links are valid |
There was a problem hiding this comment.
one thing we need to solve with this is getting the actual url to be rendered when the user accesses the .md link. right now, it's just showing the placeholder, which makes the link unusable.
there's another issue i think we should address #6436, which is indicating the markdown files served via .md are utf-8. on my mac, both safari and chrome are defaulting to latin-1 or something and it's garbling some characters.
No description provided.