Make CLI startup lazy and benchmark command paths - #7050
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Greptile SummaryThis PR reduces cold CLI startup work by lazily resolving selected commands, plugin exports, and optional SQLAlchemy helpers. It also narrows frontend dependency cache inputs, adds per-package version-check cooldowns, and introduces fresh-process CLI benchmarks under CodSpeed simulation.
Confidence Score: 4/5The code changes appear functionally safe, but the outstanding repository requirement for human-readable comments on the version-check durations must be satisfied before merging. No new actionable defect was found in the changes since the previous review. The persisted-key finding was manually resolved and is fixed by named constants, while the existing duration-comment finding remains unresolved because the one-day and one-hour Files Needing Attention: reflex/utils/prerequisites.py
|
| Filename | Overview |
|---|---|
| reflex/reflex.py | Adds lazy Click command proxies and defers component and hosting CLI imports until command use. |
| packages/reflex-base/src/reflex_base/plugins/init.py | Converts plugin package exports to lazy module and attribute resolution while preserving the public surface. |
| packages/reflex-base/src/reflex_base/utils/types.py | Lazily resolves optional SQLAlchemy property classes and retains wildcard-import compatibility. |
| reflex/utils/types.py | Re-exports reflex-base type utilities without eagerly resolving the optional property-class tuple. |
| reflex/utils/js_runtimes.py | Narrows the frontend package installation cache key to dependencies and installation-affecting configuration. |
| reflex/utils/prerequisites.py | Adds per-package success and failure TTLs; the previously reported duration-comment rule violation remains outstanding. |
| tests/benchmarks/test_cli.py | Adds fresh-process CLI benchmarks with a configurable subprocess timeout. |
| .github/workflows/performance.yml | Switches CodSpeed to subprocess-aware simulation and supplies the benchmark timeout through the job environment. |
Reviews (4): Last reviewed commit: "ci: configure CLI benchmark timeout expl..." | Re-trigger Greptile
Merging this PR will not alter performance
Comparing Footnotes
|
FarhanAliRaza
left a comment
There was a problem hiding this comment.
Will need to set reflex-base floor on release.
At least for now, all reflex packages are hard pinned to the matching reflex-base, so that shouldn't be an issue. That said, it seems like the reflex and reflex-base changes are not actually interdependent...unless i'm missing something |
…an refresh Verifies two process-level changelog claims against the previous stable. The shared-asset fix (#7039) is confirmed on its deterministic half: a stale symlink pointing at the wrong file is repointed on 0.9.11a1 and silently left alone on 0.9.10.post2, so the old release served the wrong asset. The concurrent-first-create half could not be provoked on this filesystem on either version, which is recorded rather than reported. CLI startup (#7050) is ~2.3x faster across every subcommand. The release plan now carries FINDING-035/036, the verifier confirmation of FINDING-033, and the completed enterprise sweep. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0167TFRX1CXqwGK8uh7DBE7c
…nded late Second passes over config_assets_cli, ent_mantine_highcharts_tickets and memo_hash finished after the campaign was closed out. The important result is a correction: FINDING-036 is re-rated from LOW to HIGH. The two console errors the first pass called harmless set backend_state_mismatch, a one-way latch that discards every user event, so the enterprise tickets demo's UI never dispatches anything in dev or prod on either reflex version — while its REST API works. Rendering one var from every substate the backend knows about is the workaround. Adds FINDING-040 to FINDING-049: non-reproducible memo module names across identical compiles, same-named ComponentState subclasses in different modules crashing the compile, client_state(global_ref=False) breaking when memoization splits reader from writer, and smaller CLI, changelog and enterprise items. Two "verified clean" claims are qualified: #7050's frontend-reinstall half is not observable and #7039's multi-process scenario still aborts one step past the fixed asset link. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0167TFRX1CXqwGK8uh7DBE7c
What changed
component,cloud, anddeploythrough lazy Click command proxies so root CLI discovery does not import their implementations.EAGER_IMPORTbehavior, Click metadata, and missing-package help.Run benchmarksjob.Measured impact
Controlled fresh-process measurements on the same machine:
mainreflex --versionp50Current p50s are 66.2 ms for root help, 66.1 ms for
run --help, 67.6 ms forcomponent --help, 78.0 ms forcloud --help, and 68.1 ms fordeploy --help.Validation
uv run pytest -q tests/units— 8,329 passed, 18 skippeduv run pytest -q tests/benchmarks/test_cli.py— 8 passeduv run ruff check .uv run ruff format --check .uv run pyright reflex testsRelated work
#7049 targets backend/dev-process import overhead. This PR is scoped to CLI command discovery and cold-start latency; the two changes overlap in type/prerequisite tests and may need rebase ordering if both land.
Checklist
CONTRIBUTING.md.