Skip to content

uplift: add Vue train-selector widget for uplift target selection (bug 2044143)#1255

Open
cgsheeh wants to merge 17 commits into
mozilla-conduit:bug-2047613-vue-bootstrapfrom
cgsheeh:bug-2044143-uplift-widget
Open

uplift: add Vue train-selector widget for uplift target selection (bug 2044143)#1255
cgsheeh wants to merge 17 commits into
mozilla-conduit:bug-2047613-vue-bootstrapfrom
cgsheeh:bug-2044143-uplift-widget

Conversation

@cgsheeh

@cgsheeh cgsheeh commented Jun 15, 2026

Copy link
Copy Markdown
Member

Add a train-selector widget that progressively enhances the Django-rendered
"Uplift repositories" checkboxes in the uplift request modal. The native
checkboxes remain the source of truth for the form submission, so the backend
is unchanged -- the widget only reads and toggles them, and falls back to the
plain checkboxes if it cannot load.

When the "Request Uplift" button is first clicked, the widget fetches
release-train guidance from the whattrainisitnow.com API (see bug 2045812) and
validates the response with a Zod schema. That response describes the current
state of the release cycle (which version is on each train, whether betas
remain, whether the release candidate has shipped); the held response drives
every recommendation, landing description, and warning the widget produces.

The page CSP's connect-src is widened to the API origin, which a csp_origin
helper derives from the configured URL.

The widget presents two tabs:

  • "Select Firefox Version": choosing a target version resolves -- based on the
    current cycle state -- to the correct uplift train(s) (beta, release, or
    both), ticks the matching repositories, and shows a single line describing
    where the patch will land.
  • "Select Uplift Train": manual repository selection with per-train landing
    hints that reflect the cycle state, including a warning when beta is selected
    after betas have closed.

The tabs are keyboard- and screen-reader-accessible.

Builds on the Vue/TypeScript frontend bootstrap (bug 2047613).

@cgsheeh cgsheeh requested a review from a team as a code owner June 15, 2026 18:38
@github-actions

Copy link
Copy Markdown

View this pull request in Lando to land it once approved.

@cgsheeh cgsheeh changed the title bug 2044143 uplift widget uplift: add Vue train-selector widget for uplift target selection (bug 2044143) Jun 15, 2026
@cgsheeh cgsheeh changed the base branch from main to bug-2047613-vue-bootstrap June 15, 2026 18:41
@cgsheeh

cgsheeh commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

Screenshots:

Screenshot 2026-06-12 at 11-39-45 D3997- Lando - Mozilla Screenshot 2026-06-12 at 11-41-23 D3997- Lando - Mozilla Screenshot 2026-06-12 at 11-41-43 D3997- Lando - Mozilla Screenshot 2026-06-12 at 11-42-43 D3997- Lando - Mozilla

API could not retrieve data from whattrainisitnow.com:

Screenshot 2026-06-12 at 11-46-41 D3997- Lando - Mozilla

@cgsheeh

cgsheeh commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

Note: the PR has test failures due to being formatted with the changes from #1251. I figured using that formatting would make this easier to review and reduce churn once we merge that PR.

@shtrom shtrom left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM (though I'm a bit over my head about Vue 😅).

Blocking for discussion point, but barring those, I have no issue.

Comment thread frontend/src/trainGuidance.ts Outdated
Comment thread frontend/src/trainGuidance.ts
Comment thread frontend/src/trainGuidance.ts Outdated
Comment thread frontend/src/trainGuidance.ts

@zzzeid zzzeid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

First pass, did not review the tests thoroughly but can do that on the second pass.

Comment on lines +163 to +168
<p v-if="status === 'loading'" class="help is-info">
Loading release schedule…
</p>
<p v-else-if="status === 'error'" class="help is-warning">
Could not load release-train guidance. Select repositories manually below.
</p>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This would be better as a single <p> element with the class and content set based on the response result. We could probably simplify this even further by interpreting the response directly, but this would be a step towards that:

<p v-if="loadingMessage" class="help" :class="{'is-info': isLoading, 'is-warning': isErrored>
    {{ loadingMessage }}
</p>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment is not addressed. I think it would be nice for us to start using a template-centric approach here, so that we shape the payloads (where we can) to simplify the templates, rather than the other way around. This will make it easier to modularize the templates/components.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added a statusMessage which is a computed() that returns a string for display in a single <p>, or nothing if the widget should be rendered.

Comment thread frontend/src/components/TrainSelector.vue
Comment thread frontend/src/components/TrainSelector.vue
Comment thread frontend/src/components/TrainSelector.vue
Comment thread frontend/src/components/TrainSelector.vue
Comment thread frontend/src/trainGuidance.ts
Comment thread frontend/src/trainGuidance.ts
Comment thread src/lando/middleware.py Outdated
Comment thread src/lando/middleware.py Outdated
Comment thread src/lando/middleware.py Outdated
cgsheeh added 8 commits June 16, 2026 12:41
…g 2044143)

