Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed

- Glaze is now 9.0.0. Parsing gives the same results and allocates the same
memory, and it runs up to 7% fewer instructions on the larger fixtures.

### Fixed

- A body made of nothing but a number with an empty exponent, such as `1e`,
parsed as valid JSON and gave an empty result. The clients now return
`ParseError` and the `parse_*` functions throw, as for any malformed body.

## [0.4.3] - 2026-09-25

### Fixed
Expand Down
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Glaze 8.3 needs 3.31.
# Glaze needs 3.31.
cmake_minimum_required(VERSION 3.31)

# include/spc/version.hpp holds the version, so builds without CMake get it too.
Expand Down Expand Up @@ -100,12 +100,11 @@ find_package(CURL 7.85 REQUIRED)
include(FetchContent)

# Glaze reads SPC's loosely shaped JSON. It is a private build dependency: no
# installed header includes it. kalshi-cpp pins the same version, so a build
# that fetches both SDKs gets a single glaze target.
# installed header includes it.
FetchContent_Declare(
glaze
GIT_REPOSITORY https://github.com/stephenberry/glaze.git
GIT_TAG v8.3.0
GIT_TAG v9.0.0
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(glaze)
Expand Down
3 changes: 3 additions & 0 deletions tests/test_client_parity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@ TEST(ClientParity, AMalformedBodyFailsWithTheParsersMessage) {
R"({"features":[)",
R"({"features":[1,2)",
R"({"a":"x")",
"1e",
"1e+",
"1E-",
read_fixture("arcgis_day1_categorical.geojson").substr(0, 5000),
};

Expand Down
13 changes: 13 additions & 0 deletions tests/test_corpus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "spc/models/outlook.hpp"
#include "support/fixtures.hpp"

#include <format>
#include <gtest/gtest.h>
#include <stdexcept>
#include <string>
Expand Down Expand Up @@ -72,6 +73,18 @@ TEST(Corpus, MalformedBodyThrows) {
std::runtime_error);
}

TEST(Corpus, RejectsMalformedNumbers) {
// Glaze reads a number that ends the input on a different path from one
// followed by more JSON, so check both.
for (const std::string_view number :
{"1e", "1e+", "1E-", "1.", ".5", "01", "-", "+1", "1.e5"}) {
EXPECT_THROW((void)parse_categorical(number, 1), std::runtime_error) << number;
const std::string body =
std::format(R"({{"features":[{{"properties":{{"DN":{}}}}}]}})", number);
EXPECT_THROW((void)parse_categorical(body, 1), std::runtime_error) << body;
}
}

TEST(Corpus, ParsesOnlyTheViewItIsGiven) {
// The closing brace sits just past the view, so reading past the view's end
// would accept a truncated body.
Expand Down
Loading