Append a referrer param to the "Built with Reflex" badge link - #6951
Append a referrer param to the "Built with Reflex" badge link#6951FarhanAliRaza wants to merge 1 commit into
Conversation
β¦dge link The badge always links to reflex.dev; when the REFLEX_REFERRER_PARAM env var is set at compile time, its value is appended urlencoded as https://reflex.dev/?ref=<value>. This is the mechanism the referral bonus (ENG-11623) rides on: the hosting service injects the per-owner identifier at build time, and the destination itself stays fixed.
Greptile SummaryThe PR adds a compile-time
Confidence Score: 4/5The dependency floor must be updated before merging because supported minimum-version installations can fail during production compilation. The URL construction itself preserves the intended referral value, but the components package unconditionally accesses an environment attribute introduced after its declared minimum reflex-base release. Files Needing Attention: packages/reflex-components-core/src/reflex_components_core/core/sticky.py and packages/reflex-components-core/pyproject.toml
|
| Filename | Overview |
|---|---|
| packages/reflex-base/src/reflex_base/environment.py | Adds an optional string environment variable whose existing EnvVar behavior correctly handles unset and empty values. |
| packages/reflex-components-core/src/reflex_components_core/core/sticky.py | Correctly encodes the referral value, but consumes a reflex-base API unavailable at the package's declared minimum dependency version. |
| tests/units/components/core/test_sticky.py | Covers URL behavior in the monorepo environment but does not exercise the supported minimum reflex-base dependency set. |
Reviews (1): Last reviewed commit: "ENG-11714 feat: append a referrer param ..." | Re-trigger Greptile
| Returns: | ||
| The badge destination URL. | ||
| """ | ||
| referrer = environment.REFLEX_REFERRER_PARAM.get() |
There was a problem hiding this comment.
Dependency floor lacks attribute
When production compilation uses the supported minimum dependency set, reflex-base 0.9.7 lacks REFLEX_REFERRER_PARAM, so _badge_href() raises AttributeError while creating the sticky badge and aborts compilation. Please raise the reflex-base minimum to a release containing this new attribute.
Knowledge Base Used: Component package ecosystem
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 56e8530465
βΉοΈ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| Returns: | ||
| The badge destination URL. | ||
| """ | ||
| referrer = environment.REFLEX_REFERRER_PARAM.get() |
There was a problem hiding this comment.
Require the reflex-base version that defines this variable
When reflex-components-core is installed with its declared minimum reflex-base >= 0.9.7, that released base package does not define REFLEX_REFERRER_PARAM, so compiling a production app with the default sticky badge raises AttributeError here. Raise the dependency floor to the base release containing this field (using the repository's development-pin flow until that release is published) so independently installed core packages remain usable.
AGENTS.md reference: AGENTS.md:L22-L23
Useful? React with πΒ / π.
| @@ -0,0 +1,39 @@ | |||
| """Tests for the "Built with Reflex" sticky badge.""" | |||
There was a problem hiding this comment.
Move the test into the subpackage source mirror
This test covers packages/reflex-components-core/src/reflex_components_core/core/sticky.py, but it was added under tests/units/components/core/; move it to tests/units/reflex_components_core/core/test_sticky.py so the test layout mirrors the subpackage path as required and future module-scoped test selection finds it in the expected location.
AGENTS.md reference: AGENTS.md:L55-L58
Useful? React with πΒ / π.
Closes ENG-11714. Unblocks ENG-11623 (referral bonus).
What
The badge always links to
reflex.devβ the destination is not freely settable. When theREFLEX_REFERRER_PARAMenvironment variable is set at compile time, its value is appended urlencoded:Without the env var the badge link is unchanged (
https://reflex.dev), so existing apps are unaffected.Why this shape
Per discussion with @masenf: land it in the framework where the sticky badge is defined, keep the link pinned to reflex.dev, append only the param (if present), and urlencode it so special characters are not misinterpreted. The hosting service injects the per-owner referral identifier at build time via the env var β no user code changes.
Testing
Unit tests cover the default link, the appended param, urlencoding of special characters, and the empty-value fallback.