Skip to content

chore: remove unused Session dataclass from clientstate_components - #105

Closed
elviskahoro wants to merge 1 commit into
LineIndent:mainfrom
elviskahoro:chore/remove-unused-session-dataclass
Closed

elviskahoro wants to merge 1 commit into
LineIndent:mainfrom
elviskahoro:chore/remove-unused-session-dataclass

Conversation

@elviskahoro

Copy link
Copy Markdown
Collaborator

Removes the Session dataclass from the clientstate_components getting-started page. It is never instantiated or referenced — pure deletion, no behavior change.

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

Co-authored-by: detail-app[bot] <180357370+detail-app[bot]@users.noreply.github.com>
@elviskahoro

Copy link
Copy Markdown
Collaborator Author

/trunk merge

elviskahoro added a commit that referenced this pull request Nov 10, 2026
#105)

**Detail bug report:** [View on
Detail](https://app.detail.dev/org_d38a878f-9df9-4c4b-a96a-f5180b860085/bugs/bug_a7702f18-44b3-4f91-8fd4-a1602b7f36ff)

Closes #89

## Bug

In the "Get Code" export dialog (`theme_cli_prompt` in
`app/templates/compiler.py`), the local-mode Copy button's
`rx.set_clipboard` payload wrote `uv run buridan init --preset {seed}
--include {theme_preset_option}` while the adjacent visible `<code>`
block showed `uv run buridan apply --preset {seed}`. The copied command
was invalid: the CLI's `init` subcommand accepts no arguments and
`--include` was removed in commit `8dc954cf`. Pasting the copied text
produced `buridan: error: unrecognized arguments: --preset ... --include
...` (exit 2).

Root cause: commit `755f3ed` corrected only the visible `<code>` block
when the CLI was refactored; the structurally-paired `rx.set_clipboard`
branch was left on the stale form, so the two surfaces silently
diverged. With the dialog's defaults (`seed=""`,
`theme_export_method="local"`, `theme_preset_option="full"`), the copied
payload was `uv run buridan init --preset --include full`.

## Fix

One-line change at `app/templates/compiler.py:183`: the local branch of
the `rx.set_clipboard` conditional now mirrors the displayed block —
`f"uv run buridan apply --preset {seed.value}"` instead of the stale
`init --preset ... --include ...` form.

The online clipboard branch and the `build.reflex.dev/?prompt=...`
`href`s in `compiler.py:159` and `app/templates/navbar.py:44` are
intentionally untouched — they feed the Reflex Build prompt URL rather
than the local `buridan` CLI, were not part of the proven defect, and
aligning them is a separate decision.

## Testing

- New `tests/test_theme_cli_prompt.py` (3 versioned tests, following the
compiled-JS patterns in `tests/test_block_card_copy.py` and
`tests/test_clientstate_components.py`):
- pins the Copy button's local-mode clipboard payload to the `apply`
form and rejects the stale `init --preset` / `--include` form;
  - pins the visible `<code>` block to the same `apply` form;
- asserts display/clipboard parity — the test that would have caught the
original one-sided edit that caused this bug.
- Routine checks: full unit suite, pyright typecheck, ruff lint, and
ruff format all pass on the modified files.
- Manual CLI smoke against the real `buridan` entry point in a throwaway
Reflex project root: `buridan apply --preset b0` succeeds (exit 0); the
stale `buridan init --preset b0 --include full` is argparse-rejected
(exit 2), confirming both halves of the display/clipboard divergence.
- Manual server smoke: booted the Reflex dev server and hit `/create`
(HTTP 200), then asserted on the compiled browser bundle the build
produces inside `.web/app_components/app/export.jsx` — it ships `uv run
buridan apply --preset` twice (clipboard payload and `<code>` block) and
contains zero occurrences of `uv run buridan init --preset`. The only
`--include` matches live inside the intentionally-untouched online-mode
`build.reflex.dev/?prompt=...` URL, not in any clipboard `writeText`
call site.
- Interactive browser click-through (clicking "Get Code", pasting into a
terminal, switching to "Reflex Build" online mode) was not performed —
there is no interactive browser in this environment. Those steps are
covered functionally by the unit tests (which render
`theme_cli_prompt()` directly and assert the on_click `_js_expr` and the
`<code>` child) and by the compiled-bundle check above (which asserts
the exact JS the browser would execute on click).

---
_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>
Co-authored-by: elvis kahoro <github@elvis.ai>
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