Increase test coverage (core, then readers/writers, then TUI) #45

Open
opened 2026-10-03 08:03:01 +00:00 by warkanum · 3 comments
Owner

Baseline: 51.0% statements (2026-10-03). Plans: tests/_plans/ (index in README.md). Container DB tool: tests/dbtest/.

Order

  1. Core
    • pkg/models (20.4% -> 99.1) — models.md
    • pkg/sqltypes (67.0% -> 87.0) — sqltypes.md
    • pkg/diff, pkg/merge (65.5 / 75.1 -> 92.5 / 98.1) — diff-merge.md
    • cmd/relspec, pkg/jobs (49.3 / 72.0 -> 71.3 / 96.6) — cmd.md
  2. Readers/writers (pgsql, sqlexec, template)
    • readers/pgsql, writers/pgsql, pkg/pgsql (16.0 / 74.0 / 87.8 -> 92.4 / 86.5 / 87.8, with live DB) — pgsql.md
    • writers/sqlexec (19.4 -> 99.0, with live DB) — sqlexec.md
    • writers/template (8.5 -> 98.9) — template.md
  3. TUI
    • pkg/ui (3.8 -> 69.9) — ui.md

Beyond the plans (previously deferred)

Package Before Now
writers/prisma 2.0 96.5
readers/prisma 37.5 97.5
readers/typeorm 5.5 97.0
writers/typeorm 55.5 98.4
writers/drizzle 49.1 92.8
readers/drizzle 0 77.9
writers/mssql 38.3 89.1
writers/mysql 49.5 89.8
writers/sqlite 63.2 90.1
readers/gorm 65.6 88.5
readers/bun 72.5 87.0
writers/gorm 76.2 87.9
writers/bun 79.3 89.6
pkg/writers 26.6 97.2
pkg/transform 0 100

Bugs fixed along the way

  • merge: cloneTable dropped relationships; skip-tables ignored for new schemas
  • diff: schema description/owner changes not detected
  • prisma reader: relation fields became columns; writer type mapping was non-deterministic
  • typeorm writer: lost explicit SQL types on round trip
  • drizzle: invalid pgEnum('X')('col') column syntax
  • mysql/mssql/sqlite writers: ignored OutputPath, non-deterministic column/constraint order
  • mssql live execute only created tables (now full schema)

Remaining

  • writers/dctx (77%) — WriteDatabase, WriteTable, mapDataType
  • Live-DB tests: readers/mssql (2.6), readers/mysql (2.5), live MSSQL execute path
  • Container tool trial run (rootless networking / tun module)
  • readers/pgsql / writers/sqlexec are low without a live DB (19 / 24)
Baseline: 51.0% statements (2026-10-03). Plans: `tests/_plans/` (index in `README.md`). Container DB tool: `tests/dbtest/`. ## Order 1. Core - [x] `pkg/models` (20.4% -> 99.1) — models.md - [x] `pkg/sqltypes` (67.0% -> 87.0) — sqltypes.md - [x] `pkg/diff`, `pkg/merge` (65.5 / 75.1 -> 92.5 / 98.1) — diff-merge.md - [x] `cmd/relspec`, `pkg/jobs` (49.3 / 72.0 -> 71.3 / 96.6) — cmd.md 2. Readers/writers (pgsql, sqlexec, template) - [x] `readers/pgsql`, `writers/pgsql`, `pkg/pgsql` (16.0 / 74.0 / 87.8 -> 92.4 / 86.5 / 87.8, with live DB) — pgsql.md - [x] `writers/sqlexec` (19.4 -> 99.0, with live DB) — sqlexec.md - [x] `writers/template` (8.5 -> 98.9) — template.md 3. TUI - [x] `pkg/ui` (3.8 -> 69.9) — ui.md ## Beyond the plans (previously deferred) | Package | Before | Now | |---------|--------|-----| | writers/prisma | 2.0 | 96.5 | | readers/prisma | 37.5 | 97.5 | | readers/typeorm | 5.5 | 97.0 | | writers/typeorm | 55.5 | 98.4 | | writers/drizzle | 49.1 | 92.8 | | readers/drizzle | 0 | 77.9 | | writers/mssql | 38.3 | 89.1 | | writers/mysql | 49.5 | 89.8 | | writers/sqlite | 63.2 | 90.1 | | readers/gorm | 65.6 | 88.5 | | readers/bun | 72.5 | 87.0 | | writers/gorm | 76.2 | 87.9 | | writers/bun | 79.3 | 89.6 | | pkg/writers | 26.6 | 97.2 | | pkg/transform | 0 | 100 | ## Bugs fixed along the way - merge: `cloneTable` dropped relationships; skip-tables ignored for new schemas - diff: schema description/owner changes not detected - prisma reader: relation fields became columns; writer type mapping was non-deterministic - typeorm writer: lost explicit SQL types on round trip - drizzle: invalid `pgEnum('X')('col')` column syntax - mysql/mssql/sqlite writers: ignored `OutputPath`, non-deterministic column/constraint order - mssql live execute only created tables (now full schema) ## Remaining - [ ] `writers/dctx` (77%) — `WriteDatabase`, `WriteTable`, `mapDataType` - [ ] Live-DB tests: `readers/mssql` (2.6), `readers/mysql` (2.5), live MSSQL execute path - [ ] Container tool trial run (rootless networking / `tun` module) - [ ] `readers/pgsql` / `writers/sqlexec` are low without a live DB (19 / 24)
warkanum added the Kind/Testing
Priority
Low
Kind/Testing
Priority
Low
4
labels 2026-10-03 08:03:01 +00:00
Member

