A bug was reported where Jobs::ProcessPost fails due to an undefined method cancel_scheduled_job for Jobs::Jobs:Module, reproducible in development but not production. merefield suspected it might relate to a recent commit and suggested adding a leading :: to fix the namespace resolution. david confirmed the issue stems from the discourse-narrative-bot plugin, which inadvertently defines ::Jobs::Jobs, interfering with Ruby’s constant lookup. He verified this by commenting out the offending lines and submitted a PR to resolve the mismatched job module names. The issue is development-only, caused by file path/module name discrepancies. merefield acknowledged the fix and thanked david for the quick response.
Hmm, adding a leading :: would certainly fix it… but it shouldn’t be required
Given that the call comes from within ::Jobs::ProcessPost, Ruby should work up the tree. First it’ll look for ::Jobs::ProcessPost::Jobs, then ::Jobs::Jobs, then eventually ::Jobs module.
The error you’re seeing suggests that something is defining ::Jobs::Jobs… which is weird! Taking a look on my development instance:
Looks like these lines in discourse-narrative-bot are causing issues. If I comment them out, it solves the problem.
Good news is that it’s development-only - related to the file paths of the jobs mismatching the names of the modules. Here’s a PR to clean things up: