While trying to merge two kinks for KCC v0.9, I noticed that the current serialization format doesn't allow us to carry over ratings in that case. Merging two kinks ["A", [""]] and ["B", [""]] into a new kink ["C", ["a", "b"]] can only reasonably get a new ID, which throws away existing ratings. But this is a case where the serialization format could help, and therefore imo it should. This might, however, be quite difficult to implement.
Alternative 1: Flat format (checkData = { ratings: optional<validRating>[] })
We could overhaul the entire serialization format to just store a list of ratings:
type kink = [string, [""], [number]]
| [string, [""], [number], string]
| [string, [string, string], [number, number]]
| [string, [string, string], [number, number], string]
type checkData = { ratings: (validRating | undefined | null)[] }
// decodeKinkCheck:
kid.map(i => s.ratings[i]) // .filter(r => r || r === 0)
Alternative 2: Special cases (kink.id = number | [number, number])
Alternatively, we can keep most of the serialization as-is, and patch up that specific case:
type kink = [string, positions, number | number[]]
| [string, positions, number | number[], string]
type checkData = { ratings: (validRating[] | undefined | null)[] }
// decodeKinkCheck:
typeof kid === "number" ? s.ratings[kid] : kid.flatMap(i => s.ratings[i])
While trying to merge two kinks for KCC v0.9, I noticed that the current serialization format doesn't allow us to carry over ratings in that case. Merging two kinks
["A", [""]]and["B", [""]]into a new kink["C", ["a", "b"]]can only reasonably get a new ID, which throws away existing ratings. But this is a case where the serialization format could help, and therefore imo it should. This might, however, be quite difficult to implement.Alternative 1: Flat format (
checkData = { ratings: optional<validRating>[] })We could overhaul the entire serialization format to just store a list of ratings:
Alternative 2: Special cases (
kink.id = number | [number, number])Alternatively, we can keep most of the serialization as-is, and patch up that specific case: