[go: up one dir, main page]

Skip to content

Change to approval rule hook breaks pre-change approval rules

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

A customer reported an issue via this (internal only) ticket where the existing system hook started returning an incorrect value for approval rules.

The incorrect value looks like this:

"approval_rules":{"previous":"#<ApprovalMergeRequestRule::ActiveRecord_Associations_CollectionProxy:0x00007f1728f9d8a0>","current": [{...valid json}]}

Steps to reproduce

  • This requires having a pre 17.0.6 instance, MR's, approval rules and hooks in place
  • Upgrading to 17.0.6 will cause the pre-17.0.6 approval rules to use !138564 (diffs)
  • The ActiveRecord_Associations_CollectionProxy will be returned

Example Project

N/A

What is the current bug behavior?

While cached, hooks return via previous ActiveRecord_Associations_CollectionProxy if approval rules are changed

What is the expected correct behavior?

The array should be returned

Relevant logs and/or screenshots

N/A

Output of checks

N/A

Possible fixes

Because of its transient nature, it's possible that this has been present before and just gone away as things are updated.

Maybe

assoc.fetch(:approval_rules, approval_rules).to_a

In https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/models/concerns/ee/issuable.rb#L96 ?

Edited by 🤖 GitLab Bot 🤖