fix: repair release test failures
site / publish (push) Has been cancelled
release / site (push) Has been cancelled
release / test (push) Has been cancelled
release / windows (push) Has been cancelled
release / macos (push) Has been cancelled
release / linux (push) Has been cancelled
release / publish (push) Has been cancelled

This commit is contained in:
Marcos Paulo
2026-10-29 15:55:21 -03:00
parent ddd6fd96b8
commit 87c9c3a151
4 changed files with 11 additions and 7 deletions
+3 -1
View File
@@ -228,7 +228,9 @@ mod tests {
let r = loaded.messages[0].tools[0].result.as_ref().unwrap();
let Some((mime, ImageSrc::File(path))) = image_data(&r[0]) else { panic!("still inline: {r}") };
let on_disk = std::fs::read_to_string(file_of(&dir, "shots")).unwrap();
assert!(on_disk.contains(path) && !on_disk.contains(&STANDARD.encode(&png)), "the slimmer chat was written back");
let saved: Value = serde_json::from_str(&on_disk).unwrap();
assert_eq!(saved["messages"][0]["tools"][0]["result"][0]["path"], path, "the slimmer chat was written back");
assert!(!on_disk.contains(&STANDARD.encode(&png)));
assert_eq!((mime, ImageSrc::File(path).bytes()), ("image/png", Some(png)));
assert_eq!(r[1]["text"], "ok");
remove_tmp(&dir, "shots");
+3 -1
View File
@@ -1510,7 +1510,7 @@ const SKILL_LEFT_OUT: [&str; 6] = ["## 1.", "## 2b.", "## 2c.", "## 3b.", "## 5.
/// The papercraft skill without its front matter and the sections a chat turn does without, which
/// stay one `get_guide` call away. About 14 KB less on every turn.
fn chat_skill(md: &str) -> String {
let body = md.strip_prefix("---").and_then(|r| r.split_once("\n---\n")).map_or(md, |(_, b)| b);
let body = md.strip_prefix("---").and_then(|r| r.split_once("\n---\n").or_else(|| r.split_once("\n---\r\n"))).map_or(md, |(_, b)| b);
let mut out = String::new();
let mut keep = true;
for line in body.lines() {
@@ -2774,6 +2774,8 @@ mod tests {
fn the_chat_skill_keeps_the_loop_and_limits_and_points_to_the_rest() {
let full = include_str!("../../skills/papercraft/SKILL.md");
let skill = chat_skill(full);
let lf = full.replace("\r\n", "\n");
assert_eq!(chat_skill(&lf.replace('\n', "\r\n")), chat_skill(&lf));
assert!(!skill.starts_with("---") && !skill.contains("## 5. Tools cheat sheet"));
assert!(skill.contains("## 2. The loop") && skill.contains("## 6. Known limits") && skill.contains("topic: \"skill\""));
assert!(skill.len() * 2 < full.len(), "{} of {}", skill.len(), full.len());
+2 -2
View File
@@ -116,10 +116,10 @@ fn annotate_tidy_without_notes_reports_moves() {
let h = &mut f.host;
let id = artboard(h, "Sign in", 0.0);
call(h, "annotate", json!({"notes": [{"node": id, "text": "One"}, {"node": id, "text": "Two"}]}));
assert_eq!(call(h, "annotate", json!({"tidy": true})), json!({"tidied": 0}));
assert_eq!(call(h, "annotate", json!({"tidy": true}))["tidied"], 0);
let note = h.ed.doc.annotations[0].id;
h.ed.update_annotation(note, |a| a.position = v2(2000.0, 2000.0));
assert_eq!(call(h, "annotate", json!({"tidy": true})), json!({"tidied": 1}));
assert_eq!(call(h, "annotate", json!({"tidy": true}))["tidied"], 1);
}
#[test]
+3 -3
View File
@@ -325,14 +325,14 @@ fn a_border_written_with_a_variable_stays_bound_to_it() {
fn a_fit_content_artboard_grows_around_a_growing_child() {
// Issue #21.
let mut h = host();
let ab = call(&mut h, "create_artboard", json!({"name": "Phone", "styles": {"width": "390px", "height": "fit-content", "minHeight": "844px", "display": "flex", "flexDirection": "column"}}));
let ab = call(&mut h, "create_artboard", json!({"name": "Phone", "styles": {"width": "390px", "height": "fit-content", "minHeight": "844px", "display": "flex", "flexDirection": "column", "overflow": "visible"}}));
call(&mut h, "write_html", json!({"targetNodeId": ab["id"], "html": "<div style=\"display:flex;flex-direction:column;flex-grow:1\"><div style=\"height:1200px;width:100px\"></div></div>"}));
let doc = &h.ed.doc;
let a = doc.get(num(&ab["id"])).unwrap();
let k = doc.get(a.children[0]).unwrap();
assert_eq!((a.rect.h, k.rect.h), (1200.0, 1200.0));
// Short content: the screen keeps its min height and the growing area pins the footer down.
let ab = call(&mut h, "create_artboard", json!({"name": "Short", "styles": {"width": "390px", "height": "fit-content", "minHeight": "844px", "display": "flex", "flexDirection": "column"}}));
let ab = call(&mut h, "create_artboard", json!({"name": "Short", "styles": {"width": "390px", "height": "fit-content", "minHeight": "844px", "display": "flex", "flexDirection": "column", "overflow": "visible"}}));
call(&mut h, "write_html", json!({"targetNodeId": ab["id"], "html": "<div style=\"display:flex;flex-direction:column;flex-grow:1\"><div style=\"height:100px;width:100px\"></div></div><div style=\"height:60px;width:390px\"></div>"}));
let doc = &h.ed.doc;
let a = doc.get(num(&ab["id"])).unwrap();
@@ -359,7 +359,7 @@ fn a_scrolling_screen_keeps_its_size_and_the_wheel_scrolls_its_overflow() {
use papercraft::editor::InputEvent;
use papercraft::geom::v2;
let mut h = host();
let ab = call(&mut h, "create_artboard", json!({"name": "Phone", "styles": {"width": "390px", "height": "fit-content", "minHeight": "844px", "display": "flex", "flexDirection": "column"}}));
let ab = call(&mut h, "create_artboard", json!({"name": "Phone", "styles": {"width": "390px", "height": "fit-content", "minHeight": "844px", "display": "flex", "flexDirection": "column", "overflow": "visible"}}));
let kid = call(&mut h, "write_html", json!({"targetNodeId": ab["id"], "html": "<div style=\"height:1200px;width:390px;background:#eee\"></div>"}))["createdNodeIds"][0].clone();
let (ab, kid) = (num(&ab["id"]), num(&kid));
assert_eq!(h.ed.doc.get(ab).unwrap().rect.h, 1200.0, "fit-content grew");