[backport] SI-6428 / SI-7022 Value class with bounds

Review by @paulp. There was one merge conflict, but it was straight forward to resolve.