Skip to content

Search: break dependencies on pre-formatted markdown

Warren Gifford requested to merge cc/stream-types into main

Created by: camdencheek

Currently, for commit matches, we generate label and detail in the backend as markdown-formatted strings. This is non-ideal for a number of reasons, including, including but not limited to:

  • Consumers of the API would need to parse these fields to get information like OID or author date.
  • Formatting in the UI is constrained by the format returned by the API
  • Rendering markdown returned by the backend is dangerous (we do a bunch of allowlisting) and a historical source of bugs (highlighting weirdness)
  • It adds complexity to our backend types

This adds the information needed to generate these fields to the commit match stream type cuts markdown out of the loop.

For the moment, this keeps the label and detail fields on our API types since removing them is a breaking change, but I think we should move towards removing them entirely since it seems unlikely that anyone actually wants a markdown representation in the API. We do explicitly call out that the streaming API may be unstable, and we do not document the exact fields in the streamed types.

Test plan

Tested manually and tried to minimize visual changes in Percy.

Merge request reports

Loading