Grilling: test strategy, runtime checks and CI #8

Closed
opened 2026-10-03 16:22:30 +00:00 by haylan · 1 comment
Owner

Map: #1

Question

Decide how the plugin is verified: unit tests against a mocked fastCRW (framework choice), where and how the three runtime checks run (built-in provider removal, throwing setup, websearch.provider vs editor.default.set precedence, plus install-by-name from the Gitea registry), and the PR check workflow (npm run check + tests) on Gitea Actions. The release workflow itself is already decided.

Map: #1 ## Question Decide how the plugin is verified: unit tests against a mocked fastCRW (framework choice), where and how the three runtime checks run (built-in provider removal, throwing `setup`, `websearch.provider` vs `editor.default.set` precedence, plus install-by-name from the Gitea registry), and the PR check workflow (`npm run check` + tests) on Gitea Actions. The release workflow itself is already decided.
haylan added the wayfinder:grilling label 2026-10-03 16:22:30 +00:00
haylan self-assigned this 2026-10-03 16:46:58 +00:00
Author
Owner

Resolved with the user (all recommendations accepted; runner label ubuntu-latest).

  • Framework: built-in node --test over test/*.test.ts (Node 24 native type stripping; needs Node >=22.18 in dev/CI). No framework dependency. Plugin engines.node >=20 unaffected.
  • Layout: src/config.ts (resolve/validate options + env), src/search.ts (request, mapping, errors; fetch as a parameter), src/index.ts (Plugin.define wiring only).
  • Unit tests (mocked fetch, no HTTP server): precedence options > env > default; each validation throw; limit clamp/fallback; request body/headers (Bearer only when a key exists, lang/tbs omitted when unset); both response shapes; every error path from the result-mapping ticket; abort passthrough; the 30 s timeout.
  • Runtime checks (manual, once, real opencode v2): (1) built-in providers removable/disableable, (2) throwing setup disables only this plugin, (3) config websearch.provider vs editor.default.set precedence, (4) install-by-name from the Gitea registry with a scoped .npmrc. Results and opencode version recorded in docs/runtime-checks.md. A failed check reopens the design via a new ticket on this map.
  • Smoke test: npm run smoke runs one real search using CRW_API_URL/CRW_API_KEY, prints shape and results; manual, never in CI. First run records the real response shape (data[] vs data.results) in docs/runtime-checks.md.
  • PR workflow: .gitea/workflows/check.yml on pull_request to main, runner ubuntu-latest, Node 24: npm ci, npm run check, npm test, npm run build. The workflow's status is then added as a required check on main.
  • Pre-commit hooks: none; CI enforces formatting, types and tests.
Resolved with the user (all recommendations accepted; runner label `ubuntu-latest`). - **Framework:** built-in `node --test` over `test/*.test.ts` (Node 24 native type stripping; needs Node >=22.18 in dev/CI). No framework dependency. Plugin `engines.node >=20` unaffected. - **Layout:** `src/config.ts` (resolve/validate options + env), `src/search.ts` (request, mapping, errors; `fetch` as a parameter), `src/index.ts` (`Plugin.define` wiring only). - **Unit tests (mocked `fetch`, no HTTP server):** precedence options > env > default; each validation throw; `limit` clamp/fallback; request body/headers (Bearer only when a key exists, `lang`/`tbs` omitted when unset); both response shapes; every error path from the result-mapping ticket; abort passthrough; the 30 s timeout. - **Runtime checks (manual, once, real opencode v2):** (1) built-in providers removable/disableable, (2) throwing `setup` disables only this plugin, (3) config `websearch.provider` vs `editor.default.set` precedence, (4) install-by-name from the Gitea registry with a scoped `.npmrc`. Results and opencode version recorded in `docs/runtime-checks.md`. A failed check reopens the design via a new ticket on this map. - **Smoke test:** `npm run smoke` runs one real search using `CRW_API_URL`/`CRW_API_KEY`, prints shape and results; manual, never in CI. First run records the real response shape (`data[]` vs `data.results`) in `docs/runtime-checks.md`. - **PR workflow:** `.gitea/workflows/check.yml` on `pull_request` to `main`, runner `ubuntu-latest`, Node 24: `npm ci`, `npm run check`, `npm test`, `npm run build`. The workflow's status is then added as a required check on `main`. - **Pre-commit hooks:** none; CI enforces formatting, types and tests.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: haylan/fastcrw-opencode-websearch#8