Validate the micro-frontend context against its contract schema

What does this MR do and why?

Adds spec/frontend/mfe_loader/build_gitlab_context_spec.js, which validates buildGitLabContext() output against the JSON schema from @gitlab-mfe/context. Every micro-frontend receives that context from the monolith, and the MFE repository owns its shape. The spec makes contract drift fail in CI instead of at runtime.

The spec runs in the regular jest and jest predictive jobs with the shared test setup. It also takes over the pageData example that index_spec.js had.

This is MR 3 of a 4-MR stack, split from !233214:

  1. Feature flag: !268037 (merged) (merged)
  2. Build and runtime configuration: !268042 (merged) (merged)
  3. Context contract spec (this MR)
  4. Agentic Duo Chat from the MFE in the AI panel: !268044

References

Screenshots or screen recordings

Not applicable: spec-only change.

How to set up and validate locally

  1. Run yarn jest spec/frontend/mfe_loader.
  2. Run VUE_VERSION=3 yarn jest spec/frontend/mfe_loader.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Rafa Frederico

Merge request reports

Loading
Loading