@@ -150,7 +150,7 @@ TEST(ObjectStoreTest, LatestAtExact) {
150150 auto r = store.latestAt (id, 200 );
151151 ASSERT_TRUE (r.has_value ());
152152 EXPECT_EQ (r->timestamp , 200 );
153- EXPECT_EQ (r->view [0 ], 0x02 );
153+ EXPECT_EQ (r->payload . bytes [0 ], 0x02 );
154154}
155155
156156TEST (ObjectStoreTest, LatestAtBetween) {
@@ -292,17 +292,13 @@ TEST(ObjectStoreTest, PushLazyResolves) {
292292 auto r = store.latestAt (id, 100 );
293293 ASSERT_TRUE (r.has_value ());
294294 EXPECT_EQ (call_count, 1 );
295- EXPECT_EQ (r->view .size (), 2u );
296- EXPECT_EQ (r->view [0 ], 0xDE );
295+ EXPECT_EQ (r->payload . bytes .size (), 2u );
296+ EXPECT_EQ (r->payload . bytes [0 ], 0xDE );
297297}
298298
299- // Regression: the lazy path must preserve the BufferAnchor's concrete type.
300- // Anchor here is a shared_ptr<TestBuffer> — NOT a shared_ptr<vector>. If
301- // resolveEntry static_pointer_cast'd to vector (the prior implementation),
302- // view would point at garbage and ASAN would flag it. We assert that
303- // (a) the bytes the producer published survive resolution unchanged, and
304- // (b) the anchor's refcount stays > 0 through the resolve (the store does
305- // not silently swap it for a different anchor type).
299+ // Regression: anchor type-erasure must survive resolveEntry. The anchor here
300+ // is a shared_ptr<TestBuffer> (not vector); a prior static_pointer_cast to
301+ // vector would UB.
306302TEST (ObjectStoreTest, PushLazyPreservesAnchorType) {
307303 struct TestBuffer {
308304 std::array<uint8_t , 4 > bytes{0x11 , 0x22 , 0x33 , 0x44 };
@@ -322,16 +318,14 @@ TEST(ObjectStoreTest, PushLazyPreservesAnchorType) {
322318
323319 auto r = store.latestAt (id, 100 );
324320 ASSERT_TRUE (r.has_value ());
325- ASSERT_EQ (r->view .size (), 4u );
326- EXPECT_EQ (r->view [0 ], 0x11 );
327- EXPECT_EQ (r->view [3 ], 0x44 );
321+ ASSERT_EQ (r->payload . bytes .size (), 4u );
322+ EXPECT_EQ (r->payload . bytes [0 ], 0x11 );
323+ EXPECT_EQ (r->payload . bytes [3 ], 0x44 );
328324 EXPECT_FALSE (weak_buffer.expired ()); // anchor still holds the buffer alive
329325}
330326
331- // Regression: PayloadView::bytes is the *producer-chosen sub-range* of the
332- // anchor's storage. resolveEntry must propagate that Span verbatim — not the
333- // anchor's full extent. The prior implementation ignored the Span and
334- // returned the anchor's whole vector.
327+ // Regression: the producer's Span is a sub-range of the anchor's storage.
328+ // resolveEntry must propagate it verbatim — not the anchor's full extent.
335329TEST (ObjectStoreTest, PushLazyHonorsSpanSubview) {
336330 ObjectStore store;
337331 auto id = registerTestTopic (store);
@@ -350,10 +344,10 @@ TEST(ObjectStoreTest, PushLazyHonorsSpanSubview) {
350344
351345 auto r = store.latestAt (id, 100 );
352346 ASSERT_TRUE (r.has_value ());
353- EXPECT_EQ (r->view .size (), 10u );
354- EXPECT_EQ (r->view .data (), chunk->data () + 20 );
355- EXPECT_EQ (r->view [0 ], 20 );
356- EXPECT_EQ (r->view [9 ], 29 );
347+ EXPECT_EQ (r->payload . bytes .size (), 10u );
348+ EXPECT_EQ (r->payload . bytes .data (), chunk->data () + 20 );
349+ EXPECT_EQ (r->payload . bytes [0 ], 20 );
350+ EXPECT_EQ (r->payload . bytes [9 ], 29 );
357351}
358352
359353// =========================================================================
@@ -390,13 +384,13 @@ TEST(ObjectStoreTest, HandleSurvivesEviction) {
390384
391385 auto handle = store.latestAt (id, 100 );
392386 ASSERT_TRUE (handle.has_value ());
393- EXPECT_EQ (handle->view [0 ], 0xAA );
387+ EXPECT_EQ (handle->payload . bytes [0 ], 0xAA );
394388
395389 store.evictBefore (id, 150 );
396390 EXPECT_EQ (store.entryCount (id), 1u );
397391
398- EXPECT_EQ (handle->view .size (), 4u );
399- EXPECT_EQ (handle->view [0 ], 0xAA );
392+ EXPECT_EQ (handle->payload . bytes .size (), 4u );
393+ EXPECT_EQ (handle->payload . bytes [0 ], 0xAA );
400394}
401395
402396// =========================================================================
0 commit comments