Commit acfa6e6
Serialize token-store long fields as digits
FileTokenStore.putLongMember wrote a long field via sink.put(long),
which routes through Numbers.append(..., checkNaN=true) and renders
Long.MIN_VALUE as the literal JSON null. The two long fields
(expires_at_millis, token_ttl_millis) are present, non-nullable
integers, so a bare null there breaks the frozen cross-language format
(serialize() omits absent fields rather than writing null, so a null is
indistinguishable from absent) and round-trips back to 0 on read via
parseLongOrZero -- a silent corruption a Python peer would also diverge
on.
putLongMember now calls Numbers.append(sink, value, false), which emits
the full number, so every long value round-trips verbatim. The path is
reachable only through the public FileTokenStore.save(...) SPI;
OidcDeviceAuth clamps both fields to a non-negative range before
persisting, so the OIDC flow never hits it.
Add testLongFieldsSerializeAsDigitsNotBareNull: it saves Long.MIN_VALUE
in both long fields, asserts the on-disk JSON carries the digits rather
than a bare null, and that load() round-trips them instead of
collapsing to 0. The test fails on the pre-fix code and passes with the
fix.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent f3e62ed commit acfa6e6
2 files changed
Lines changed: 32 additions & 1 deletion
File tree
- core/src
- main/java/io/questdb/client/cutlass/auth
- test/java/io/questdb/client/test/cutlass/auth
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
405 | | - | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
406 | 411 | | |
407 | 412 | | |
408 | 413 | | |
| |||
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
682 | 682 | | |
683 | 683 | | |
684 | 684 | | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
685 | 711 | | |
686 | 712 | | |
687 | 713 | | |
| |||
0 commit comments