Which fence is a page is the server's to say; the build's missing constant
CI / check (push) Canceled after 0s
CI / check (push) Canceled after 0s
- A closed step and a report are drawn from the server's text, where a page is the one line "[page: Title]" (the card). An `html-view` fence the server does not list -- written while pages were not offered -- is the code block it is. Only the open step of a reply as it streams takes the fence for a page, so that a page being written is not source scrolling by. - The events' reports frame carries latest_created; a report its pages. - FEATURE_VOICE_RECOGNIZERS is not in the SDK for apps: the feature is asked for by its name (CI run 88 failed to compile on it). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
7 files changed
+57
-31
No files matched your search
@@ -49,6 +49,7 @@ class ReportsContractTest {
|
||||
val frame = read("event_reports", ReportsFrame.serializer())
|
||||
assertEquals(1, frame.unread)
|
||||
assertEquals("rep1", frame.newest?.id)
|
||||
assertEquals("2026-01-02T03:04:05+00:00", frame.latestCreated)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -57,8 +58,10 @@ class ReportsContractTest {
|
||||
val report = LembasJson.decodeFromJsonElement(Report.serializer(), LembasJson.parseToJsonElement(text("report")).jsonObject.getValue("report"))
|
||||
assertEquals("chat9", report.chatId)
|
||||
assertEquals("gpt-oss", report.model)
|
||||
// The body carries the page's source; the phone draws a card in its place, never the source.
|
||||
val drawn = splitFences(report.body!!)
|
||||
// The body carries the page's source; the phone draws the server's text, where the page
|
||||
// is its one line and becomes a card -- never the source.
|
||||
assertEquals("Cakes", report.pages.single().title)
|
||||
val drawn = splitFences(report.text!!)
|
||||
assertEquals(Segment.Page("Cakes"), drawn.last())
|
||||
assertFalse(drawn.any { it is Segment.Code })
|
||||
// Share takes the server's own text, where the page is its one line.
|
||||
|
||||
@@ -199,19 +199,27 @@ class ReportsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aPageInAnAnswerIsNeverItsSource() {
|
||||
fun aPageBeingWrittenIsNeverItsSource() {
|
||||
// The open step of a reply as it streams, in a chat where pages are written: the fence is a page already.
|
||||
val reply = "Sales by month:\n\n```html-view Monthly sales\n<!doctype html>\n<html><script>alert(1)</script></html>\n```\n\nThat is all."
|
||||
val split = splitFences(reply)
|
||||
val split = splitFences(reply, pages = true)
|
||||
assertEquals(listOf(Segment.Prose("Sales by month:"), Segment.Page("Monthly sales"), Segment.Prose("That is all.")), split)
|
||||
// The word is exact: these are ordinary code blocks.
|
||||
assertEquals(listOf(Segment.Code("html", "<p>")), splitFences("```html\n<p>\n```"))
|
||||
assertEquals(listOf(Segment.Code("html-views", "<p>")), splitFences("```html-views\n<p>\n```"))
|
||||
// Tildes, no title, and one still being written.
|
||||
assertEquals(listOf(Segment.Page("")), splitFences("~~~html-view\n<html></html>\n~~~"))
|
||||
assertEquals(listOf(Segment.Page("Chart", closed = false)), splitFences("```html-view Chart\n<html>"))
|
||||
assertEquals(listOf(Segment.Code("html", "<p>")), splitFences("```html\n<p>\n```", pages = true))
|
||||
assertEquals(listOf(Segment.Code("html-views", "<p>")), splitFences("```html-views\n<p>\n```", pages = true))
|
||||
// Tildes, no title, and one not closed yet.
|
||||
assertEquals(listOf(Segment.Page("")), splitFences("~~~html-view\n<html></html>\n~~~", pages = true))
|
||||
assertEquals(listOf(Segment.Page("Chart", closed = false)), splitFences("```html-view Chart\n<html>", pages = true))
|
||||
// Backticks inside a page do not end it unless a line is the closing fence.
|
||||
assertEquals(listOf(Segment.Page("T")), splitFences("````html-view T\nconst a = `x`\n```\nstill the page\n````"))
|
||||
// The server's own line in a page's place.
|
||||
assertEquals(listOf(Segment.Page("T")), splitFences("````html-view T\nconst a = `x`\n```\nstill the page\n````", pages = true))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun whichFenceIsAPageIsTheServersToSay() {
|
||||
// Anywhere else -- a finished step, a report -- a fence is a page only if the server
|
||||
// said so, and then it sent the one line in its place. A fence it did not list (written
|
||||
// while pages were not offered) is the code block it is.
|
||||
assertEquals(listOf(Segment.Code("html-view", "<p>x</p>")), splitFences("```html-view Cakes\n<p>x</p>\n```"))
|
||||
assertEquals(
|
||||
listOf(Segment.Prose("Before."), Segment.Page("Monthly sales"), Segment.Prose("After.")),
|
||||
splitFences("Before.\n\n[page: Monthly sales]\n\nAfter."),
|
||||
@@ -221,12 +229,18 @@ class ReportsTest {
|
||||
|
||||
@Test
|
||||
fun whatIsCopiedOrSharedSaysThereIsAPage() {
|
||||
val reply = "Sales:\n\n```html-view Monthly sales\n<html>secret markup</html>\n```\n\n```sh\nmake\n```"
|
||||
val text = pageProjection(reply, untitled = "Page")
|
||||
val text = pageProjection("Sales:\n\n[page: Monthly sales]\n\n```sh\nmake\n```", untitled = "Page")
|
||||
assertEquals("Sales:\n\n[page: Monthly sales]\n\n```sh\nmake\n```", text)
|
||||
assertFalse(text.contains("secret markup"))
|
||||
assertEquals("[page: Page]", pageProjection("```html-view\n<html></html>\n```", untitled = "Page"))
|
||||
val report = Report(id = "rep1", title = "Two tenders opened", body = "Bids are due.\n\n```html-view Chart\n<svg></svg>\n```")
|
||||
assertEquals("[page: Page]", pageProjection("[page: ]", untitled = "Page"))
|
||||
// A report is shared by the server's text of it, where each page is its one line.
|
||||
val report =
|
||||
Report(
|
||||
id = "rep1",
|
||||
title = "Two tenders opened",
|
||||
body = "Bids are due.\n\n```html-view Chart\n<svg></svg>\n```",
|
||||
text = "Bids are due.\n\n[page: Chart]\n",
|
||||
)
|
||||
assertEquals("Two tenders opened\n\nBids are due.\n\n[page: Chart]", shareText(report))
|
||||
assertFalse(shareText(report).contains("<svg>"))
|
||||
}
|
||||
}
|
||||
@@ -710,9 +710,7 @@ object Fakes {
|
||||
|1. **Austria**: 200 MW, bids due on 15 May.
|
||||
|2. **A smaller one** closes on Friday; see the [notice](https://example.org/notice).
|
||||
|
|
||||
|```html-view Storage tenders by month
|
||||
|<!doctype html><html><body><svg></svg></body></html>
|
||||
|```
|
||||
|[page: Storage tenders by month]
|
||||
|
|
||||
|```text
|
||||
|storage tender: 200 MW, deadline 2026-05-15
|
||||
|
||||
Reference in new issue
Block a user