Skip to content

Spotlight: filter by guestsOnly (guest-only audience)#3238

Merged
feruzm merged 1 commit into
developmentfrom
feature/spotlight-guests-only
Jun 5, 2026
Merged

Spotlight: filter by guestsOnly (guest-only audience)#3238
feruzm merged 1 commit into
developmentfrom
feature/spotlight-guests-only

Conversation

@feruzm
Copy link
Copy Markdown
Member

@feruzm feruzm commented Jun 5, 2026

Brings the mobile spotlight card in line with the new audience model (vision-next #917, vapi #30).

  • Filter changes from s.auth === false ? true : !!username to s.guestsOnly ? !username : !!username - logged-in users by default, guestsOnly cards only to signed-out visitors.
  • Bumps @ecency/sdk to ^2.3.11, which replaced the boolean auth with guestsOnly on the Spotlight type.

With the vapi guest funnel, signed-out users on the mobile feed see the signup hooks (and dismissing one reveals the next), while logged-in users only ever see the educational rotation. tsc + eslint clean.

Summary by CodeRabbit

Bug Fixes

  • Enhanced feature spotlight visibility logic to ensure spotlights are correctly displayed based on user authentication status. Guest-only spotlights now appear to unauthenticated users, while other spotlights are shown to logged-in users.

Match the new client model from vision-next #917: the card filters s.guestsOnly ? !username : !!username (logged-in by default; guestsOnly shows to signed-out visitors only). Bumps @ecency/sdk to ^2.3.11, which replaced the boolean auth with guestsOnly. Paired with the vapi guest funnel, signed-out users see the signup hooks and logged-in users never do.
@feruzm feruzm merged commit dfd6891 into development Jun 5, 2026
7 of 8 checks passed
@feruzm feruzm deleted the feature/spotlight-guests-only branch June 5, 2026 18:10
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Jun 5, 2026

Greptile Summary

This PR updates the spotlight card audience filter from the deprecated auth field to the new guestsOnly field introduced in @ecency/sdk 2.3.11, and bumps the SDK accordingly. The semantic shift means the two audiences are now mutually exclusive: guestsOnly: true cards reach only signed-out visitors, while all other cards reach only logged-in users.

  • Filter logic change: replaces s.auth === false ? true : !!username with s.guestsOnly ? !username : !!username, removing the "show to everyone" path that existed under auth === false.
  • SDK bump: @ecency/sdk ^2.3.10^2.3.11, which replaces the auth: boolean field with guestsOnly: boolean on the Spotlight type.

Confidence Score: 5/5

Safe to merge — the change is a small, focused filter swap aligned with the new SDK type and the described backend model.

The one-line filter change is correct for the new exclusive guest/logged-in audience model. The dismissal key derivation (id_guest vs id_username) is consistent before and after the change. The SDK bump is pinned to a specific patch release with a matching lockfile entry. The only open question is whether any existing backend spotlight records relied on the old show-to-everyone path, but that is a data/deployment concern outside this diff.

No files require special attention. The core logic change is a single line in featureSpotlightCard.tsx.

Important Files Changed

Filename Overview
src/components/featureSpotlightCard/container/featureSpotlightCard.tsx Core change: replaces the deprecated auth-field filter with the new guestsOnly-field filter, making guest and logged-in audiences mutually exclusive. Logic is correct; dismissal key derivation is consistent with the new filter.
package.json Bumps @ecency/sdk from ^2.3.10 to ^2.3.11 to pick up the guestsOnly field type replacing auth.
yarn.lock Lockfile updated to resolve @ecency/sdk at 2.3.11 with a new integrity hash; no other dependency changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[spotlightsQuery.data] --> B[Filter: platform includes 'mobile']
    B --> C{s.guestsOnly?}
    C -- true --> D{username defined?}
    C -- false/undefined --> E{username defined?}
    D -- yes logged-in --> F[Exclude]
    D -- no guest --> G[Include]
    E -- yes logged-in --> H[Include]
    E -- no guest --> I[Exclude]
    G --> J[Filter: not dismissed key = id_guest]
    H --> K[Filter: not dismissed key = id_username]
    J --> L[Pick highest weight / earliest start]
    K --> L
    L --> M[Render FeatureSpotlightCard]
Loading

Fix All in Claude Code

Reviews (1): Last reviewed commit: "Spotlight: filter by guestsOnly (guest-o..." | Re-trigger Greptile

const candidates = (spotlightsQuery.data ?? [])
.filter((s) => !s.platforms || s.platforms.includes('mobile'))
.filter((s) => (s.auth === false ? true : !!username))
.filter((s) => (s.guestsOnly ? !username : !!username))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 No "show to everyone" path in new model

The old filter had a third state: auth === false produced true, meaning a card was visible to both guests and logged-in users. The new filter is strictly exclusive — guestsOnly routes to either guests or logged-in users, never both. If the backend (vapi) never needs to broadcast a card to all audiences this is fine, but it's worth confirming that no existing spotlight records relied on that "universal" state during the data migration.

Fix in Claude Code

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 96d24f39-90de-46c9-a3bd-a8e1bf9ef3c9

📥 Commits

Reviewing files that changed from the base of the PR and between 7a2c93a and 1ddfdf2.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (2)
  • package.json
  • src/components/featureSpotlightCard/container/featureSpotlightCard.tsx

📝 Walkthrough

Walkthrough

This PR updates the feature spotlight card filtering logic and bumps the SDK dependency. The spotlight selection now uses an explicit guestsOnly field to determine whether spotlights display to signed-out or logged-in users, replacing the previous s.auth === false check. The SDK is updated to a minor version that likely provides this new field or supporting functionality.

Changes

Spotlight Filtering and SDK Dependency

Layer / File(s) Summary
SDK dependency update
package.json
@ecency/sdk dependency version bumped from ^2.3.10 to ^2.3.11.
Spotlight filtering refactor
src/components/featureSpotlightCard/container/featureSpotlightCard.tsx
Spotlight candidate selection logic updated: guest-visibility filtering now uses s.guestsOnly to match login state, so guests-only spotlights appear only to signed-out visitors and logged-in users see non-guests-only spotlights.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • ecency/ecency-mobile#3231: Also modifies FeatureSpotlightCard's spotlight candidate-selection logic; this PR refines the guestsOnly/logged-in filtering as a continuation of that work.
  • ecency/ecency-mobile#3223: Also updates the @ecency/sdk dependency in package.json.

Poem

🐰 A spotty update, clean and bright,
Guests see their own, users their light,
SDK bumps to bring new power,
Filtering facts, hour by hour!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/spotlight-guests-only

Warning

Tools execution failed with the following error:

Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ddfdf2cb5

ℹ️ 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".

const candidates = (spotlightsQuery.data ?? [])
.filter((s) => !s.platforms || s.platforms.includes('mobile'))
.filter((s) => (s.auth === false ? true : !!username))
.filter((s) => (s.guestsOnly ? !username : !!username))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve auth:false for guest-visible spotlights

When the endpoint returns a spotlight in the existing auth: false format without guestsOnly, signed-out users now fail this predicate because guestsOnly is undefined and the code falls through to !!username. The previous behavior explicitly allowed those records to show to guests, so any guest-facing spotlight that has not been migrated to guestsOnly disappears from the anonymous feed; keep auth === false as a fallback while honoring guestsOnly for guest-only records.

Useful? React with 👍 / 👎.

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