Skip to content

ci: actually run the Zeitwerk check - #423

Merged
dkastl merged 1 commit into
nextfrom
ci/run-the-zeitwerk-check
Jul 29, 2026
Merged

ci: actually run the Zeitwerk check#423
dkastl merged 1 commit into
nextfrom
ci/run-the-zeitwerk-check

Conversation

@dkastl

@dkastl dkastl commented Jul 29, 2026

Copy link
Copy Markdown
Member

The Zeitwerk check step in test-postgis.yml has never run.

It is guarded by:

if grep -q zeitwerk config/application.rb ; then
  bundle exec rake zeitwerk:check
fi

config/application.rb does not mention Zeitwerk in any supported Redmine version. Redmine configures it in config/initializers/zeitwerk.rb, so the grep always fails and the step exits 0 without doing anything.

Evidence: on the most recent run, the "Zeitwerk check" step is green with zero log output — no "Hold on, I am eager loading the application", no "All is good!". A step that reports success without running is worse than no step, because the repository looks covered.

Why it matters

Test and development environments have eager_load = false; production has it true. So a filename/constant mismatch that nothing references at boot passes every test and then kills a production instance at startup with a NameError.

Not hypothetical: redmine_gtt_sync shipped exactly this bug. Its CI was green on Redmine 6.1 and 7.0 while every production image built over almost four weeks failed to boot (uninitialized constant RedmineGttSync::Oauth). Running this task reproduces that failure, so an active gate would have caught it the day it landed.

The change

Drop the guard and run the task unconditionally. It ships with Rails 6+, so every row in this matrix has it; the guard protected against nothing.

Verified against Redmine 7.0.0 / Ruby 4.0.6 with this plugin installed alongside nine others: rake zeitwerk:check reports "All is good!", so this should not turn the matrix red. If a row does fail, that is a real latent bug worth surfacing.

Companion changes apply the same fix to redmine_gtt_fiware (identical dead guard) and add the step to redmine_custom (missing entirely).

The step was guarded by `if grep -q zeitwerk config/application.rb`,
which never matches: Redmine configures Zeitwerk in
config/initializers/zeitwerk.rb, not application.rb. So the step has been
reporting success without ever running the task.

Verified on a recent run: the step passes with zero log output, no
"eager loading" and no "All is good!". The guard is unnecessary anyway,
since the rake task ships with Rails 6+ and every row in this matrix has
it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a false-positive CI signal by ensuring the Rails Zeitwerk autoloading check actually runs in the PostGIS test workflow, so constant/file mismatches are caught during CI rather than surfacing only in production eager-load boots.

Changes:

  • Removes the ineffective grep-based guard that prevented zeitwerk:check from running.
  • Runs bundle exec rake zeitwerk:check unconditionally in the Redmine working directory.
  • Adds inline workflow documentation explaining why the check matters and why the guard was incorrect.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dkastl
dkastl merged commit 903cd3b into next Jul 29, 2026
9 checks passed
@dkastl
dkastl deleted the ci/run-the-zeitwerk-check branch July 29, 2026 22:57
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