Skip to content

fix: module page styles, WebP in the image, demo-only tenant pruning - #341

Merged
jakub-przepiora merged 1 commit into
developfrom
fix/demo-prune-webp-module-css
Oct 7, 2026
Merged

jakub-przepiora merged 1 commit into
developfrom
fix/demo-prune-webp-module-css

Conversation

@Svannte

@Svannte Svannte commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

fix: module page styles, WebP in the image, demo-only tenant pruning

Three unrelated fixes found while running OpenMES with a compiled-in
module on the Docker image.

Pages of a compiled-in module had none of their own styles. Pages under
modules//resources/js/Pages are compiled into the bundle when they
are present at build time, but Tailwind takes what to scan from
.gitignore, which lists modules/. An ignored directory is only scanned
when it is named outright; a glob across it is skipped all the same. The
build now writes one @source per module that ships pages
(openmesModuleSources() in @openmes/module) into a generated stylesheet
that app.css imports.

The Docker image built GD without WebP, so re-encoding an uploaded
image/webp failed on an undefined imagewebp(). The suite runs on the CI
runner's PHP, not in the image, so nothing caught it. GD is now
configured with WebP and the build fails if a format the application
accepts is missing.

tenants:prune ran every minute on every installation. It was written
for the public demo; nothing else sets a tenant's expires_at, so it
found nothing, but a tenant given an expiry by hand would have been
deleted with everything cascading from it within a minute. It is now
scheduled only when DEMO_MODE=true and can still be run by hand.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation
  • Other:

Related issue

Closes #

Testing

  • Tested manually in browser
  • php artisan test passes
  • Tested as Operator / Supervisor / Admin role (if UI change)

Checklist

  • I have signed the CLA (or this change is trivial: ≤20 lines, no new logic) — see CLA.md
  • No .env secrets committed
  • Migration added if schema changed
  • $fillable updated if new model columns added
  • No raw SQL with user input (use Eloquent / Query Builder)
  • CSRF protection in place for any new forms
  • composer audit clean

Summary by CodeRabbit

  • Bug Fixes
    • Tailwind now detects styles in compiled-in modules’ page directories.
    • Docker image builds now verify GD support for JPEG, PNG, and WebP.
    • Expired-tenant pruning now runs automatically only in demo mode; it remains available as a manual command.

Three unrelated fixes found while running OpenMES with a compiled-in
  module on the Docker image.

  Pages of a compiled-in module had none of their own styles. Pages under
  modules/<Name>/resources/js/Pages are compiled into the bundle when they
  are present at build time, but Tailwind takes what to scan from
  .gitignore, which lists modules/. An ignored directory is only scanned
  when it is named outright; a glob across it is skipped all the same. The
  build now writes one @source per module that ships pages
  (openmesModuleSources() in @openmes/module) into a generated stylesheet
  that app.css imports.

  The Docker image built GD without WebP, so re-encoding an uploaded
  image/webp failed on an undefined imagewebp(). The suite runs on the CI
  runner's PHP, not in the image, so nothing caught it. GD is now
  configured with WebP and the build fails if a format the application
  accepts is missing.

  tenants:prune ran every minute on every installation. It was written
  for the public demo; nothing else sets a tenant's expires_at, so it
  found nothing, but a tenant given an expiry by hand would have been
  deleted with everything cascading from it within a minute. It is now
  scheduled only when DEMO_MODE=true and can still be run by hand.
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: Mes-Open/OpenMes/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 513f5cbf-0768-46aa-b788-17811c58a640
📥 Commits

Reviewing files that changed from the base of the PR and between a717b4f and 92acbce.

📒 Files selected for processing (11)
  • CHANGELOG.md
  • backend/.gitignore
  • backend/Dockerfile
  • backend/resources/css/app.css
  • backend/resources/js/lib/moduleSources.test.js
  • backend/routes/console.php
  • backend/tests/Feature/PruneExpiredTenantsTest.php
  • backend/vite.config.js
  • packages/module/index.js
  • packages/module/package.json
  • packages/module/styles.js

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

The changes add generated Tailwind source directives for module pages, add Docker build checks for GD image formats, and schedule tenants:prune only in demo mode.

Changes

Tailwind module scanning

Layer / File(s) Summary
Generate and publish module source CSS
packages/module/styles.js, packages/module/index.js, packages/module/package.json
The module package adds a Vite plugin and helper that generate sorted, stylesheet-relative @source directives for modules with frontend pages. The package exports and publishes the new implementation.
Connect module sources to the Tailwind build
backend/vite.config.js, backend/resources/css/app.css, backend/.gitignore, backend/resources/js/lib/moduleSources.test.js, CHANGELOG.md
The backend Vite build registers the plugin and imports its generated stylesheet. Tests cover modules with and without frontend pages and the missing modules directory.

GD image format support

Layer / File(s) Summary
Configure and verify GD formats
backend/Dockerfile, CHANGELOG.md
The Docker image installs WebP development support and enables WebP in GD. A build-time check fails if GD lacks JPEG, PNG, or WebP functions.

Demo-mode tenant pruning

Layer / File(s) Summary
Restrict scheduled pruning to demo mode
backend/routes/console.php, backend/tests/Feature/PruneExpiredTenantsTest.php, CHANGELOG.md
The schedule runs tenants:prune every minute only when demo mode is enabled. A feature test checks the event filter in both modes.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant ViteBuild
  participant openmesModuleSources
  participant GeneratedCSS
  participant TailwindBuild
  ViteBuild->>openmesModuleSources: Generate module source CSS
  openmesModuleSources->>GeneratedCSS: Write @source directives
  TailwindBuild->>GeneratedCSS: Read imported source directives
Loading

Suggested reviewers: jakub-przepiora

Merge Risk: ⚪ Minimal · up to 92acb

No specific issue blocks merging; run the normal build and test checks before release.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 6 files. (5 skipped: 5… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies all three primary changes: module page styles, WebP image support, and demo-only tenant pruning.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 6 files. (5 skipped: 5 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@Svannte

Svannte commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@jakub-przepiora
jakub-przepiora merged commit fd807b0 into develop Oct 7, 2026
2 of 3 checks passed
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.

2 participants