Add a train-selector widget that progressively enhances the Django-rendered
"Uplift repositories" checkboxes in the uplift request modal. The native
checkboxes remain the source of truth for the form submission, so the backend
is unchanged -- the widget only reads and toggles them, and falls back to the
plain checkboxes if it cannot load.

When the "Request Uplift" button is first clicked, the widget fetches
release-train guidance from the whattrainisitnow.com API (see bug 2045812) and
validates the response with a Zod schema. That response describes the current
state of the release cycle (which version is on each train, whether betas
remain, whether the release candidate has shipped); the held response drives
every recommendation, landing description, and warning the widget produces.

The page CSP's `connect-src` is widened to the API origin, which a `csp_origin`
helper derives from the configured URL.

The widget presents two tabs:

- "Select Firefox Version": choosing a target version resolves -- based on the
  current cycle state -- to the correct uplift train(s) (beta, release, or
  both), ticks the matching repositories, and shows a single line describing
  where the patch will land.
- "Select Uplift Train": manual repository selection with per-train landing
  hints that reflect the cycle state, including a warning when beta is selected
  after betas have closed.

The tabs are keyboard- and screen-reader-accessible.

Builds on the Vue/TypeScript frontend bootstrap (bug 2047613).
@cgsheeh cgsheeh force-pushed the bug-2044143-uplift-widget branch from 7397e7b to 8fc272a Compare June 17, 2026 01:28
@cgsheeh cgsheeh requested review from shtrom and zzzeid June 17, 2026 01:28
cgsheeh added 3 commits June 17, 2026 23:46
Adds `UpliftSubmission.target_selection_method`, a hidden form field the Vue widget populates, and threads it through the submission view. Defaults to `server_rendered` when the widget never mounts.
The widget writes `widget_version`, `widget_manual`, or `server_rendered` into the hidden field so submissions can be attributed to it.

@shtrom shtrom left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@zzzeid zzzeid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Meant to add this to a comment as well, but if we add a proxy API endpoint in Lando we can avoid having to modify CSP settings.

@cgsheeh

cgsheeh commented Jun 18, 2026

Copy link
Copy Markdown
Member Author

I added tracking on the UpliftSubmission model so we can see how often the widget is used once we roll this out. Just wanted to call that out as an extra addition on this iteration.

@cgsheeh cgsheeh requested a review from zzzeid June 18, 2026 23:13

@shtrom shtrom left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm!

"repositories": [repo.name],
"target_selection_method": "widget_version",
}
form_data |= CREATE_FORM_DATA

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

TIL sugar for .update

@zzzeid zzzeid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This branch needs to be updated as it's no longer showing only the changes in this branch (merging/rebasing should work). Currently it's showing changes already in main.

@cgsheeh cgsheeh requested a review from zzzeid June 19, 2026 13:55
@cgsheeh

cgsheeh commented Jun 19, 2026

Copy link
Copy Markdown
Member Author

This branch needs to be updated as it's no longer showing only the changes in this branch (merging/rebasing should work). Currently it's showing changes already in main.

@zzzeid this is fixed.

@zzzeid

zzzeid commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Meant to add this to a comment as well, but if we add a proxy API endpoint in Lando we can avoid having to modify CSP settings.

@cgsheeh @shtrom any thoughts about this? This will give us more control over the API response shape, error handling, and would simplify the implementation / streamline all client calls to be via Lando instead of third party sites.

Can be done in a follow up, but I think this would be good to consider.

@cgsheeh

cgsheeh commented Jun 19, 2026

Copy link
Copy Markdown
Member Author

Meant to add this to a comment as well, but if we add a proxy API endpoint in Lando we can avoid having to modify CSP settings.

@cgsheeh @shtrom any thoughts about this? This will give us more control over the API response shape, error handling, and would simplify the implementation / streamline all client calls to be via Lando instead of third party sites.

Can be done in a follow up, but I think this would be good to consider.

I think it depends on which external sites we'll be contacting. For something like whattrainisitnow.com, we can either ping SRE or RelMan for support, so I'm not worried about having to simplify or change the API response shape. Github/Phab have API key and rate limiting considerations, so keeping those going through the Lando backend makes sense to me.

Seems like a reasonable idea but we should approach it on a case-by-case basis as the need arises. 👍

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.

3 participants