Skip the cache write when a CI subscription leaves data unchanged

What does this MR do and why?

Fixes Apollo cache warnings when CI feature specs subscribe to GraphQL subscriptions.

When subscribeToMore handlers returned previous data unchanged, Apollo read an incomplete cache, wrote the incomplete result back, and logged Missing field warnings for every field the cache did not have. This occurred in two scenarios:

  • Pipelines list: When query variables changed (tab switch, pagination), the cache had no pipelines field for the new variables yet. The handler returned previous data unchanged, causing writes of incomplete results. Handlers now return undefined on paths that do not change the result.
  • Jobs list: The subscription selected fewer fields than the query (no browseArtifactsPath, no commit under pipeline). New jobs and merged updates caused cache writes to miss those fields. A new fragment jobs_table_job.fragment.graphql is shared between query and subscription so they always select the same fields.

This MR eliminates the warnings in console output by:

  • Creating a shared fragment for job node selection.
  • Updating updateQuery handlers across CI pages to return undefined instead of previous data when the result does not change.
  • Keeping handlers that build a new result unchanged.

References

Screenshots or screen recordings

Not applicable. This fix addresses console warnings only. The UI is unchanged.

How to set up and validate locally

  1. Run yarn jest spec/frontend/ci/jobs_page spec/frontend/ci/pipelines_page.
  2. In GDK open a project's CI/CD > Jobs page with the browser console open.
  3. Retry a job.
  4. On master the console shows Missing field 'browseArtifactsPath' while writing result and Missing field 'commit' while writing result.
  5. On this branch the console shows nothing and the new job row appears.
  6. Open the Pipelines page.
  7. Click the Finished tab while a pipeline is running.
  8. Confirm no Missing field 'pipelines' message appears.

MR acceptance checklist

This MR was evaluated against the acceptance checklist.

Merge request reports

Loading
Loading