diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index db4b83879e4..d51249f4246 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -34,7 +34,7 @@ jobs: - name: Typecheck (TypeScript 7.1) run: bun run typecheck:tsc - # Every GUI package file (app, desktop, gui-extensions, ui, session-ui) a pull request adds or edits must be free of + # Every GUI package file (app, desktop, gui-plugins, the plugin package's GUI SDK, ui, session-ui) a pull request adds or edits must be free of # oxlint problems, warn-level rules (anti-slop) included. Other packages are not affected. - name: Lint changed files if: github.event_name == 'pull_request' diff --git a/.opencode/skills/app-e2e-tests/SKILL.md b/.opencode/skills/app-e2e-tests/SKILL.md index 4a63ca2f45f..2630c24a58f 100644 --- a/.opencode/skills/app-e2e-tests/SKILL.md +++ b/.opencode/skills/app-e2e-tests/SKILL.md @@ -77,7 +77,7 @@ Most of these rarely reproduce on an idle local machine. - **Use the harness's signals.** `holdRoute(...).arrived` resolves when the request reaches the route, and `transport.send` resolves after delivery. `setupTimeline(...).waitForPart` resolves once a part renders (`timeline.ts:328`). - **Decide which side is wrong.** Three of eight investigated e2e flakes were product bugs, each since fixed in the product: - a stale scroll offset restored when a scroll settles (`src/session/timeline/observe-element-offset.ts`); - - a video double-click that also entered native fullscreen (`packages/gui-extensions/src/file/artifact-view.tsx:617`); + - a video double-click that also entered native fullscreen (`packages/gui-plugins/src/file/artifact-view.tsx:612`); - shortcuts dropped while a dialog closed. If a user could hit the interleaving, fix the product and keep the assertion. diff --git a/.opencode/skills/component-tests/SKILL.md b/.opencode/skills/component-tests/SKILL.md index 032b7d225ed..530a6166856 100644 --- a/.opencode/skills/component-tests/SKILL.md +++ b/.opencode/skills/component-tests/SKILL.md @@ -1,6 +1,6 @@ --- name: component-tests -description: Use when writing, changing, debugging, or reviewing the Playwright component tests that mount stories. That covers specs in packages/app/component-tests or packages/session-ui/component-tests, `*.fixture.tsx` files there or beside source (such as packages/gui-extensions/src/browser/panel.fixture.tsx), the stories they mount, and the shared harness in packages/stories (playwright/config.ts, playwright/story.ts, vite.config.ts, src/frame.tsx, src/index-plugin.ts, mocks). Also use when a component test is flaky, passed on retry, or fails with "Execution context was destroyed", "Failed to fetch dynamically imported module", or `#story-root` hidden. Covers mount args, source modules imported by URL, Vite dependency pre-bundling and reloads, a cold vs warm story server, mobile drawers, geometry, and checks before pushing. +description: Use when writing, changing, debugging, or reviewing the Playwright component tests that mount stories. That covers specs in packages/app/component-tests or packages/session-ui/component-tests, `*.fixture.tsx` files there or beside source (such as packages/gui-plugins/src/browser/panel.fixture.tsx), the stories they mount, and the shared harness in packages/stories (playwright/config.ts, playwright/story.ts, vite.config.ts, src/frame.tsx, src/index-plugin.ts, mocks). Also use when a component test is flaky, passed on retry, or fails with "Execution context was destroyed", "Failed to fetch dynamically imported module", or `#story-root` hidden. Covers mount args, source modules imported by URL, Vite dependency pre-bundling and reloads, a cold vs warm story server, mobile drawers, geometry, and checks before pushing. --- # Component tests @@ -15,7 +15,7 @@ Read these first rather than repeating them: ## Stories and `mount` -- **Location.** Put the story next to the production component under `src/` of `ui`, `session-ui`, `app` or `gui-extensions`. The story server indexes `*.stories.tsx` files in those four trees (`packages/stories/vite.config.ts`, `src/index-plugin.ts`), reading each file's `export default { title, id }` and its `export const` stories from source. +- **Location.** Put the story next to the production component under `src/` of `ui`, `session-ui`, `app` or `gui-plugins`. The story server indexes `*.stories.tsx` files in those four trees (`packages/stories/vite.config.ts`, `src/index-plugin.ts`), reading each file's `export default { title, id }` and its `export const` stories from source. - **Story ID.** It is the meta `id` if one is set (`packages/session-ui/src/components/session-review.stories.tsx:25`). Otherwise it is the kebab-cased `title`, then `--`, then the kebab-cased export. Check it at `http://127.0.0.1:6006/?id=` on a running story server (`bun --cwd packages/stories dev`). A wrong ID renders nothing (the page throws `No story has the id …`), so `mount` waits out its full 30 s root wait (`story.ts:39`) and then fails. - **URL args.** `mount(id, { args, globals })` writes them into the URL as `key:value` pairs (`story.ts:20-36`). The frame reads every one: a value becomes a boolean or number when the story's own default for that key is one, `!true`/`!false`/`!null`/`!undefined` keep Storybook's meaning, and anything else stays text. - Give every arg a typed default. With `args: { split: false }` (`session-review.stories.tsx:129`), `split:false` arrives as a boolean. @@ -29,7 +29,7 @@ Read these first rather than repeating them: Use these when the contract is not visible in a story, such as construction counts, unmount races or cache state. -- **Fixture file.** Put a `*.fixture.tsx` file in `component-tests/` or beside the source it drives (`packages/gui-extensions/src/browser/panel.fixture.tsx`). It exports a `mountX()` that renders into a host with a `data-testid` (`packages/session-ui/component-tests/basic-tool.fixture.tsx:7-46`). Never end the name in `.spec` or `.test`. +- **Fixture file.** Put a `*.fixture.tsx` file in `component-tests/` or beside the source it drives (`packages/gui-plugins/src/browser/panel.fixture.tsx`). It exports a `mountX()` that renders into a host with a `data-testid` (`packages/session-ui/component-tests/basic-tool.fixture.tsx:7-46`). Never end the name in `.spec` or `.test`. - **Mount it in three steps.** 1. Mount a light story first, so that the app styles load. 2. Import the fixture and call it inside `page.evaluate`. @@ -40,7 +40,7 @@ Use these when the contract is not visible in a story, such as construction coun - **Module URLs.** Build each one with `sourceURL(new URL("", import.meta.url))` (`story.ts:10`), written as a string literal in the spec (`browser-pane-restore.spec.ts:6-24`). Any other spelling either fails to load or loads a second module instance whose contexts the page never provides; a hand-written `/@fs//...` is the documented second-instance case (`story.ts:6-9`). The literal also matters for pre-bundling (next section). - **Aliases.** A module imported by URL is the real file. App code that reaches the same module through a `vite.config.ts` alias gets the mock (`browser-pane-restore.spec.ts:95-96`). Decide which of the two the contract needs. - **Spec imports.** Import source modules into the spec with `import type` only (`browser-pane-restore.spec.ts:2-4`). A value import runs browser code in the Node runner. -- **Async order.** Let the test decide the order through deferreds the fixture exposes (`mountExtensionHost`, `packages/app/component-tests/extension-host.fixture.tsx:135`). Await the outcome they lead to (`extension-host.spec.ts:46-77`), or poll in-page state with `until` (`extension-host.fixture.tsx:124-132`). Do not copy the fixed in-page `setTimeout` waits that other cases in `extension-host.spec.ts` (`:38`, `:88-90`, `:108-119`) use to prove a negative. +- **Async order.** Let the test decide the order through deferreds the fixture exposes (`mountPluginHost`, `packages/app/component-tests/plugin-host.fixture.tsx:151`). Await the outcome they lead to (`plugin-host.spec.ts:38-69`), or poll in-page state with `until` (`plugin-host.fixture.tsx:141-148`). Do not copy the fixed in-page `setTimeout` waits that other cases in `plugin-host.spec.ts` (`:30`, `:80-82`, `:100-111`) use to prove a negative. ## Vite pre-bundling and reloads @@ -102,7 +102,7 @@ From the owning package (`packages/session-ui` or `packages/app`): - Do not skip on Windows, and do not raise `config.ts` timeouts, retries or the `mount` wait. - If one test does genuinely expensive work, call `story.setTimeout(...)` in that test, with a comment that names the work. 6. **Confirm CI ran the component legs.** E2E never runs on pushes to dev (`check-test.yml:28`), so no post-merge run catches a regression. - - The `affected` gate filters on `@opencode/app` and `@opencode/stories` (`check-test.yml:60-61`). `ui`, `session-ui` and `gui-extensions` count through app's dependencies. `workflow_dispatch` forces the legs on (`check-test.yml:56-59`). + - The `affected` gate filters on `@opencode/app` and `@opencode/stories` (`check-test.yml:60-61`). `ui`, `session-ui` and `gui-plugins` count through app's dependencies. `workflow_dispatch` forces the legs on (`check-test.yml:56-59`). - `check-test.yml` is listed in `globalDependencies` (`turbo.json:8`), so editing it marks every package affected. - The required `e2e (linux)` and `e2e (windows)` checks also pass when no leg was needed (`check-test.yml:329-352`). Look for `e2e (, session-ui-components)` and `e2e (, app-components)`. - If CI skipped them, report your local cold run in the PR. diff --git a/.opencode/skills/opencode-dev/SKILL.md b/.opencode/skills/opencode-dev/SKILL.md index 5d53c6b2921..31cb2a3c5a2 100644 --- a/.opencode/skills/opencode-dev/SKILL.md +++ b/.opencode/skills/opencode-dev/SKILL.md @@ -132,7 +132,7 @@ opencode debug heap-dump It discovers the already-running service (never starts or replaces one), calls `POST /api/debug/heap-dump`, waits until the file is complete, and prints its server-local path. Pass `--server ` (with `OPENCODE_PASSWORD`) for a server started with `serve`, and `--directory ` to write somewhere other than the server's log directory (the server creates it; a server that predates the option ignores it and the CLI warns). A 404 means the running server predates the endpoint. -For desktop memory, run **Capture heap snapshots** from the desktop command palette (`packages/gui-extensions/src/debug/main.ts`). It writes `~/Downloads/opencode-heap-