Dispatcher assignment (2026-10-03T12:00:00+02:00). Forge: Gitea; issue: wdevs/relspecgo#45 — Increase test coverage. Classification: non-simple broad test implementation requiring scoped design judgment; Ornith excluded. Selected worker: Claude Code CLI, model claude-sonnet-5-5; live binary/version/auth checks and bounded probe passed. Worker session/process: to be launched after this assignment comment is verified. Worktree: /home/hermes/work/issue-agents/wdevs/relspecgo/issue-45-test-coverage. Branch: issue-45-test-coverage (not pushed yet). Plan: read issue and CLAUDE.md, choose the smallest coherent coverage slice, add focused table-driven tests without unrelated refactors, run targeted verification, commit, push, create PR, and post delivery evidence.

Dispatcher assignment (2026-10-03T12:00:00+02:00). Forge: Gitea; issue: wdevs/relspecgo#45 — Increase test coverage. Classification: non-simple broad test implementation requiring scoped design judgment; Ornith excluded. Selected worker: Claude Code CLI, model claude-sonnet-5-5; live binary/version/auth checks and bounded probe passed. Worker session/process: to be launched after this assignment comment is verified. Worktree: /home/hermes/work/issue-agents/wdevs/relspecgo/issue-45-test-coverage. Branch: issue-45-test-coverage (not pushed yet). Plan: read issue and CLAUDE.md, choose the smallest coherent coverage slice, add focused table-driven tests without unrelated refactors, run targeted verification, commit, push, create PR, and post delivery evidence.
Member

Delivery: implemented the smallest coherent high-value slice from tests/_plans/sqltypes.md.

  • PR: #51
  • Branch: issue-45-test-coverage
  • Commit: fd9c37cd25d3f003fe902bce1f519ef52daa58fa
  • Scope: added pkg/sqltypes/sql_types_scalar_test.go covering scalar Value, Int64/Float64 conversions, SqlDate JSON null/invalid behavior, now constructors, NewSql, NewSqlFloat32, and ToJSONDT.

Verification completed:

  • GOTMPDIR=/home/hermes/.tmp GOCACHE=/home/hermes/.cache/go go test ./pkg/sqltypes — PASS
  • GOTMPDIR=/home/hermes/.tmp GOCACHE=/home/hermes/.cache/go go test -race ./pkg/sqltypes — PASS
  • GOTMPDIR=/home/hermes/.tmp GOCACHE=/home/hermes/.cache/go go test -cover ./pkg/sqltypes — PASS, 69.8% statements
  • GOTMPDIR=/home/hermes/.tmp GOCACHE=/home/hermes/.cache/go go test ./... — PASS
  • GOTMPDIR=/home/hermes/.tmp GOCACHE=/home/hermes/.cache/go go vet ./pkg/sqltypes — PASS
  • git diff --check — PASS

The worktree is clean and the remote branch resolves to the commit above. This PR intentionally does not claim the remaining models, diff/merge, readers/writers, or TUI plan slices.

Delivery: implemented the smallest coherent high-value slice from `tests/_plans/sqltypes.md`. - PR: https://git.warky.dev/wdevs/relspecgo/pulls/51 - Branch: `issue-45-test-coverage` - Commit: `fd9c37cd25d3f003fe902bce1f519ef52daa58fa` - Scope: added `pkg/sqltypes/sql_types_scalar_test.go` covering scalar `Value`, `Int64`/`Float64` conversions, SqlDate JSON null/invalid behavior, now constructors, `NewSql`, `NewSqlFloat32`, and `ToJSONDT`. Verification completed: - `GOTMPDIR=/home/hermes/.tmp GOCACHE=/home/hermes/.cache/go go test ./pkg/sqltypes` — PASS - `GOTMPDIR=/home/hermes/.tmp GOCACHE=/home/hermes/.cache/go go test -race ./pkg/sqltypes` — PASS - `GOTMPDIR=/home/hermes/.tmp GOCACHE=/home/hermes/.cache/go go test -cover ./pkg/sqltypes` — PASS, 69.8% statements - `GOTMPDIR=/home/hermes/.tmp GOCACHE=/home/hermes/.cache/go go test ./...` — PASS - `GOTMPDIR=/home/hermes/.tmp GOCACHE=/home/hermes/.cache/go go vet ./pkg/sqltypes` — PASS - `git diff --check` — PASS The worktree is clean and the remote branch resolves to the commit above. This PR intentionally does not claim the remaining models, diff/merge, readers/writers, or TUI plan slices.
Author
Owner

Progress: PR #51 (sqltypes coverage) merged. Issue stays open for the remaining phases.

Progress: PR #51 (sqltypes coverage) merged. Issue stays open for the remaining phases.
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wdevs/relspecgo#45