Draft: Add full-mount spec for Rapid Diffs discussion note shapes
What does this MR do and why?
This MR adds a full-mount Jest spec for Rapid Diffs discussion_notes.vue. The spec mounts the whole note tree without stubs, and feeds it note shapes that the real legacyNotes Pinia store produces: persisted replies, the optimistic reply placeholder, and the quick-action placeholder.
The existing discussion_notes_spec.js uses shallowMount, so a crash in a child component is invisible. This spec catches the missing placeholder branch in the Rapid Diffs component: the placeholder has no author, and noteable_note.vue throws TypeError: Cannot read properties of undefined (reading 'id'). Vue 2 swallows this error and renders a blank component. Vue 3 in the development build rethrows it and breaks the whole discussion list. The bug was found only after the Vue 3 migration of the MR Rapid Diffs page had merged, and the migration was reverted.
Full-mount specs with store-produced shapes let Jest catch this class of crash before a Vue 3 migration flag is enabled, instead of feature specs on master. This spec is a template for other migration targets.
This MR is a Draft. On master, the two placeholder cases fail under Vue 2 and Vue 3. Merge it after the fix in !255075 (merged).
References
- Issue that describes the bug: #628791 (closed)
- Fix MR this spec guards (merge after it): !255075 (merged)
- Vue 3 migration MR of the MR Rapid Diffs page (merged, then reverted): !252389 (merged)
- Revert MR: !255026 (merged)
- MR that pointed
spec/features/merge_requestat Rapid Diffs, whose pipeline surfaced the crash: !247832 (merged) - Failing feature spec jobs that showed the symptom (
rspec system pg177/32 and 15/32): https://gitlab.com/gitlab-org/gitlab/-/jobs/16446513687 and https://gitlab.com/gitlab-org/gitlab/-/jobs/16446513695 - Vue 3 migration (Code Review) epic: gitlab-org#23167
Screenshots or screen recordings
This MR has no UI change.
How to set up and validate locally
Run the spec under both Vue versions. On master, expect 2 failures in each run:
yarn jest spec/frontend/rapid_diffs/app/discussions/discussion_notes_store_shapes_spec.jsVUE_VERSION=3 yarn jest spec/frontend/rapid_diffs/app/discussions/discussion_notes_store_shapes_spec.js
Apply the component files from the fix MR:
git fetch origin tor/rapid-diffs/placeholder-note-vue3-compat
git checkout FETCH_HEAD -- app/assets/javascripts/rapid_diffs/app/discussionsRerun both commands. Expect 3 passes in each run.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist.