Skip to content

feat: adding mobile/desktop pagespeed strategy#3470

Open
akashmannil wants to merge 5 commits intodevelopfrom
feat/pagespeed-mobile-strat
Open

feat: adding mobile/desktop pagespeed strategy#3470
akashmannil wants to merge 5 commits intodevelopfrom
feat/pagespeed-mobile-strat

Conversation

@akashmannil
Copy link
Copy Markdown
Collaborator

Adding Pagespeed desktop/mobile strategy.

Fixes #3453

image image image

Please ensure all items are checked off before requesting a review. "Checked off" means you need to add an "x" character between brackets so they turn into checkmarks.

  • (Do not skip this or your PR will be closed) I deployed the application locally.
  • (Do not skip this or your PR will be closed) I have performed a self-review and testing of my code.
  • I have included the issue # in the PR.
  • I have added i18n support to visible strings (instead of <div>Add</div>, use):
const { t } = useTranslation();
<div>{t('add')}</div>
  • I have not included any files that are not related to my pull request, including package-lock and package-json if dependencies have not changed
  • I didn't use any hardcoded values (otherwise it will not scale, and will make it difficult to maintain consistency across the application).
  • I made sure font sizes, color choices etc are all referenced from the theme. I don't have any hardcoded dimensions.
  • My PR is granular and targeted to one specific feature.
  • I ran npm run format in server and client directories, which automatically formats your code.
  • I took a screenshot or a video and attached to this PR if there is a UI change.

@dmythro
Copy link
Copy Markdown

dmythro commented Apr 8, 2026

Thanks for jumping on this so fast!

Couple things Claude spotted and I want to mention, might make sense:

  1. Strategy is immutable after creation — disabled={isEditMode} on the Select. If you want to switch a
    monitor from desktop to mobile, you must delete and recreate it. The server-side editMonitorBodyValidation
    does allow strategy though, so the API permits changes but the UI blocks it. This inconsistency could cause
    confusion.
  2. strategy column added to ALL monitors, not just pagespeed. Every http, ping, docker, etc. monitor gets
    strategy = 'desktop'.

I think editing should be allowed - so I can just switch existing monitors to mobile without re-adding new ones and without paused old monitors for historical data. And strategy should be empty by default, only set for pagespeed.

@akashmannil
Copy link
Copy Markdown
Collaborator Author

Thanks for the review @dmythro. PFB thought process for each of the mentioned pointers.

  1. Once we change the strategy, our history gets invalidated (our previous data points to Desktop, but later changed to mobile gives different stats - faulty assurances). Thats why we're making it immutable.
  2. Since http pagespeed monitor is the only option with reliable pagespeed accessibility metrics (which is expected to be varying based on device pref) with proper strategy dependencies, we're adding only an option for that.

Copy link
Copy Markdown
Collaborator

@ajhollid ajhollid left a comment

Choose a reason for hiding this comment

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

Some minor issues to resolve, but it generally looks good.

Allowing editing of the strategy type is a design decision; we can defer to @gorkem-bwl on that one.

My personal opinion is to agree with you that it should be immutable once set, as the historical data will be nonsensical if you switch strategies.

The precedent has been set for allowing these types of history-breaking changes, though, so I'll leave this one to @gorkem-bwl to make the call.

Comment thread client/src/Components/design-elements/StrategyBadge.tsx Outdated
Comment thread server/src/repositories/monitors/TimescaleMonitorsRepository.ts Outdated
Comment thread server/src/db/migration/timescaledb/0022_add_strategy_to_monitors.ts Outdated
Comment thread server/src/db/models/Monitor.ts Outdated
Comment thread client/src/Components/design-elements/StrategyBadge.tsx Outdated
@gorkem-bwl
Copy link
Copy Markdown
Contributor

Some minor issues to resolve, but it generally looks good.

Allowing editing of the strategy type is a design decision; we can defer to @gorkem-bwl on that one.

My personal opinion is to agree with you that it should be immutable once set, as the historical data will be nonsensical if you switch strategies.

The precedent has been set for allowing these types of history-breaking changes, though, so I'll leave this one to @gorkem-bwl to make the call.

My take here is that user knows what he's doing, so we could agreeable for the user to edit that section.

@dmythro
Copy link
Copy Markdown

dmythro commented Apr 8, 2026

As a user I'd prefer to edit this. At least I hope you won't block editing strategy via API.

I have many monitors and creating new for each and pause old ones is much more hassle than just switch to mobile and know that older data was desktop is fine with me.

Copy link
Copy Markdown
Collaborator

@ajhollid ajhollid left a comment

Choose a reason for hiding this comment

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

Looks pretty good. There's an error in the montor validation that will set strategy to non-pagespeed type monitors that needs to be fixed, I think we're done after that.

Comment thread server/src/validation/monitorValidation.ts Outdated
@akashmannil
Copy link
Copy Markdown
Collaborator Author

@ajhollid Default values removed and set only for pagespeed monitors. Please do let me know if this looks ok. Thanks!

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.

PageSpeed: add mobile/desktop strategy option

4 participants