Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
anything else is the new compile error `CATCH_NOT_ON_AWAIT` (R-f-4). Show a failed value with an `errored` region
where it is read; in a handler or action, read it inside `try { … } catch (e) { … }`; write validation as a value
(`""` or a message), not a thrown class.
- `UNGUARDED_SNAPSHOT` (R-8) looks through components: a callback prop given to a component, and a component's handler
that reads `props.f`, are checked against what each site passes and what the component's regions show. A click that
reads a list its region never shows (another column's cards, say) is now a compile error instead of a failure thrown
out of the click.

**Fixed**

Expand Down
286 changes: 275 additions & 11 deletions compiler/src/check.rs

Large diffs are not rendered by default.

66 changes: 64 additions & 2 deletions compiler/src/infer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ pub enum Code {
StaleOwnRead,
StaleWriteBack,
StaleCapture,
StaleNextRead,
}
pub struct Finding {
pub code: Code,
Expand Down Expand Up @@ -169,6 +170,21 @@ pub struct RunOpts<'o> {
pub answered: Option<&'o dyn Fn(&str) -> bool>,
/// names of sources and equations in scope
pub stateful: Option<&'o dyn Fn(&str) -> bool>,
/// AC-1h: names of actions in scope whose change can outlast the call
pub is_action: Option<&'o dyn Fn(&str) -> bool>,
}

/// AC-1h: whether an action's change can outlast its call — its body (not a closure's) awaits, re-asks, or declares `affects`.
pub fn action_waits(ss: &[Stmt]) -> bool {
ss.iter().any(|s| {
stmt_await(s)
|| matches!(s.k, StmtKind::Refresh(_) | StmtKind::Affects(_))
|| match &s.k {
StmtKind::Sif { t, f, .. } => action_waits(t) || action_waits(f),
StmtKind::Try { body, handler, fin, .. } => action_waits(body) || handler.as_deref().is_some_and(action_waits) || fin.as_deref().is_some_and(action_waits),
_ => false,
}
})
}

/// keys from the source; "*" a computed key
Expand Down Expand Up @@ -232,8 +248,27 @@ struct Walker<'o> {
inferred: bool,
answered: Option<&'o dyn Fn(&str) -> bool>,
stateful: Option<&'o dyn Fn(&str) -> bool>,
is_action: Option<&'o dyn Fn(&str) -> bool>,
/// AC-1h: plain writes computed from their own source in this change, and the action a plain run's stretch calls
next: Vec<String>,
joins: Option<String>,
local_actions: HashSet<String>,
/// AC-1h: sources this change read plainly (a functional write beside one still leaves that read stale)
seen: HashSet<String>,
}
impl<'o> Walker<'o> {
/// AC-1h: a declared action's body before an `await`, or a plain run's stretch that calls an action by name, is held;
/// an inferred action's are HELD_WRITE already.
fn flush_next(&mut self, held: bool) {
let next = std::mem::take(&mut self.next);
let via = self.joins.take();
self.seen.clear();
if held && !self.inferred {
for n in next {
self.report_via(Code::StaleNextRead, n, via.clone());
}
}
}
fn report(&mut self, code: Code, name: String) {
self.report_via(code, name, None);
}
Expand Down Expand Up @@ -266,8 +301,9 @@ impl<'o> Walker<'o> {
};
if let Some(k) = root {
if st.written.get(&k).is_some_and(|ws| ws.iter().any(|w| overlaps(w, &path))) {
self.report(Code::StaleOwnRead, k);
self.report(Code::StaleOwnRead, k.clone());
}
self.seen.insert(k);
return;
}
if !std::ptr::eq(x, e) {
Expand All @@ -278,6 +314,13 @@ impl<'o> Walker<'o> {
ExprKind::Fn { .. } | ExprKind::ServerFn { .. } | ExprKind::Draft { .. } | ExprKind::Pending(_) | ExprKind::Latest(_) | ExprKind::Lit(_) | ExprKind::Pre { .. } | ExprKind::Peek(_) | ExprKind::StyleMap { .. } => {}
ExprKind::Call { f, args } => {
let c = called_closure(x, local);
if !self.action && c.is_none() && self.joins.is_none() {
if let ExprKind::Id(n) = &f.k {
if (!sh.contains(n) && self.is_action.is_some_and(|a| a(n))) || self.local_actions.contains(n) {
self.joins = Some(n.clone());
}
}
}
for a in args {
self.read(a, st, sh, local, depth);
}
Expand Down Expand Up @@ -447,13 +490,24 @@ impl<'o> Walker<'o> {
for h in std::mem::take(&mut st.held) {
self.report(Code::HeldWrite, h);
}
self.flush_next(true);
} else {
st.written.clear();
let held = self.joins.is_some();
self.flush_next(held);
}
}
if let StmtKind::Let { name, .. } = &s.k {
sh.insert(name.clone());
st.taint.insert(name.clone(), d);
match &e.k {
ExprKind::Fn { stmts: Some(ss), .. } if inferred_action(ss).is_some() => {
self.local_actions.insert(name.clone());
}
_ => {
self.local_actions.remove(name);
}
}
match closure_of(s) {
Some(c) => {
local.insert(name.clone(), c);
Expand Down Expand Up @@ -482,7 +536,11 @@ impl<'o> Walker<'o> {
if d.iter().any(|(dk, dp, ep)| *dk == k && *ep < st.epoch && overlaps(dp, &path)) {
self.report(Code::StaleWriteBack, k.clone());
back = true;
} else if d.iter().any(|(dk, dp, ep)| *dk == k && (self.action || *ep == st.epoch) && overlaps(dp, &path)) {
self.next.push(k.clone());
}
} else if matches!(s.k, StmtKind::Write { .. }) && self.seen.contains(&k) {
self.next.push(k.clone()); // AC-1h: a functional write beside a plain read of its source
}
// AC-1g: the answer takes the server's answer, plain arguments and its own value at the write (the closure's
// argument): a row parameter, a local read from any source (before the `await` or after it), or a source
Expand Down Expand Up @@ -551,7 +609,7 @@ impl<'o> Walker<'o> {
/// its awaits (AC-1); a plain run's change ends at each `await`. `inferred`: an action by AC-1b, the only kind HELD_WRITE
/// applies to. `bound`: the run's parameters. Each finding once per name, in source order.
pub fn run_findings(stmts: &[Stmt], action: bool, bound: &[String], inferred: bool, opts: &RunOpts) -> Vec<Finding> {
let mut w = Walker { out: vec![], said: HashSet::new(), action, inferred, answered: opts.answered, stateful: opts.stateful };
let mut w = Walker { out: vec![], said: HashSet::new(), action, inferred, answered: opts.answered, stateful: opts.stateful, is_action: opts.is_action, next: vec![], joins: None, local_actions: HashSet::new(), seen: HashSet::new() };
let sh: IndexSet<String> = bound.iter().cloned().collect();
let mut taint: IndexMap<String, Vec<Dep>> = IndexMap::new();
for (i, p) in bound.iter().enumerate() {
Expand All @@ -562,5 +620,9 @@ pub fn run_findings(stmts: &[Stmt], action: bool, bound: &[String], inferred: bo
}
}
w.walk(stmts, State { written: IndexMap::new(), held: IndexSet::new(), dead: false, taint, epoch: 0 }, &sh, &IndexMap::new(), &[]);
let held = !action && w.joins.is_some(); // a declared action's writes after its last `await` land as it ends
w.flush_next(held);
let held_writes: HashSet<String> = w.out.iter().filter(|f| f.code == Code::HeldWrite).map(|f| f.name.clone()).collect();
w.out.retain(|f| f.code != Code::StaleNextRead || !held_writes.contains(&f.name));
w.out
}
8 changes: 6 additions & 2 deletions eval/harness/fuzz-board.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ async function session(browser, url, seed, steps, log, others = false) {
const moment = () => { const m = JSON.stringify(COLS.map(col => srv.cols[col].map(c => `${c.id}:${c.title}`).sort())); if (moments[moments.length - 1] !== m) moments.push(m); };
moment();
const ui = { page: "board", selected: null, visit: 0 };
const failedCols = new Set(); // B5: columns whose last answer was a failure, until one lands (a retry re-asks, the error still stands)
const writeVisit = new Map(); // write key -> the visit (board or archive) it was made on
const settledCount = new Map();
let lateVisit = false; // B1
Expand Down Expand Up @@ -202,8 +203,10 @@ async function session(browser, url, seed, steps, log, others = false) {
const x = col && b[col].rows.find(y => y.id === target);
if (x) {
// B5 (Ryan, 2026-11-19): the detail finds its card in every column, so while one of them has failed it may show
// its errored fallback (that it can't show the card now) instead; it must still never name a wrong column or title
const failed = (await Promise.all(COLS.map(cl => exists(`retry-${cl}`)))).some(Boolean);
// its errored fallback (that it can't show the card now) instead; it must still never name a wrong column or title.
// Derived from an error is errored (Ryan, 2026-11-24): that holds until the failed column answers again, also while
// its retry is out
const failed = failedCols.size > 0 || (await Promise.all(COLS.map(cl => exists(`retry-${cl}`)))).some(Boolean);
const wrongCol = COLS.some(cl => cl !== col && detail.includes(`in ${NAME[cl]}`));
if (failed ? wrongCol : !detail.includes(`in ${NAME[col]}`)) note("detail column", `#${x.id} shows in ${NAME[col]}, the detail says "${detail.slice(0, 80)}"`);
if (!detail.includes(`#${x.id} ${x.title}`) && (!failed || detail.includes(`#${x.id} `))) note("two views", `card "${x.text}", detail "${detail.slice(0, 80)}"`);
Expand Down Expand Up @@ -250,6 +253,7 @@ async function session(browser, url, seed, steps, log, others = false) {
if (!a.fail && name === "toggleItem") heldTwice.push(key); // B4
writeVisit.delete(key);
trail.push(`${a.fail ? "fail" : "land"} ${key}`);
{ const fc = key.match(/^fetchCards:(\w+)$/)?.[1]; if (fc) { if (a.fail) failedCols.add(fc); else failedCols.delete(fc); } }
await page.evaluate(([k, a]) => a.fail ? globalThis.__flights.fail(k, "declined") : globalThis.__flights.land(k, a.value), [key, a]);
await settle();
}
Expand Down
56 changes: 56 additions & 0 deletions eval/results/r17-haiku-board-2026-11-24/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# r17: 6 Haiku board apps on the AC-1h guide (2026-11-24)

Six new Haiku board apps, same scaffold as the rerun (`--brief plain --inline-docs`), on the guide with AC-1h
(`STALE_NEXT_READ`), Solid main 30e7805eb. Graded with `harness/grade.sh` (`FUZZ_ROUND=--r15`), fuzz regraded with
B5 widened (a column whose last fetch failed holds the detail's errored fallback until one lands, retry included;
Ryan 2026-11-24). Defects = failed hidden and overlap tests + fuzz seeds with a hole, minus tests whose hold probe
passes and the after-left family.

| app | tests kept | fuzz seeds | defects |
|---|---|---|---|
| 1 | 2 | 8 | 10 |
| 2 | 0 | 4 | 4 |
| 3 | 1 | 0 | 1 |
| 4 | 1 | 2 | 3 |
| 5 | 1 | 5 | 6 |
| 6 | 1 | 1 | 2 |
| mean | | | **4.33** (r16 Haiku board 19.0) |

With the two Solid bugs below fixed: 9, 4, 1, 3, 4, 2 = 3.83. No duplicate-id holes (AC-1h's family) remain.

Hold probes: `holds/` (round 15 probes, the rerun's, and `../rerun-2026-11-23/trace/holds-item-reload.mjs`, new: app 4
holds an item add until its toggle's column re-asks land, which the hidden test never answers; it settles right).

## Every failure, traced

Solid (plain-Solid repros in `repro/`):
- app 5 seeds 8, 17: a row a guess moved renders with no text while later guesses and held writes pile up, so the
heading counts more cards than show (solidjs/solid#5192).
- app 1 seed 6: a guess that makes `For` mount a row reading a memo over a failed `createOptimistic` re-asks that
list and is held until it answers; the move guess doesn't show, and the detail pane tears beside it (id new, title
old) (solidjs/solid#5195).

Ours, fixed here:
- app 1 seed 19, app 6 seed 13 (page error "declined"): a click read a failed list through a component. App 1's
`onMove`, written on the board, read the other columns' lists; app 6's lane handler read `props.lens`, a memo over
all three. R-8 never looked through components. It now does (spec/04-rows.md R-8 "Through components"); app 1 is a
compile error. App 6 is not: its `disabled` reads `props.lens` behind `props.column == "done" && …`, and R-8 counts
any read, guarded or not.
- apps 3, 6 "a move into a column that is still loading": they declare `-> null` and the `[]` stand-in the guide
teaches, so the handler sends index 0 into a column it hasn't seen. Guide (async.md §1): the stand-in is not an
answer; keep a control that computes from the list disabled while it is null.
- apps 2, 4 card counts: the count is set to a number computed from what the screen showed (app 2 from the committed
checklist in the action; app 4 from the handler, then written as truth after the `await`). Guide (async.md §3):
guess a count as a change.

Agent:
- app 1, 6 seeds (4, 8, 11, 15, 18, 20) "detail says loading card": the detail's `loading on(sel)` borrows lists with no `-> v`.
- app 1 "a column's retry shows loading": Done's buttons read `full` over Doing, which never answers in the test, so
Done waits on it (guide §1 says to give the answer a value where it's declared).
- apps 1, 5 "an earlier move declined while a later move is out": app 1 re-asks only the lists the shown move
touched; app 5 never re-asks and writes its own copy of each move into the answer.
- app 5 seeds 11, 12, 18 (settled title, order, archived card): same app 5 shape. A move copies the shown (guessed)
title into the answer; a move's position is the client's, not the server's.
- app 4 seeds 4, 11 (two views): the detail title is copied into a plain source on select, and a rename's guess on it
shows under the next selection.
- app 2 seeds 4, 12, 14 (hang): a guess before the list loaded, through `props.onAdd`; dev throws for it.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
board-rx-haiku-1: 8/20 seeds found a hole
seed 4 step 30: detail column: #3 shows in Doing, the detail says "loading card"
add Alpha 1 ; land fetchCards:todo ; land fetchCards:done ; tab archive ; land fetchArchived: ; tab board ; add Delta 2 ; tab archive ; tab board ; add Delta 3 ; add Bravo 4 ; land fetchCards:todo ; add Delta 5 ; add Bravo 6 ; land fetchCards:done ; add Delta 7 ; tab archive ; land fetchCards:doing ; tab board ; tab archive ; land fetchCards:todo ; tab board ; add Delta 8 ; land fetchCards:doi
seed 6 step 27: two views: card "#1 Write spec · 0/2", detail "#1 Fix loginin To dorenamearchiveloading checklist"
add Bravo 1 ; fail fetchCards:doing ; land fetchCards:done ; land fetchCards:doing ; land fetchCards:todo ; add Bravo 2 ; left #5 ; tab archive ; land fetchArchived: ; tab board ; tab archive ; tab board ; add Alpha 3 ; land fetchCards:done ; add Delta 4 ; tab archive ; tab board ; land fetchCards:done ; land fetchCards:todo ; add Alpha 5 ; land moveCard:5,doing,2 ; fail fetchCards:doing ; lan
seed 8 step 3: detail column: #4 shows in Doing, the detail says "loading card"
land fetchCards:doing ; right #3 ; select #4
seed 11 step 9: detail column: #4 shows in Doing, the detail says "loading card"
add Bravo 1 ; tab archive ; tab board ; add Bravo 2 ; tab archive ; tab board ; add Alpha 3 ; land fetchCards:doing ; select #4
seed 15 step 2: detail column: #4 shows in Doing, the detail says "loading card"
land fetchCards:doing ; select #4
seed 18 step 3: detail column: #3 shows in Doing, the detail says "loading card"
land fetchCards:doing ; land fetchCards:done ; select #3
seed 19 step 30: page error: declined
land fetchCards:todo ; tab archive ; land fetchCards:done ; tab board ; land fetchArchived: ; fail fetchCards:todo ; land fetchCards:done ; add Alpha 1 ; land fetchCards:doing ; left #4 ; add Alpha 2 ; tab archive ; tab board ; land fetchCards:todo ; add Alpha 3 ; tab archive ; tab board ; land fetchCards:doing ; land fetchCards:done ; tab archive ; tab board ; land fetchCards:doing ; add Alph
seed 20 step 4: detail column: #3 shows in Doing, the detail says "loading card"
add Bravo 1 ; land fetchCards:doing ; add Bravo 2 ; select #3
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
== hidden
✗ a column's retry shows loading, then the cards
44/45 passed
== overlap
✗ an earlier move declined while a later move of the card is out leaves it where the later one put it
✗ one of two moves declined puts back only its card
✗ a toggle and an item add out together: the progress and the card's count agree
✗ a toggle declined after another card was selected puts the first card's count back
✗ a rename and a move out together, the move declined: the card goes back with its new title
✗ a declined archive of a card whose rename is out brings it back with the new title
✗ a move into Doing that fills it while a move out is pending disables the rest
19/26 passed
== fuzz
board-rx-haiku-1: 10/20 seeds found a hole
seed 2 step 29: detail column: #3 shows in Done, the detail says "loading card"
add Alpha 1 ; tab archive ; tab board ; land fetchArchived: ; add Bravo 2 ; add Alpha 3 ; add Delta 4 ; fail fetchCards:done ; fail fetchCards:todo ; retry-done ; tab archive ; land fetchCards:done ; fail fetchArchived: ; land fetchCards:doing ; tab board ; add Delta 5 ; add Delta 6 ; land fetchCards:done ; add Delta 7 ; land fetchCards:doing ; right #3 ; land moveCard:3,done,1 ; down #5 ; lef
seed 4 step 30: detail column: #3 shows in Doing, the detail says "loading card"
add Alpha 1 ; land fetchCards:todo ; land fetchCards:done ; tab archive ; land fetchArchived: ; tab board ; add Delta 2 ; tab archive ; tab board ; add Delta 3 ; add Bravo 4 ; land fetchCards:todo ; add Delta 5 ; add Bravo 6 ; land fetchCards:done ; add Delta 7 ; tab archive ; land fetchCards:doing ; tab board ; tab archive ; land fetchCards:todo ; tab board ; add Delta 8 ; land fetchCards:doi
seed 6 step 27: two views: card "#1 Write spec · 0/2", detail "#1 Fix loginin To dorenamearchiveloading checklist"
add Bravo 1 ; fail fetchCards:doing ; land fetchCards:done ; land fetchCards:doing ; land fetchCards:todo ; add Bravo 2 ; left #5 ; tab archive ; land fetchArchived: ; tab board ; tab archive ; tab board ; add Alpha 3 ; land fetchCards:done ; add Delta 4 ; tab archive ; tab board ; land fetchCards:done ; land fetchCards:todo ; add Alpha 5 ; land moveCard:5,doing,2 ; fail fetchCards:doing ; lan
seed 8 step 3: detail column: #4 shows in Doing, the detail says "loading card"
land fetchCards:doing ; right #3 ; select #4
seed 11 step 9: detail column: #4 shows in Doing, the detail says "loading card"
add Bravo 1 ; tab archive ; tab board ; add Bravo 2 ; tab archive ; tab board ; add Alpha 3 ; land fetchCards:doing ; select #4
seed 13 step 7: detail column: #4 shows in Doing, the detail says "loading card"
add Alpha 1 ; fail fetchCards:todo ; land fetchCards:doing ; retry-todo ; left #3 ; right #4 ; select #4
seed 15 step 2: detail column: #4 shows in Doing, the detail says "loading card"
land fetchCards:doing ; select #4
seed 18 step 3: detail column: #3 shows in Doing, the detail says "loading card"
land fetchCards:doing ; land fetchCards:done ; select #3
seed 19 step 30: page error: declined
land fetchCards:todo ; tab archive ; land fetchCards:done ; tab board ; land fetchArchived: ; fail fetchCards:todo ; land fetchCards:done ; add Alpha 1 ; land fetchCards:doing ; left #4 ; add Alpha 2 ; tab archive ; tab board ; land fetchCards:todo ; add Alpha 3 ; tab archive ; tab board ; land fetchCards:doing ; land fetchCards:done ; tab archive ; tab board ; land fetchCards:doing ; add Alph
seed 20 step 4: detail column: #3 shows in Doing, the detail says "loading card"
add Bravo 1 ; land fetchCards:doing ; add Bravo 2 ; select #3
Loading
Loading