Skip to content

fix(curriculum): handle weather data edge cases - #71484

Merged
majestic-owl448 merged 4 commits into
freeCodeCamp:mainfrom
jerome-queck:fix/weather-data-handling
Nov 3, 2026
Merged

majestic-owl448 merged 4 commits into
freeCodeCamp:mainfrom
jerome-queck:fix/weather-data-handling

Conversation

@jerome-queck

Copy link
Copy Markdown
Contributor

Checklist:

Closes #71479

Both weather labs currently accept a missing-data check even when showWeather rejects asynchronously. Their supplied solutions and expected-value helper also treat valid zero measurements as missing.

This updates both lab copies to:

  • Await missing-data operations and restore temporary replacements in finally. Verify one error alert and preserve the displayed weather, including the actual Paris button interaction.
  • Test all five numeric measurements with both 0 and undefined, and preserve zero in the expected-value helper.
  • Return before destructuring unavailable data in the supplied solution, log failed HTTP responses, and distinguish zero from missing measurements.
  • Clarify these requirements in the user stories. Tests allow alerts in either function and do not prescribe display labels or unrelated element attributes.

Validation:

  • The repository's challenge parser and challenge linter pass for both files; git diff --check passes.
  • A local Node 24.22.1 / jsdom 16.7.0 harness executes the actual parsed hooks, HTML/CSS/JavaScript solution, and hint bodies. All 26 hints pass in each lab for the revised solution and valid alternatives, including nullish defaults, alerts in getWeather, numbered labels, and a captured button handler.
  • The original solutions fail the three relevant updated hints in each lab. Seventeen deliberately incorrect variants per lab are rejected, including rejected promises, missing/duplicate alerts, hidden or changed weather output, a Paris button that does nothing, and each zero/missing measurement mixup.
  • HTTP, network, JSON-parsing, and undefined-data error paths, replacement cleanup, and the empty selection were exercised.

The DOM harness uses an innerText polyfill and is not a browser-suite pass. FCC_BLOCK=lab-weather-app pnpm run test-curriculum-content was blocked before tests started: the available pnpm is 11.25.0, while the repository requires 12. Installing pnpm 12 and Puppeteer's Chrome was blocked by unavailable DNS/network access. The corresponding v2 browser suite, Playwright suite, and full application build were not run locally.

@jerome-queck
jerome-queck requested a review from a team as a code owner October 31, 2026 11:35
@github-actions github-actions Bot added the scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. label Oct 31, 2026
@majestic-owl448 majestic-owl448 added the js v9 cert This is for the JS V9 certification. label Nov 2, 2026
@majestic-owl448 majestic-owl448 added the status: waiting update Is awaiting update, after feedback or request for changes label Nov 2, 2026
A label that contains its own standalone 0 was passing the zero check
even when the measurement was a different number. Both weather labs now
treat the last number as the measurement, so numbered labels still pass
and a trailing non-zero value fails.
@jerome-queck
jerome-queck force-pushed the fix/weather-data-handling branch from 19a4c62 to bb1f7f2 Compare November 2, 2026 13:04
@jerome-queck

Copy link
Copy Markdown
Contributor Author

Thanks for the review! I've applied all three suggestions in bb1f7f2: I removed the extra sentence from both lab descriptions and normalised the case in the test, matching the other tests. Ready for another look.

@majestic-owl448
majestic-owl448 enabled auto-merge (squash) November 3, 2026 09:21

@majestic-owl448 majestic-owl448 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.

Thank you for your contribution to the page! 👍
We are happy to accept these changes and look forward to future contributions. 🎉

@majestic-owl448 majestic-owl448 removed the status: waiting update Is awaiting update, after feedback or request for changes label Nov 3, 2026
@majestic-owl448
majestic-owl448 merged commit 3045eb2 into freeCodeCamp:main Nov 3, 2026
10 checks passed
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

js v9 cert This is for the JS V9 certification. scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Weather app labs mishandle missing data and zero measurements

2 participants