More store object info json cleanup#14502
Conversation
It turns out this code path is only used for unit tests (to ensure our JSON formats are possible to parse by other code, elsewhere). No user-facing functionality consumes this format. Therefore, let's drop the old version parsing support.
1ba0fa2 to
04ce7b3
Compare
Since we haven't released v2 yet (2.32 has v1) we can just update this in-place and avoid version churn. Note that as a nice side effect of using the standard `Hash` JSON impl, we don't neeed this `hashFormat` parameter anymore.
04ce7b3 to
4f1c8f6
Compare
|
FWIW, Determinate Nix has adopted the following format for serializing hashes in a structured way: It makes implementations simpler if we have only one hash encoding format (i.e. base-16) in JSON. |
|
We can perhaps change our format. (Though do note that that was in a different PR much before this one, this one is just using the pre-existing format.) It may help to know that my intent was not to support multiple hash formats --- mine always outputs base-64 unconditionally --- but make sure that we only support one hash format at a time. For example, yours will parse {
"algo": "sha256",
"base16": "abcdef...",
}and might someday parse {
"algo": "sha256",
"base64": "FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="
}but if given the union of things it parses at that point: {
"algo": "sha256",
"base16": "abcdef...",
"base64": "FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="
}but what does it do in that situation? Parse both and make sure they match? mine will parse both {
"algorithm": "sha256",
"format": "base64",
"hash": "FePFYIlMuycIXPZbWi7LGEiMmZSX9FMbaQenWBzm1Sc="
}and {
"algorithm": "sha256",
"format": "base16",
"hash": "abcdef..."
}(though I wouldn't mind doing some anti-"Postel's law" and just refusing to parse but even if it does parse both, there is no union: the schema makes very clear that one can only pass one hash at a time. |
|
The field name |
|
(Note that the hash instance was added in #14307) |
|
Per #14532 I think this PR is unblocked, because this PR is about using the hash format for JSON, not making it. After the issue is fixed (before next release) all this JSON will be regenerated accordingly, but not of the C++ this PR touches will need to be touched. |
Motivation
See each commit for details.
Context
JSON cleanup #13570
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.