checkpoint: calls/first-contact/stories fixes + Home/Messages redesign (unverified)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
59fa88c2ad
commit
e7a3b60b32
@@ -198,4 +198,25 @@ class ContentTest {
|
||||
Attachment.open(sealed.blob, ref().copy(key = ByteArray(32), digest = sealed.digest))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 🔴 The vault persists refs through toJson and reads "exp" back out of
|
||||
* that very JSON — a field toJson never wrote reloaded as 0, which both
|
||||
* rendered every story as "no expiry" and (because 0 means immortal to
|
||||
* isActive) meant expired story bytes were never dropped on write.
|
||||
*/
|
||||
@Test
|
||||
fun `a story ref keeps its expiry through the json round trip`() {
|
||||
val posted = ref(kind = Attachment.STORY).copy(expires = 1_700_000_000.5)
|
||||
val json = posted.toJson()
|
||||
val reloaded = Attachment.Ref.fromJson(
|
||||
Attachment.STORY, json, json.optDouble("exp", 0.0))!!
|
||||
kotlin.test.assertEquals(posted.expires, reloaded.expires)
|
||||
}
|
||||
|
||||
/** Non-story refs never grow an "exp" field they did not have before. */
|
||||
@Test
|
||||
fun `an image ref does not gain an expiry field`() {
|
||||
assertFalse(ref().toJson().has("exp"))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user