Cover orbit context branches flagged by undercoverage

What does this MR do and why?

Chained on !264100 (merged). It fixes that MR's rspec:undercoverage job by adding specs for the Orbit context formatter, service and token branches the job listed as untested.

It also drops three nil-safe calls on a job's pipeline, which is never nil.

No project issue. Chained on !264100 (merged).

How to set up and validate locally

bundle exec rspec ee/spec/lib/analytics/orbit/context_token_spec.rb \
  ee/spec/services/analytics/orbit/context_llm_formatter_spec.rb \
  ee/spec/services/analytics/orbit/context_service_spec.rb

from agent

Agent context
  • Uncovered items came from the job trace of pipeline 2979991497: formatter reference, append_changed_files, append_failed_jobs, and partial branches in the test and note blocks; service find_by_id, job_summary, changed_lines, failed_jobs, discussions, note_summary; token id_url_token.
  • job_summary used pipeline&., but Ci::Build#sha delegates to the pipeline and raises when it is nil, so the nil branch could not be reached. I changed it to pipeline..
  • Ran the three spec files on a Caproni instance: token spec 14 examples, formatter and service specs 51 examples, no failures. Rubocop is clean on the touched files. I did not run scripts/undercoverage locally.

Merge request reports

Loading
Loading