[BZ-1059690] fix globals resolution in constraints
(cherry picked from commit dde8b45e601ca70a962cbd7644ce57e4a25227d8)