Skip to content

Add regression tests for zod 3/4 logger schema + GitHub Actions CI#19

Merged
ben-vargas merged 2 commits into
ben-vargas:ai-sdk-v5from
bjcoombs:tests-and-ci
Apr 14, 2026
Merged

Add regression tests for zod 3/4 logger schema + GitHub Actions CI#19
ben-vargas merged 2 commits into
ben-vargas:ai-sdk-v5from
bjcoombs:tests-and-ci

Conversation

@bjcoombs

Copy link
Copy Markdown

Summary

Follow-up to #18 (merged as v0.0.3). Two additions that didn't land in time:

  1. Regression tests for the logger schema across zod 3 and zod 4, covering the code paths that were broken in v0.0.2 (ai-sdk-v5 tag): z.function().args() incompatible with zod 4 #17.
  2. GitHub Actions CI workflow - this repo has no CI today, so issues like v0.0.2 (ai-sdk-v5 tag): z.function().args() incompatible with zod 4 #17 only surface at consumer install time.

Changes

`src/validation.test.ts` - 6 new tests

Exercise the `settings.logger` validation path (previously uncovered) to lock in zod 3/4 compatibility:

  • Valid logger with `warn` + `error` accepted
  • Valid logger with optional `debug` accepted
  • `logger: false` (disable logging) accepted
  • Logger with non-function `warn` rejected
  • Logger with missing `error` rejected
  • Nested logger under `defaultSettings` validated through the provider schema

`.github/workflows/ci.yml`

Minimal CI workflow running on push/PR to `main` and `ai-sdk-v5`:

  • Matrix tests against `zod@^3.24.0` and `zod@^4.1.0` (the declared peer range)
  • Steps: `npm ci` → swap zod version → typecheck → lint (non-blocking) → build → vitest → import smoke test
  • The final step (`require('./dist/index.cjs').createOpencode({})`) is specifically what would have caught v0.0.2 (ai-sdk-v5 tag): z.function().args() incompatible with zod 4 #17

Testing

Risk

  • None for the tests - pure additions
  • CI workflow: no existing workflow to conflict with. Lint step is `continue-on-error: true` to avoid blocking on style issues I haven't audited.

Test plan

  • Tests pass under zod 3
  • Tests pass under zod 4
  • Full suite (275 tests) green
  • CI run on this PR validates the matrix

Six new tests covering the logger validation path that was broken by
the z.function(...).args() call removed in zod 4:

- valid logger with warn + error functions accepted
- valid logger with optional debug function accepted
- logger === false accepted (disables logging)
- logger with non-function warn rejected
- logger with missing error rejected
- nested logger under defaultSettings in provider schema validated

All 275 tests pass under both zod ^3.24 and zod ^4.1.
No CI exists on the repo today. Add a minimal GitHub Actions workflow
that runs on push/PR to main and ai-sdk-v5, and exercises the full
declared peer range (zod ^3.24, zod ^4.1) so regressions like ben-vargas#17
surface automatically rather than at consumer install time.

Per-job steps: install, swap zod version, typecheck, lint (non-blocking),
build, vitest, and a smoke test that imports the built CJS bundle.
@ben-vargas ben-vargas merged commit 4b499a2 into ben-vargas:ai-sdk-v5 Apr 14, 2026
bjcoombs added a commit to bjcoombs/ai-sdk-provider-opencode-sdk that referenced this pull request Apr 14, 2026
@types/node@25.6.0 and undici-types@7.19.2 were already referenced
via the dep graph but missing from package-lock.json, causing strict
npm ci to fail on every run once CI landed (ben-vargas#19).

21-line targeted lockfile addition via `npm install --package-lock-only`
to bring the lockfile into sync without churning unrelated entries.
Keeps CI strict.
ben-vargas pushed a commit that referenced this pull request Apr 14, 2026
@types/node@25.6.0 and undici-types@7.19.2 were already referenced
via the dep graph but missing from package-lock.json, causing strict
npm ci to fail on every run once CI landed (#19).

21-line targeted lockfile addition via `npm install --package-lock-only`
to bring the lockfile into sync without churning unrelated entries.
Keeps CI strict.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants