fix: audit STEP-057 weather runtime facade
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled

This commit is contained in:
OpenAI Codex
2026-09-07 11:42:28 +08:00
parent efaa3e61c9
commit dad6876c72
20 changed files with 183 additions and 23 deletions

View File

@@ -68,7 +68,7 @@ std::string fixtureBytes(const std::string& fixtureID, const std::string& file)
std::string localMetadata(const int index) {
return "{\"schema\":\"maplibre-particle-field/v1\",\"fieldId\":\"production-t" +
std::to_string(index) + "\",\"fieldType\":\"WIND\",\"displayDomain\":\"GLOBAL\",\"generation\":" +
std::to_string(index + 1) + ",\"validTime\":" + std::to_string(202609040000ULL + index * 100) +
std::to_string(index + 1) + ",\"validTime\":" + std::to_string(1704067200000ULL + index * 3600000ULL) +
",\"dataVersion\":" + std::to_string(index + 1) +
",\"bounds\":{\"west\":-180,\"south\":-85,\"east\":180,\"north\":85},\"grid\":{\"width\":16,\"height\":16},\"vector\":{\"layout\":\"interleaved-uv\",\"encoding\":\"float32-le\",\"noData\":-9999},\"payload\":{\"byteLength\":2048}}";
}
@@ -301,7 +301,7 @@ TEST(Source, LocalProductionFeedSubmitsSnapshotsWithProducerTime) {
ASSERT_TRUE(result) << result.message;
ASSERT_TRUE(result.snapshot);
EXPECT_EQ(result.snapshot->generation, static_cast<uint64_t>(index + 1));
EXPECT_EQ(result.snapshot->validTime, 202609040000ULL + static_cast<uint64_t>(index) * 100);
EXPECT_EQ(result.snapshot->validTime, 1704067200000ULL + static_cast<uint64_t>(index) * 3600000ULL);
snapshots.push_back(std::move(*result.snapshot));
}
for (size_t index = 1; index < snapshots.size(); ++index) {
@@ -441,11 +441,18 @@ TEST(Source, HostFieldClearAndTimestampSeekAreFailClosed) {
EXPECT_FALSE(source.impl().timeline);
EXPECT_EQ(source.submitHostField(localMetadata(0), eastPayload), style::RasterArrayHostFieldSubmitResult::AcceptedPendingInitialWindow);
EXPECT_EQ(source.submitHostField(localMetadata(1), northPayload), style::RasterArrayHostFieldSubmitResult::InitialWindowReady);
EXPECT_TRUE(source.seekRuntimeTimelineToTimestamp(202609040050ULL));
const uint64_t t0 = 1704067200000ULL;
const uint64_t t1 = 1704070800000ULL;
EXPECT_TRUE(source.seekRuntimeTimelineToTimestamp(t0));
EXPECT_FLOAT_EQ(source.impl().timeline->frame().mix, 0.0f);
EXPECT_TRUE(source.seekRuntimeTimelineToTimestamp(t0 + 1800000ULL));
EXPECT_FLOAT_EQ(source.impl().timeline->frame().mix, 0.5f);
EXPECT_FALSE(source.seekRuntimeTimelineToTimestamp(202609039999ULL));
EXPECT_TRUE(source.seekRuntimeTimelineToTimestamp(t1));
EXPECT_FLOAT_EQ(source.impl().timeline->frame().mix, 1.0f);
EXPECT_FALSE(source.seekRuntimeTimelineToTimestamp(t0 - 1));
EXPECT_FALSE(source.seekRuntimeTimelineToTimestamp(t1 + 1));
EXPECT_TRUE(source.clearHostFields());
EXPECT_FALSE(source.seekRuntimeTimelineToTimestamp(202609040050ULL));
EXPECT_FALSE(source.seekRuntimeTimelineToTimestamp(t0 + 1800000ULL));
}
TEST(Source, HostFieldSubmissionStyleContractCreatesEmptyIngress) {
@@ -515,9 +522,9 @@ TEST(Source, HostFieldSubmissionRejectsInvalidWithoutChangingLastValidField) {
style::RasterArrayHostFieldSubmitResult::RejectedAdapter);
auto nonMonotonic = localMetadata(2);
const auto validTime = nonMonotonic.find("202609040200");
const auto validTime = nonMonotonic.find("1704074400000");
ASSERT_NE(validTime, std::string::npos);
nonMonotonic.replace(validTime, std::string("202609040200").size(), "202609040050");
nonMonotonic.replace(validTime, std::string("1704074400000").size(), "1704069000000");
EXPECT_EQ(source.submitHostField(nonMonotonic, payload),
style::RasterArrayHostFieldSubmitResult::RejectedNonMonotonicSnapshot);