Repository navigation
Conversation
|
Claude finished @mbevc1's task in 2m 24s —— View job Follow-up review complete
Note on scope: Status of previous findingsBoth of my prior inline comments were on The PR is now narrowed to JSON-only: large integers (any size) are sent exactly as written; every other JSON number still round-trips through New inline comments: 0I reviewed the changed lines in
Limitation: I could not run |
722c844 to
e4f05d1
Compare
|
The CLI side looks right to me. My concern is what the server does with the new bytes, because the same file now produces a different payload. Whole-number floats change type on the wire. Two client errors became server inputs.
If the server can't hold these, the user gets a server error where they used to get a clear CLI message. The tests stop at
If 1 fails, this is a breaking change for existing custom types and should be labelled as one in the release notes. If 2 or 3 fail, I'd keep the client-side errors for those cases. |
|
Thanks Dan, you were right on 1 and 3, and the PR is now narrowed. I ran your three cases through the server's API code at
So 1 was a breaking change for draft-04 types, 3 silently stored What the PR does now:
The only wire change left is JSON integers above 2^53, so I don't think this needs a breaking-change note. Two things still open:
|
LoadJsonData unmarshalled into any, so every number became a float64 and an integer above 2^53 was sent as a different number, e.g. 12345678901234567890 became 12345678901234567000. Decoding with UseNumber keeps each number as json.Number, which marshals back exactly as written. This covers --user-data on the attest and trail commands and JSON files given to attest custom --attestation-data. Fixes #1430
A YAML file given to attest custom --attestation-data went through yaml.v3, which decodes a number to an int64, a uint64 or a float64. A decimal lost digits beyond float64 precision and its written form (1.10 was sent as 1.1), and an integer beyond 64 bits was rejected, while the same numbers in a JSON file are now sent exactly. yaml.v3 has no hook to decode a scalar into another type, and walking the tree by hand would mean reimplementing its alias, merge key and duplicate key handling. So a number node is turned into a string behind a random marker before decoding, and turned into a json.Number after. Spellings JSON does not have (+1.5, .5, 1., 1_000) are respelled without changing a digit. Also covers 1.0 and 1e2 in the JSON loader tests, as the review of the JSON fix suggested. Refs #1430
The YAMLDocuments godoc said decimals keep their digits whatever their size, but yaml.v3 resolves a decimal beyond float64's range to a string, so it is sent as one. It also left out that a leading zero is dropped from a decimal such as 01.50 while 089 is an error. Tests pin a signed exponent and the beyond-float64 integer. Refs #1430
The server reads every decimal into a float64, so the extra digits were dropped on arrival and exact YAML decimals gained nothing. They did change the wire form of whole-number floats: 1.0 arrived as a float where it used to arrive as the integer 1, which a custom attestation type with a draft-04 schema and type integer rejects. YAML integers within 64 bits were already exact, so the YAML loader goes back to what it was, along with its documentation. This reverts commits 4205006 and e4f05d1. Refs #1430
Keeping every number as written changed the wire form of numbers that were never wrong. 1.0 arrived at the server as a float where it used to arrive as the integer 1, and a custom attestation type whose schema declares draft-04 and type integer answers that with a 400. 1e400, which the CLI used to reject, was sent and stored by the server as null. The server reads every decimal into a float64 anyway, so exact decimals gained nothing. It stores user data and attestation data as JSON text, so an integer of any size survives. So an integer stays as written and every other number goes through float64 as before: 1.0 is sent as 1, 1e2 as 100, and a number beyond float64 is an error that names the file. Refs #1430
29572c2 to
2460afb
Compare
Send integers from JSON data files exactly as written.
--user-dataandkosli attest custom --attestation-datadecoded every number as a float64, so an integer above 2^53 reached Kosli as a different number (12345678901234567890became12345678901234567000).Every other number is sent as before:
1.0as1,1e2as100, and decimals with float64 precision. YAML files are unchanged.Closes #1430
Checklist
charts/k8s-reporter/) updated, if needed. Note: these changes live in a separate PR (n/a: the k8s reporter is untouched)