Potion Yjs Dev Browser Test
Purpose
Use Potion as a live behavioral oracle, not as the product under test. The skill records how to isolate one Potion tab offline with dev-browser and then replay the current bug's repro steps. Do not bake one historical repro into the workflow.
Workflow
- Confirm the user is logged in to the persistent debug Chrome connected at
127.0.0.1:9222.
- Use the existing debug browser, never a disposable browser, unless the user explicitly asks.
- Use a disposable or agreed Potion document. Only reset or overwrite content when the current repro requires it.
- Open two named pages, usually
potion-yjs-reference-a and potion-yjs-reference-b, pointing at the same Potion URL.
- Use per-page CDP to make only B offline. Never use
page.context().setOffline(true) for this workflow; it affects the whole browser context and usually disconnects both tabs.
- Execute the current repro steps exactly:
- B-only local edits while B is offline
- A-side online edits while A remains connected
- B reconnect
- observe final convergence, selection, history, or presence state
- Compare the observed Potion result with the local Slate Yjs result. Treat Potion as reference evidence, not automatic proof; confirm the local schema and operation shape are equivalent.
No Bundled Script
Do not keep a reusable script in this skill. Each collaboration bug has different setup, operations, waits, and assertions. A fixed script becomes stale fast and tempts agents to rerun yesterday's bug.
For each new case, write a small one-off dev-browser --connect http://127.0.0.1:9222 <<'EOF' script from the current repro steps. Keep it in the terminal or .tmp/ only if it needs iteration; do not promote it into the skill unless the user explicitly asks for a durable tool.
Per-Page CDP Pattern
Use this shape inside the current repro script:
const pageA = await browser.getPage('potion-yjs-reference-a');
const pageB = await browser.getPage('potion-yjs-reference-b');
const cdpB = await pageB.context().newCDPSession(pageB);
await cdpB.send('Network.enable');
await cdpB.send('Network.emulateNetworkConditions', {
offline: true,
latency: 0,
downloadThroughput: 0,
uploadThroughput: 0,
});
// Run B-local offline repro steps here.
await cdpB.send('Network.emulateNetworkConditions', {
offline: false,
latency: 0,
downloadThroughput: -1,
uploadThroughput: -1,
});
Before editing, probe network isolation:
- A fetch should succeed.
- B fetch should fail while offline.
One-Off Repro Template
For each new case, write a small dev-browser script from the user's steps:
- Open both Potion pages and wait for
[data-slate-editor="true"].
- Prepare only the starting document state required by this repro.
- Put B offline with per-page CDP.
- Perform the B-side offline operation.
- Perform the A-side online operation.
- Reconnect B.
- Read the document state from both pages and log the result.
- Restore B online and detach CDP sessions before exiting.
Interpretation
- If Potion preserves content or history that local Slate Yjs loses, treat the local behavior as suspicious.
- If Potion produces the same result as local Slate Yjs, treat that conflict behavior as plausible, then verify the local operation sequence really matches Potion.
- If Potion and local differ, do not jump straight to a fix. First compare editor schema, normalization, command path, selection shape, and operation ordering.
Failure Handling
- If no editor is found, stop and ask the user to log in to Potion in the debug Chrome.
- If the Potion page says the document does not exist, stop and ask for a valid shared document URL.
- If navigation is interrupted, force both pages online with CDP and retry once.
- If a live observed run times out, keep the current tab state and resume from the printed step instead of restarting blindly.
1---2name: potion-yjs-dev-browser-test3description: Use when a Slate Yjs collaboration behavior is suspicious and Potion should be used as a live reference implementation through dev-browser, especially for offline/reconnect, selection, or history scenarios.4---56# Potion Yjs Dev Browser Test78## Purpose910Use Potion as a live behavioral oracle, not as the product under test. The skill records how to isolate one Potion tab offline with dev-browser and then replay the current bug's repro steps. Do not bake one historical repro into the workflow.1112## Workflow13141. Confirm the user is logged in to the persistent debug Chrome connected at `127.0.0.1:9222`.152. Use the existing debug browser, never a disposable browser, unless the user explicitly asks.163. Use a disposable or agreed Potion document. Only reset or overwrite content when the current repro requires it.174. Open two named pages, usually `potion-yjs-reference-a` and `potion-yjs-reference-b`, pointing at the same Potion URL.185. Use per-page CDP to make only B offline. Never use `page.context().setOffline(true)` for this workflow; it affects the whole browser context and usually disconnects both tabs.196. Execute the current repro steps exactly:20 - B-only local edits while B is offline21 - A-side online edits while A remains connected22 - B reconnect23 - observe final convergence, selection, history, or presence state247. Compare the observed Potion result with the local Slate Yjs result. Treat Potion as reference evidence, not automatic proof; confirm the local schema and operation shape are equivalent.2526## No Bundled Script2728Do not keep a reusable script in this skill. Each collaboration bug has different setup, operations, waits, and assertions. A fixed script becomes stale fast and tempts agents to rerun yesterday's bug.2930For each new case, write a small one-off `dev-browser --connect http://127.0.0.1:9222 <<'EOF'` script from the current repro steps. Keep it in the terminal or `.tmp/` only if it needs iteration; do not promote it into the skill unless the user explicitly asks for a durable tool.3132## Per-Page CDP Pattern3334Use this shape inside the current repro script:3536```js37const pageA = await browser.getPage('potion-yjs-reference-a');38const pageB = await browser.getPage('potion-yjs-reference-b');39const cdpB = await pageB.context().newCDPSession(pageB);4041await cdpB.send('Network.enable');42await cdpB.send('Network.emulateNetworkConditions', {43 offline: true,44 latency: 0,45 downloadThroughput: 0,46 uploadThroughput: 0,47});4849// Run B-local offline repro steps here.5051await cdpB.send('Network.emulateNetworkConditions', {52 offline: false,53 latency: 0,54 downloadThroughput: -1,55 uploadThroughput: -1,56});57```5859Before editing, probe network isolation:6061- A fetch should succeed.62- B fetch should fail while offline.6364## One-Off Repro Template6566For each new case, write a small dev-browser script from the user's steps:67681. Open both Potion pages and wait for `[data-slate-editor="true"]`.692. Prepare only the starting document state required by this repro.703. Put B offline with per-page CDP.714. Perform the B-side offline operation.725. Perform the A-side online operation.736. Reconnect B.747. Read the document state from both pages and log the result.758. Restore B online and detach CDP sessions before exiting.7677## Interpretation7879- If Potion preserves content or history that local Slate Yjs loses, treat the local behavior as suspicious.80- If Potion produces the same result as local Slate Yjs, treat that conflict behavior as plausible, then verify the local operation sequence really matches Potion.81- If Potion and local differ, do not jump straight to a fix. First compare editor schema, normalization, command path, selection shape, and operation ordering.8283## Failure Handling8485- If no editor is found, stop and ask the user to log in to Potion in the debug Chrome.86- If the Potion page says the document does not exist, stop and ask for a valid shared document URL.87- If navigation is interrupted, force both pages online with CDP and retry once.88- If a live observed run times out, keep the current tab state and resume from the printed step instead of restarting blindly.