Fix note creation error for SHA256 repositories
What does this MR do and why?
Contributes to #463793 (closed)
Problem
Note model uses a json validation to verify the schema of the position field. This validation fails because SHA256 repository generates commits with a length 64 instead of standard 40.
Solution
Extend validation to accept SHA256 commit hashes with length 64.
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
![]() |
![]() |
How to set up and validate locally
- Enable feature flag
Feature.enable(:support_sha256_repositories)
in Rails console - Create a new project with SHA256 repository
- Make changes (update file for example) and create a new branch with a merge request
- Try to leave a comment on the merge request changes (select a line of code, not just a regular comment)
- It should work without any errors