Repository navigation
Description
Feature Description
The hub's "What's new?" tab, and the new-feature indicators that point at it, need a definition of what counts as "new" to a given user.
The product intent is that a regularly active, up-to-date user sees the features launched in the current or previous Site Kit release — Site Kit ships roughly every two weeks, so about a four-week window — while a user who wasn't active when a feature launched still gets to see it, and a brand new user isn't greeted by years of history flagged as new.
Three per-user rules deliver that: a floor relative to the version the user installed, a hold until the user is first shown a feature, and a 28-day lapse thereafter. All of the state behind them reuses Site Kit's existing dismissed-items and expirable-items APIs, so nothing new is stored server-side, and membership of "What's new?" and the new-feature count are derived rather than persisted.
This issue implements those rules, the selectors that derive from them, and the action that marks features as seen. The surfaces that consume them — the tab itself (#13321), the dashboard header pill (#13358) and the wp-admin menu badge (#13359) — are handled by their own issues.
For reference, see the Newness & per-user state section in the design doc.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- Whether a feature is new is evaluated per user, by three rules:
- Floor — a feature can only ever count as new if the version it was added in is at or after the release immediately preceding the Site Kit version at the user's first authentication. Anything older is part of that user's baseline and is never new to them, however recently they arrived.
- Hold — an eligible feature is not on a clock until the user is first shown it: its 28-day timer is seeded the first time the feature appears in that user's "What's new?" list. A feature released while the user was away therefore still counts as new, and unread, on their next visit — regardless of how long ago it was released.
- Lapse — 28 days after its timer is seeded, a feature stops counting as new.
- The following selectors are added:
isFeatureNew( slug )— whether the feature passes the floor and its 28-day timer has not expired. A feature whose timer has never been seeded is new.isFeatureUnread( slug )— whether the feature is new and its timer has never been seeded.getWhatsNewFeatures()— the features to list on "What's new?": new, not dismissed, not already set up, and with their prerequisite modules connected. Ordered with unread features before read ones; within each of those, by the version the feature was added in, newest first; and features sharing a version keeping their catalog registration order.getNewFeatureCount()— the single count behind every new-feature indicator: how manygetWhatsNewFeatures()entries are still unread.
- A
markFeaturesSeen( slugs )action seeds the 28-day timer for each of the given features, in a single request. - Seeding a feature's timer both marks it read and starts its lapse. There is no separate read state, so a feature is unread until it has first been listed, read but still listed while its timer is active, and lapsed once the timer expires.
- A feature whose prerequisite modules are not all connected is not listed by
getWhatsNewFeatures()and is not counted bygetNewFeatureCount(). It is held in the same way as a feature the user hasn't visited yet: its timer cannot be seeded, so it is still new once its prerequisites are connected. - Dismissing a feature removes it from
getWhatsNewFeatures()permanently, and setting a feature up removes it fromgetWhatsNewFeatures()too. A lapsed, dismissed or set-up feature is still a registered catalog entry — only its newness is affected. - All per-user state reuses the existing dismissed-items and expirable-items APIs: the permanent dismissal key
feature-discovery-dismissed-{slug}and the 28-day timerfeature-discovery-new-{slug}. No new REST endpoints, options, or user settings are added.
Implementation Brief
-
Add
assets/js/googlesitekit/datastore/feature-discovery/utils.ts:- Key builders for the dismissal key
feature-discovery-dismissed-{slug}and the timer keyfeature-discovery-new-{slug}.
- Key builders for the dismissal key
-
In
assets/js/googlesitekit/datastore/feature-discovery/newness.ts(new file, combined into the store inindex.ts):- Add
markFeaturesSeen( slugs ), which seeds the timers in a singleCORE_USER.setExpirableItemTimers()call, passing one{ slug, expiresInSeconds }entry per feature, whereslugis the feature's timer key rather than the feature slug andexpiresInSecondsisWEEK_IN_SECONDS * 4from@/js/util. - Add
isFeatureNew( slug ): the feature passes the floor and its timer has not lapsed. For the timer half, followWidgetNewBadge:hasExpirableItem( key ) === false || isExpirableItemActive( key ), so a feature with no timer yet counts as new. - For the floor, compare the feature's
addedInVersionagainst the release precedingCORE_USER.getInitialSiteKitVersion(), usingcompareVersionsasdatastore/user/feature-tours.jsdoes. Derive the preceding release by decrementing the minor, e.g.1.160.0gives a floor of1.159.0. Returnfalsewhen there is no initial version, as feature tours do. - Add
isFeatureUnread( slug ):isFeatureNew( slug )andhasExpirableItem( key ) === false. - Add
getWhatsNewFeatures(): start fromgetAvailableFeatures()(Add thecore/feature-discoverydatastore — registration & core selectors #13245), which already covers set-up, prerequisite andcheckRequirementsstate, then keep the entries that areisFeatureNewand notisItemDismissed( dismissal key ). Sort unread entries before read ones, then byaddedInVersiondescending, comparing withcompareVersionsrather than as strings so that e.g.1.100.0sorts above1.99.0;getAvailableFeatures()is in registration order andsortis stable, so features sharing a version keep it. - Add
getNewFeatureCount(): how manygetWhatsNewFeatures()entries areisFeatureUnread. - Return
undefinedfrom these selectors whilegetExpirableItems(),getDismissedItems()or the initial version are unresolved, so consumers can tell loading from empty.
- Add
Test Coverage
- Add
newness.test.tscovering the three rules: a feature added before the preceding release is never new, one at or after it is; a feature with no timer is new and unread; a feature with an expired timer is neither. - Cover
getWhatsNewFeatures()membership, including features that are dismissed, already set up, or have unconnected prerequisites, and its ordering across unread state, version and registration order. - Cover
getNewFeatureCount()counting only unread entries, andmarkFeaturesSeen()seeding several slugs in one request and leaving those features listed but read.
QA Brief
- In
assets/js/googlesitekit-datastore-site.ts, register the feature discovery store using:
import { registerStore } from './googlesitekit/datastore/site';
registerFeatureDiscoveryStore( Data );-
Set up Site Kit and open any Site Kit admin page. In the browser console, confirm the store is available:
const { dispatch, select } = googlesitekit.data; const FD = "core/feature-discovery"; !!select(FD); // true
-
Register test features and provide a known initial version and user state.
oldis below the1.159.0floor; the other features are eligible:const base = { title: "Test feature", shortDescription: "Test description.", effort: 1, goalCategories: ["audience"], setup: { type: "background-toggle", isEnabled: () => false }, }; dispatch("core/user").receiveInitialSiteKitVersion("1.160.0"); dispatch("core/user").receiveGetDismissedItems([]); dispatch("core/user").receiveGetExpirableItems({}); dispatch(FD).registerFeature("old", { ...base, addedInVersion: "1.158.0" }); dispatch(FD).registerFeature("unread", { ...base, addedInVersion: "1.159.0", }); dispatch(FD).registerFeature("newer", { ...base, addedInVersion: "1.161.0" });
-
Confirm the floor, hold, and unread rules.
oldis never new; both eligible features are new and unread because neither has a timer:select(FD).isFeatureNew("old"); // false select(FD).isFeatureNew("unread"); // true select(FD).isFeatureUnread("unread"); // true select(FD) .getWhatsNewFeatures() .map(({ slug }) => slug); // [ 'newer', 'unread' ] select(FD).getNewFeatureCount(); // 2
-
Run
await dispatch( FD ).markFeaturesSeen( [ 'unread', 'newer' ] )and confirm the browser Network panel shows oneset-expirable-item-timersrequest containing bothfeature-discovery-new-*keys with a 28-day expiration. In the same page session, confirm both features remain ingetWhatsNewFeatures()butisFeatureUnread()andgetNewFeatureCount()reportfalseand0respectively. -
In the console, expire one feature and confirm it lapses:
dispatch("core/user").receiveGetExpirableItems({ "feature-discovery-new-unread": Math.floor(Date.now() / 1000) - 1, "feature-discovery-new-newer": Math.floor(Date.now() / 1000) + 60, }); select(FD).isFeatureNew("unread"); // false select(FD) .getWhatsNewFeatures() .map(({ slug }) => slug); // [ 'newer' ]
-
Confirm dismissing, setup, and unmet prerequisites remove catalog entries from the list and unread count while keeping them registered. Register features using
prerequisiteModules: [ 'analytics-4' ]while Analytics is disconnected, andisEnabled: () => truefor an already set-up feature; addfeature-discovery-dismissed-{slug}toreceiveGetDismissedItems(). Verify none appear ingetWhatsNewFeatures(), but each remains returned bygetFeature( slug ).
Changelog entry
- Add the feature discovery newness model and selectors for determining which features are new to a user.
Activity
techanvil commentedon Aug 10, 2026
Hey @hussain-t, just a heads up that I've tweaked the definition for
getNewFeatureCount()in the AC, in response to review feedback in the design doc.techanvil commentedon Aug 21, 2026
Thanks @hussain-t, this IB is looking good.
A small point - key builders for the dismissal and timer keys should go in a
utils.tsfile rather thanconstants.ts.hussain-t commentedon Aug 21, 2026
Thanks, @techanvil! I've updated the IB.
2 remaining items
techanvil commentedon Aug 24, 2026
Thanks @hussain-t! That LGTM.
IB ✅
kelvinballoo commentedon Sep 9, 2026
QA Update⚠️
Hi @ankitrox , this is mostly tested good.
Used the scripts provided but I just wanted to report that I did have an additional 'new' features returned: email-reports.
I believe this is likely due to the actual release we had recently and there is nothing to be fixed here.
Can you confirm please before I move this to approval?
Details
Other than that, tested this and results are as expected.
The branch is returned true.
Details
The new features are returned as expected but with one additional one: email-reports which is likely due to the actual release we had recently.
Details
markFeaturesSeen tested good.
Details
13246.-.03.markfeaturesseen-.expirable.ok.mov
Expired one feature and confirmed it lapsed
Details
Confirm dismissing, setup, and unmet prerequisites remove catalog entries from the list. Note that I reloaded the screen for this and that's why some old entries are still there.
Details
ankitrox commentedon Sep 11, 2026
@kelvinballoo You are right about what you discovered about the email reports and we are good to go there. If that's the only case and other things are looking good, we can move this to approval. 👍🏼
kelvinballoo commentedon Sep 11, 2026
QA Update ✅
Thanks for confirming @ankitrox
Other parts were verified good. Moving to approval.
The branch is returned true.
Details
The new features are returned as expected but with one additional one: email-reports which is likely due to the actual release we had recently.
Details
markFeaturesSeen tested good.
Details
13246.-.03.markfeaturesseen-.expirable.ok.mov
Expired one feature and confirmed it lapsed
Details
Confirm dismissing, setup, and unmet prerequisites remove catalog entries from the list. Note that I reloaded the screen for this and that's why some old entries are still there.
Details