Skip to content

chore: remove dead menu.py constants and type aliases - #110

Closed
elviskahoro wants to merge 1 commit into
LineIndent:mainfrom
elviskahoro:chore/remove-dead-menu-constants
Closed

elviskahoro wants to merge 1 commit into
LineIndent:mainfrom
elviskahoro:chore/remove-dead-menu-constants

Conversation

@elviskahoro

Copy link
Copy Markdown
Collaborator

Removes unused constants and type aliases from components/ui/menu.py and regenerates assets/docs/components/menu.md to match. No behavior change.

Part of a series of independent cleanup PRs — each one is self-contained and can be reviewed/merged in any order.

* chore: remove dead menu.py constants and type aliases

* Regenerate menu.md after dead-code removal

---------

Co-authored-by: detail-app[bot] <180357370+detail-app[bot]@users.noreply.github.com>
elviskahoro pushed a commit that referenced this pull request Oct 25, 2026
…110)

**Detail bug report:** [View on
Detail](https://app.detail.dev/org_d38a878f-9df9-4c4b-a96a-f5180b860085/bugs/bug_1dfc3843-7478-4448-90ad-88762d3babbe)

Closes #94

## Bug

The "Open in ChatGPT / Claude / Reflex" links in the docs
table-of-contents (`app/templates/toc.py::_create_external_tool_links`)
built their AI prompt as a multi-line f-string indented at the function
body, then interpolated it raw into the `?q=` / `?prompt=` query string.
The prompt's value therefore carried two literal newlines and two
4-space indentation runs, and the href was never percent-encoded.
Browsers strip newlines but preserve spaces, so the destination tool
received a prompt like `...button. Help me understand...` (four spaces
where one was intended) with trailing whitespace — and the emitted URL
violated RFC 3986 (raw whitespace in the query). Every docs page shipped
this defect.

The four companion `?prompt=` links elsewhere in the codebase
(`compiler.py`, `navbar.py`, `examples/utils.py`) are single-line and
leak-free; `toc.py` was the only site split across source lines.

## Fix

- Normalize the prompt with `textwrap.dedent(...).split()` joined by
single spaces, collapsing it to the same single-line form the companion
links already use.
- Percent-encode it with `urllib.parse.quote(prompt, safe='')` before
interpolating into all three hrefs.

The decoded prompt the destination tool now receives is the clean
single-line sentence:
`I'm looking at this buridan/ui documentation:
https://buridan-ui.reflex.run/docs/components/button. Help me understand
how to use it. Be ready to explain concepts, give examples, or help
debug based on it.`

## Testing

- Added `tests/test_external_tool_prompt.py` with two regression tests:
the bug report's canonical falsifiable test (no `\\n` or ` Help` in the
rendered ChatGPT href) and a comprehensive test asserting all three
hrefs are valid RFC-3986 URIs (`https` scheme, correct host, no raw
whitespace in the query, `%20` encoding present, decoded prompt is
single-line with no indentation runs, and the page-specific `fmt_url` is
embedded).
- Unit tests, typecheck (`pyright`), and lint/format (`ruff`) all pass
on the changed files; the full suite passes with no regressions.
- End-to-end verification against a running dev server (`reflex run`)
with a headless Chromium browser: rendered `/docs/components/button`,
`/accordion`, `/card`, and `/dialog`, confirmed the three "Open in …"
anchors carry `%20`-encoded hrefs with no raw spaces or newlines, that
the browser-resolved `a.href` round-trips back to the clean single-line
prompt after WHATWG normalization, and that the "View Markdown" link
still points to `/<url>.md` and downloads the markdown (HTTP 200). The
deepest click-through into the external destinations (chatgpt.com /
claude.ai / build.reflex.dev) was not navigated to completion because
those are authenticated services unavailable in this environment; the
equivalent machine-checkable contract — the RFC-3986-conformant,
WHATWG-round-tripping href the browser opens — was verified instead.

---
_Automatic Fixes PRs can be [configured
here](https://app.detail.dev/org_d38a878f-9df9-4c4b-a96a-f5180b860085/settings/repos/repo_04b9d58c-daa0-46b6-9560-7f39569ec6eb/bugs)._

---------

Co-authored-by: detail-app[bot] <180357370+detail-app[bot]@users.noreply.github.com>
elviskahoro added a commit that referenced this pull request Oct 25, 2026
<!-- entire-trail-link-start -->
https://entire.io/gh/elviskahoro/buridan-ui/trails/16
<!-- entire-trail-link-end -->

## Why
Fixed three critical documentation issues: (1) anatomy block generation
was silently failing with swallowed errors embedded in 37 component docs
due to a stale import path; (2) external tool links in TOC leaked source
indentation into query strings, violating RFC 3986; (3) mobile sidebar
routed external URLs through client-side routing, stranding users on
404s. Each issue included regression tests to prevent recurrence.

## Closes
- #87 (PR #103: anatomy generation)
- #94 (PR #110: TOC link encoding)  
- #93 (PR #109: mobile sidebar routing)

<!-- conductor-workspace-link -->

---

[Open workspace in
Conductor](https://app.conductor.build/elviskahoro-cloud/w/262)

---------

Co-authored-by: pullfrog[bot] <226033991+pullfrog[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant