Skip to content

Increate context detection for jobs#130

Open
microstudi wants to merge 1 commit intomainio:mainfrom
openpoke:context-detection-upstream
Open

Increate context detection for jobs#130
microstudi wants to merge 1 commit intomainio:mainfrom
openpoke:context-detection-upstream

Conversation

@microstudi
Copy link
Copy Markdown

@microstudi microstudi commented Apr 21, 2026

Strengthened internal argument resolution to handle nested data structures more reliably when identifying users, organizations, and components in complex scenarios.

This is motivated by some mailer jobs that can have the user or components deeper in arguments hashes or arrays.

* increase component detection

* apply review

* ensure only hash and arrays

* fix missing helper

* fix missing helper
Copilot AI review requested due to automatic review settings April 21, 2026 11:50
Copy link
Copy Markdown

Copilot AI left a comment

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 strengthens Decidim::TermCustomizer::Context::JobContext argument resolution so background jobs can reliably detect organization/space/component/user even when passed inside nested arrays/hashes, and it tightens rake task specs to assert clean stderr output.

Changes:

  • Add recursive argument scanning helpers in JobContext to find objects by class or via accessor methods inside nested arrays/hashes.
  • Extend JobContext specs to cover nested user arguments and resolving component/space via questionnaires.
  • Improve rake task specs by asserting “no stderr output” using a new not_output matcher.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
spec/spec_helper.rb Defines not_output matcher to support chained “no stderr” assertions in specs.
spec/lib/decidim/term_customizer/context/job_context_spec.rb Adds coverage for nested arguments and questionnaire-based context resolution.
spec/lib/decidim/tasks/decidim_term_customizer_combine_file_spec.rb Updates task spec to assert stdout output and no stderr output.
spec/lib/decidim/tasks/decidim_term_customizer_combine_db_spec.rb Updates task spec to assert stdout output and no stderr output.
lib/decidim/term_customizer/context/job_context.rb Implements recursive lookup through nested argument structures and questionnaire-to-component resolution.

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

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