[2.0 / main] Store lane derivations staged per key: 8 undefined, torn or stuck row repros share one branch
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, react, typescript
Hướng nghiên cứu
Start by reading packages/signals/src/store/store.ts at holdWithDerive (lines 1998–2010) and the pinned tests listed in the issue; the issue names packages/web/test/store-lane-staging.spec.tsx for repros W and L6. First establish the intended rule for staging a store target's lane derivation, since the issue describes this as an unresolved design question. Done means the eight repros pass while the listed regression tests remain passing.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
On main at 99db9bce4, one branch in holdWithDerive (store.ts#L1998-L2010) is behind 8 fuzz repros of undefined, duplicate, torn and stuck store rows under actions. When a pass is lane work, this branch stages a store property's write in the lane, one key at a time. Disabling the branch fixes all 8 and fails 16 pinned tests. A probe that removes it is not a fix, but it shows the 8 share one mechanism, and that settling it needs a ruling: should a store target's lane derivation be staged as one unit or per key?
What goes wrong. When a projection or derived store re-derives as lane work, each key it writes is listed on the lane and marked CONFIG_OVERRIDE on its own. Keys the lane pass does not reach keep the committed value. The same target can then hold lane values and committed values side by side, so readers see a mix that no single answer produced. The rows below are that mix, seen from different readers.
Symptoms (each repro exits 1 on main and 0 with the branch disabled)
| repro | what the screen shows |
|---|---|
| W | One projection field shows two values in one frame: [p=G] [p=o:0]. The reader outside a <Show> that the held write is closing sees the guess; the reader inside sees the old answer. A createMemo in place of the projection shows [p=G] [p=G]. |
| L6 | <For> over a keyed createProjection of a filtered createOptimisticStore runs a row whose item is undefined (Cannot read properties of undefined (reading 'id')), and reactivity halts. Steps: toggle a row out of the filter (guess), delete it in another action and refresh, then the list lands without it. |
| R5, R11 | Board shape: two keyed optimistic stores, rows moved between them, and a keyed projection over one. The projection's mapArray runs an undefined row when an answer lands (R5 after a rejected move, R11 after a path guess on a moved row). |
| R8 | Same board shape. An event handler's untracked todo.some(r => r.id === 3) throws after a reverse, a rename and a toggle. |
| R4L-2 | A row moved out and back, where the second move writes the answer signals instead of calling refresh(). Both stores stay isPending() === true forever, and a later delete is lost. |
| R4L-6 | Three stores with rows lent between them. One store never shows its own landed row, and two stay isPending() after a final refresh. |
| R4L-9 | createStore(fn) over a keyed optimistic store reads 3d'2,3d'2 (row 3 twice, row 4 gone) until the last re-ask lands. |
W and L6 are web specs with compiled JSX (below). The other six use only solid-js primitives (createOptimisticStore, createProjection, createStore(fn), mapArray, action, refresh), with no renderer. I can attach them if useful.
Probe: false && in front of the laneStageHook && lane !== null && ... condition. All 8 repros flip to passing. packages/signals goes from 7242 passed to 16 failed and 7226 passed:
derived-store-lane-derive.test.ts: store: a derive over latest() shows the action's value nowprojection-lane-length-4631.test.ts(#4631): both "declined first" casesprojection-second-guess-4629.test.ts(#4629): the three "through a keyed projection" casesshow-stale-child-in-action-4137.test.ts(#4137): a derived record drops the action's row while the list keeps itstore/derived-store-heal-4451.test.ts(#4451): three casesswitch-under-guess-holds.test.ts: "fetch read first, through a projection", in all four build modesunread-derive-midflight-mount-4491.test.ts(#4491): storeJSON and storeKeys as the memo form
Those tests pin the reason the branch exists. A display-ahead read of a projection is lane work, and its value should be the lane's derivation, as a memo's would be (D-25). The 8 repros are what happens when only some keys of the target take that path.
Question: should a lane derivation of a store target be staged and committed as one unit, so all of its keys come from one pass? Or is per-key staging intended, with the readers (mapArray, For, some, createStore(fn)) expected to cope with a mixed target? Either answer would let the 8 be fixed against a rule.
spec (W and L6), as packages/web/test/store-lane-staging.spec.tsx
/**
* @jsxImportSource @solidjs/web
* @vitest-environment jsdom
*/
import { expect, test } from "vitest";
import {
For,
Loading,
Show,
action,
createDeferred,
createMemo,
createOptimistic,
createOptimisticStore,
createProjection,
createSignal,
flush,
latest,
refresh,
untrack
} from "solid-js";
import { render } from "../src/index.js";
process.on("unhandledRejection", () => {});
const tick = async () => {
for (let i = 0; i < 4; i++) {
await new Promise(r => setTimeout(r, 0));
flush();
}
};
function desk() {
const asks: { key: string; res: (v: any) => void }[] = [];
const ask = (key: string) => new Promise<any>(res => asks.push({ key, res }));
const land = async (key: string, v: any = key) => {
const i = asks.findIndex(a => a.key === key);
if (i < 0) throw new Error(`no ask ${key}; open: ${asks.map(a => a.key)}`);
asks.splice(i, 1)[0].res(v);
await tick();
};
const drain = async () => {
for (let n = 0; n < 30 && asks.length; n++) {
for (const a of asks.splice(0)) a.res(a.key);
await tick();
}
};
return { ask, land, drain, open: () => asks.map(a => a.key).join(",") };
}
function mount(view: () => any) {
const container = document.body.appendChild(document.createElement("div"));
const dispose = render(view, container);
return {
frame: () => container.textContent!.replace(/\s+/g, " ").trim(),
dispose: () => (dispose(), container.remove())
};
}
test("W: one projection field shows one value in a frame, inside and outside a closing <Show>", async () => {
const d = desk();
let act!: (x: number) => void;
const app = mount(() => {
const [s, setS] = createSignal(0);
const [o, setO] = createOptimistic(() => d.ask("o:" + s()));
const p = createProjection<{ n: any }>(draft => void (draft.n = o()), { n: 0 });
act = action(function* (x: number) {
setS(x);
setO("G");
yield d.ask("save");
});
return (
<div>
[p={p.n}]{" "}
<Show when={s() < 2}>
<span>[p={p.n}]</span>
</Show>
</div>
);
});
flush();
await tick();
await d.drain();
act(2);
flush();
await tick();
const mid = app.frame();
await d.drain();
app.dispose();
expect(new Set([...mid.matchAll(/\[p=([^\]]*)\]/g)].map(m => m[1])).size, mid).toBe(1);
});
test("L6: <For> over a keyed projection of an optimistic list does not read an undefined row", async () => {
const d = desk();
const errors: string[] = [];
const origError = console.error;
console.error = (...a: any[]) => void errors.push(String(a[0]) + " " + String(a[1]?.message ?? ""));
let tog!: (i: number, v: boolean) => void, del!: (id: number) => void;
const app = mount(() => {
const [rows, setRows] = createOptimisticStore<{ id: number; t: string; d: boolean }[]>(
() => d.ask("list"),
[],
{ key: "id" }
);
const openList = createMemo(() => rows.filter(x => !x.d));
const open = createProjection(() => openList(), [], { key: "id" });
tog = action(function* (i: number, v: boolean) {
setRows(dr => void (dr[i].d = v));
yield d.ask("tog");
});
del = action(function* () {
yield d.ask("del");
refresh(rows);
});
return (
<Loading fallback="loading">
<p>
open:<For each={open}>{y => <i><{y.id}{y.t}></i>}</For>
</p>
</Loading>
);
});
flush();
await tick();
await d.land("list", [{ id: 1, t: "c", d: false }]);
tog(0, true);
await tick();
del(1);
await tick();
await d.land("del", 0);
const got = app.frame();
await d.land("list", []);
await d.land("tog", 0);
const end = app.frame();
app.dispose();
console.error = origError;
expect({ got, end, errors }).toEqual({ got: expect.not.stringContaining("undefined"), end: "open:", errors: [] });
});
How it was found: differential fuzzing of Solid against the ReactiveScript spec interpreter. The 8 repros came from separate rounds and were grouped by probing each candidate branch against every open repro and the signals suite.
- Ngôn ngữ chính
- TypeScript
- Star
- 37k
- Fork
- 1.2k
- Merge trung bình
- 8 giờ 43 phút
- Pull request đã merge (30 ngày)
- 365
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của solidjs/solid
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[2.0.4] Nested `<Errored>`: the outer boundary stays on an error the inner one rethrew, after the next error is one the inner one handlesCó thể đã có người làm @MilindChatrabhuji đã nhận 2 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của solidjs/solid
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
activepieces/activepieces#17974 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
OHDSI/Data2Evidence#3777 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
bug enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
AOSSIE-Org/PictoPy#1802 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Termix-SSH/Plugin-Snippets#26 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent-reported bug from-app needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
nightly-labs/openbot#20504 ·
Maintainer thường phản hồi trong vòng 1 ngày