Search backend: add a stable JSON encoding for CommitMatch
Created by: camdencheek
Since we will be calling search directly for code monitors, we will now have access to the real CommitMatch type for code monitors. We store result types in the database, so this adds a stable JSON representation to CommitMatch so we can safely marshal/unmarshal. This will make it much more obvious when a change would break encoding compatibility, which is convenient.
Stacked on #31872
Test plan
Added a unit test that ensures roundtrip equality through the JSON encoding.