Skip to content

Conversation

@rtibbles
Copy link
Member

@rtibbles rtibbles commented Nov 22, 2025

Summary

Addresses three issues with the H5P library update system:

  1. Fix webpack mode and hashing: Changed mode from 'none' to 'production'. Production mode automatically enables deterministic module/chunk IDs, ensuring builds are reproducible. Also changed HTML filename from [fullhash] to [contenthash] so it only changes when HTML content actually changes, not on every compilation.

  2. Improve GitHub action logic: Added a check for actual build changes before creating a PR. The action now only creates a PR when the built files in kolibri/core/content/static/h5p/ change, not just when the commit SHA file changes. This prevents unnecessary PRs when upstream commits don't affect the bundled JavaScript.

  3. Improve PR title and description: Updated the auto-generated PR to have a clear title and concise, well-formatted description with commit information and upstream comparison links.

References

Should prevent no-op upgrade PRs like #13924

Reviewer guidance

🤖 This was created by Claude Code. @rtibbles then reviewed the generated output, and did iterative rounds of updates before making it ready for review 🤖

The main thing to test here would be to run the H5P build locally and ensure that repeated runs produce deterministic outputs. Alternatively, we can merge and test it live!

Addresses three issues with the H5P library update system:

1. Fix webpack mode and hashing: Changed mode from 'none' to 'production'.
   Production mode automatically enables deterministic module/chunk IDs,
   ensuring builds are reproducible. Also changed HTML filename from
   [fullhash] to [contenthash] so it only changes when HTML content
   actually changes, not on every compilation.

2. Improve GitHub action logic: Added a check for actual build changes
   before creating a PR. The action now only creates a PR when the built
   files in kolibri/core/content/static/h5p/ change, not just when the
   commit SHA file changes. This prevents unnecessary PRs when upstream
   commits don't affect the bundled JavaScript.

3. Improve PR title and description: Updated the auto-generated PR to
   have a clear title and concise, well-formatted description with
   commit information and upstream comparison links.
@github-actions github-actions bot added the DEV: dev-ops Continuous integration & deployment label Nov 22, 2025
@rtibbles
Copy link
Member Author

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 22, 2025

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 22, 2025

Walkthrough

The changes involve a GitHub workflow for H5P library updates and webpack configuration adjustments. The workflow now checks for actual build changes before running dependent steps and updates PR metadata. The webpack config switches to production mode with deterministic identifiers and content-based hash output naming.

Changes

Cohort / File(s) Summary
Workflow conditional logic
.github/workflows/update_h5p.yml
Adds "Check for actual build changes" step to stage and diff build files; updates "Generate App Token" and "Create Pull Request" steps to require both commit and build changes; modifies PR title, commit message, and body metadata to reference H5P JavaScript library instead of generic target repository.
Build optimization configuration
packages/kolibri-sandbox/webpack.config.h5p.js
Changes webpack mode from 'none' to 'production'; adds deterministic identifiers via moduleIds: 'deterministic' and chunkIds: 'deterministic'; updates HtmlWebpackPlugin output filename from h5p-[fullhash].html to h5p-[contenthash].html.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Workflow file: Verify the git diff logic correctly identifies build changes and that conditional step dependencies propagate correctly
  • Webpack config: Confirm production mode and deterministic ID behavior aligns with build caching strategy and output expectations; validate content-hash naming doesn't break downstream references

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: fixing H5P webpack build hashing and improving GitHub action PR logic, which aligns with the changeset modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The PR description clearly explains three specific fixes: webpack mode/hashing changes, GitHub action logic improvements, and PR metadata updates. It directly relates to the changeset in both files.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/fix-webpack-build-issues-01CyCsGn2A1K4j9JogsFTitT

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Member Author

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

This should be good for human review.

yarn workspace kolibri-sandbox run build-h5p
- name: Generate App Token
- name: Check for actual build changes
Copy link
Member Author

Choose a reason for hiding this comment

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

Previously this would make a PR every time the commit changed, regardless of whether the upstream changes actually affected us.

branch: h5p_update
delete-branch: true
title: 'Update from target repository commit'
title: 'Update H5P JavaScript library'
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know what I was thinking with these previous titles and descriptions - these show much better what we're actually doing with this upgrade PR.

path: path.resolve(__dirname, '../../kolibri/core/content/static/h5p'),
},
mode: 'none',
mode: 'production',
Copy link
Member Author

Choose a reason for hiding this comment

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

No idea why way back when I decided to do this - probably because I copied it from the main kolibri-sandbox webpack configuration.

],
},
optimization: {
moduleIds: 'deterministic',
Copy link
Member Author

Choose a reason for hiding this comment

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

'production' above should set this automatically, but doing this for good measure, ensures that the build as a whole is deterministic.

new Plugin(),
new HtmlWebpackPlugin({
filename: 'h5p-[fullhash].html',
filename: 'h5p-[contenthash].html',
Copy link
Member Author

Choose a reason for hiding this comment

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

hashing the content, rather than a full hash, makes sure that the filename is deterministic - this matches the naming we do for the JS and CSS assets also.

@rtibbles rtibbles marked this pull request as ready for review November 26, 2025 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DEV: dev-ops Continuous integration & deployment SIZE: small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants