SI-7290 Minor cleanups driven by review comments.

  - make a def a val, we only need to compute it once
  - add a clarifying comment
  - only report the first duplicate