Skip to content

Clear timezone and locale for unsupported image types (HMS-10456)#4482

Open
kingsleyzissou wants to merge 1 commit into
osbuild:mainfrom
kingsleyzissou:remove-default-timezone
Open

Clear timezone and locale for unsupported image types (HMS-10456)#4482
kingsleyzissou wants to merge 1 commit into
osbuild:mainfrom
kingsleyzissou:remove-default-timezone

Conversation

@kingsleyzissou
Copy link
Copy Markdown
Collaborator

@kingsleyzissou kingsleyzissou commented May 29, 2026

Summary

Use the existing restrictions system to clear wizard state for timezone
and locale when the selected image type doesn't support them (e.g.,
network-installer), preventing stale customization data from leaking
into blueprint requests.

Changes

  • Add clearTimezone and clearLocale reducers to atomically reset related state (timezone + NTP servers, languages + keyboard)
  • Add useEffect hooks in both wizard versions to dispatch clearing actions when restrictions.*.shouldHide is true, with guards to skip edit mode and avoid redundant dispatches
  • Add timezone.shouldHide assertion for network-installer in the restrictions hook tests
  • Add integration tests for network-installer: checkbox mutual exclusion, wizard step reduction, and blueprint request verification with empty customizations
  • Add unit tests for the new reducers covering reset and no-op cases

@kingsleyzissou
Copy link
Copy Markdown
Collaborator Author

#4311 got closed, I cherry-picked the changes from that and made some changes

@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.20%. Comparing base (b5a74d4) to head (91a3e6a).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...Components/CreateImageWizard/CreateImageWizard.tsx 77.77% 2 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4482      +/-   ##
==========================================
+ Coverage   76.05%   76.20%   +0.15%     
==========================================
  Files         225      225              
  Lines        7196     7204       +8     
  Branches     2662     2663       +1     
==========================================
+ Hits         5473     5490      +17     
+ Misses       1482     1473       -9     
  Partials      241      241              
Files with missing lines Coverage Δ
...Components/CreateImageWizard/CreateImageWizard.tsx 85.89% <77.77%> (+0.05%) ⬆️

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b5a74d4...91a3e6a. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread src/Components/CreateImageWizard3/CreateImageWizard3.tsx Outdated
Comment thread src/store/api/distributions/constants.ts Outdated
@kingsleyzissou kingsleyzissou force-pushed the remove-default-timezone branch from 81e2337 to a82fe4e Compare May 29, 2026 13:51
@kingsleyzissou kingsleyzissou changed the title Clear timezone and locale for unsupported image types Clear timezone and locale for unsupported image types (HMS-10456) May 29, 2026
@kingsleyzissou kingsleyzissou marked this pull request as ready for review May 29, 2026 13:54
@kingsleyzissou kingsleyzissou requested a review from a team as a code owner May 29, 2026 13:54
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The implementation still lists locale under network-installer supported_blueprint_options (and updates tests accordingly), which conflicts with the PR summary that says locale should be removed for this image type—please reconcile the intended behavior vs. the current constants/test expectations.
  • In the useEffect that clears timezone when restrictions.timezone.shouldHide is true, the guard if (timezone) only checks the timezone string and could leave ntpservers uncleared if they are set while timezone is already empty; consider basing the condition on both fields or always dispatching clearTimezone when hidden.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The implementation still lists `locale` under `network-installer` supported_blueprint_options (and updates tests accordingly), which conflicts with the PR summary that says `locale` should be removed for this image type—please reconcile the intended behavior vs. the current constants/test expectations.
- In the `useEffect` that clears timezone when `restrictions.timezone.shouldHide` is true, the guard `if (timezone)` only checks the timezone string and could leave `ntpservers` uncleared if they are set while `timezone` is already empty; consider basing the condition on both fields or always dispatching `clearTimezone` when hidden.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@kingsleyzissou kingsleyzissou force-pushed the remove-default-timezone branch 3 times, most recently from 078bc14 to b070333 Compare June 4, 2026 15:32
regexowl
regexowl previously approved these changes Jun 5, 2026
Copy link
Copy Markdown
Collaborator

@regexowl regexowl left a comment

Choose a reason for hiding this comment

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

Looks good! One minor nitpick, but not blocking on that

Comment thread src/Components/CreateImageWizard/CreateImageWizard.tsx Outdated
@regexowl regexowl dismissed their stale review June 5, 2026 07:18

Looking at the test failures, those seem to be relevant.

@kingsleyzissou
Copy link
Copy Markdown
Collaborator Author

Looking at the test failures, those seem to be relevant.

I had a suspicion but I haven't had the chance to look into it properly yet

Network-installer already excluded timezone from its supported
blueprint options, but the wizard wasn't acting on that restriction.
Add clearTimezone and clearLocale reducers and wire them into both
wizard versions so state is reset when restrictions indicate a
customization should be hidden.

Co-authored-by: Gianluca Zuccarelli <gzuccare@redhat.com>
@kingsleyzissou kingsleyzissou force-pushed the remove-default-timezone branch from b070333 to 91a3e6a Compare June 5, 2026 10:22
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