@shivaedev/effect-test-sql 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +2 -6
- package/package.json +7 -10
- package/docs/north-star.md +0 -9
- package/docs/roadmap.md +0 -20
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ export const { effectApp } = makeEffectIt({
|
|
|
61
61
|
});
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
Use the application's migration loader in place of the example. `migrations` takes
|
|
64
|
+
Use the application's migration loader in place of the example. `migrations` takes effect-sql's `PostgresMigrationOptions`. Fixtures are an Effect with access to the native PostgreSQL services. Additional migration or fixture dependencies remain requirements of the Layer and must be supplied before passing it to the runner. Setup failures remain failures; acquired databases are dropped when the acquisition scope closes.
|
|
65
65
|
|
|
66
66
|
### Budget PostgreSQL connections
|
|
67
67
|
|
|
@@ -173,8 +173,6 @@ Use `prepare: false` when preparing the test Layer, and `withIsolatedDatabase` f
|
|
|
173
173
|
|
|
174
174
|
The assertion uses the SQL `Model`'s selected database fields, including generated ids and excluding JSON-only fields. Supply an exact PostgreSQL type for every field: schemas such as `Schema.Number` do not determine whether storage is `integer`, `numeric` or `double precision`. It fails with a typed `ModelColumnMismatch` containing all detected missing, extra and wrongly typed column problems. The type map is checked against the model both by TypeScript and at runtime. This check covers names and types; it does not check defaults, nullability, constraints or application data transformations.
|
|
175
175
|
|
|
176
|
-
The starter's notes migration test uses this path with its repository model, so applications generated with `pnpm create @shivaedev/app` include an upgrade check.
|
|
177
|
-
|
|
178
176
|
### API
|
|
179
177
|
|
|
180
178
|
Import each name from the module that defines it. The package has no root entry.
|
|
@@ -191,12 +189,10 @@ Import each name from the module that defines it. The package has no root entry.
|
|
|
191
189
|
|
|
192
190
|
`url` is a redacted PostgreSQL URL for an existing administrative database. `PostgresTestDatabase` supplies the current database's redacted `url` and a scoped `isolated` Effect that acquires another clone's service Context. Prefer `withIsolatedDatabase` to acquire and release that Context around a test. Wrappers retain the body's result, failures and unmet service requirements, with native `SqlError` added for acquisition or transaction failures. Cleanup failures are defects rather than successful cleanup.
|
|
193
191
|
|
|
194
|
-
### Install
|
|
192
|
+
### Install and setup
|
|
195
193
|
|
|
196
194
|
```sh
|
|
197
195
|
pnpm add --save-dev @shivaedev/effect-test-sql @shivaedev/effect-test @effect/sql-pg @effect/vitest effect vitest
|
|
198
196
|
```
|
|
199
197
|
|
|
200
198
|
Use versions compatible with the package's peer dependencies. The package requires Node.js 24 or later. The PostgreSQL role must be able to create and drop databases; use a dedicated test server. PostgreSQL 13 or later supports the forced database drops used for cleanup. The migrations and fixtures must complete their work during preparation; their scoped resources are closed before cloning.
|
|
201
|
-
|
|
202
|
-
The package tests use `PLATFORM_EFFECT_TEST_SQL_TEST_DATABASE_URL`. Repository setup and CI prepare that database on real PostgreSQL. Local tests skip when that variable is absent; CI rejects its absence. The PostgreSQL tests prove overlapping same-row visibility, shared-key lock contention and release, rollback, nested savepoints, runner/harness scope composition, one-time template preparation, commits visible through another connection, and database cleanup. They also measure twelve concurrent clones through `pg_stat_activity` at both the default and overridden pool limits, verify administrative connection release, and exercise connection-limit diagnostics using restricted PostgreSQL roles. Compiler and packed-consumer tests prove the exercised public type and export contracts. These are library checks, not evidence for an application's servers or notification delivery.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/effect-test-sql",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "PostgreSQL rollback and real-commit test isolation for Effect",
|
|
5
5
|
"homepage": "https://github.com/ShivaeDev/platform/tree/main/packages/effect-test-sql#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -24,9 +24,8 @@
|
|
|
24
24
|
},
|
|
25
25
|
"exports": {
|
|
26
26
|
"./*.ts": {
|
|
27
|
-
"types": "./dist/server/*.d.ts",
|
|
28
27
|
"source": "./src/server/*.ts",
|
|
29
|
-
"
|
|
28
|
+
"types": "./dist/server/*.d.ts",
|
|
30
29
|
"default": "./dist/server/*.js"
|
|
31
30
|
},
|
|
32
31
|
"./internal/*": null,
|
|
@@ -38,23 +37,21 @@
|
|
|
38
37
|
"!src/**/*.test.ts",
|
|
39
38
|
"!src/**/*.spec.ts",
|
|
40
39
|
"!src/**/test-support",
|
|
41
|
-
"docs",
|
|
42
40
|
"CHANGELOG.md",
|
|
43
41
|
"README.md"
|
|
44
42
|
],
|
|
45
43
|
"dependencies": {
|
|
46
|
-
"@shivaedev/effect-sql": "0.5.
|
|
44
|
+
"@shivaedev/effect-sql": "0.5.2"
|
|
47
45
|
},
|
|
48
46
|
"devDependencies": {
|
|
49
47
|
"@effect/sql-pg": "4.0.4",
|
|
50
48
|
"@effect/vitest": "4.0.4",
|
|
51
|
-
"@shivaedev/effect-test": "0.
|
|
52
|
-
"@shivaedev/quality": "0.
|
|
53
|
-
"@shivaedev/test-story": "0.
|
|
49
|
+
"@shivaedev/effect-test": "0.6.0",
|
|
50
|
+
"@shivaedev/quality": "0.26.0",
|
|
51
|
+
"@shivaedev/test-story": "0.8.0",
|
|
54
52
|
"@types/node": "24.19.2",
|
|
55
|
-
"@typescript/native": "npm:typescript@7.0.2",
|
|
56
53
|
"effect": "4.0.4",
|
|
57
|
-
"typescript": "
|
|
54
|
+
"typescript": "7.0.2",
|
|
58
55
|
"vitest": "5.0.3"
|
|
59
56
|
},
|
|
60
57
|
"peerDependencies": {
|
package/docs/north-star.md
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# PostgreSQL tests with deliberate lifetimes
|
|
2
|
-
|
|
3
|
-
Database tests repeat expensive setup and fragile cleanup when each application invents its own fixture lifecycle. The ideal is one migration and fixture preparation for a worker fixture, ordinary tests whose data disappears through rollback, and a deliberate escape for tests that need PostgreSQL to commit.
|
|
4
|
-
|
|
5
|
-
Native Effect owns Context, Scope, failure, interruption and SQL transaction connections. `effect-test` owns the runner; `effect-sql` owns migrations and commit-bound transactions. This package joins those paths with PostgreSQL database resources. It does not implement another migration engine, pool driver or test runner.
|
|
6
|
-
|
|
7
|
-
Prepare an immutable template, close its connections, and clone it for the shared database and isolated scenarios. Connection finalizers precede database drops. A rejected or interrupted test must not become a successful test during cleanup. A rolled-back nested transaction uses a savepoint, and a rolled-back test must not publish commit-bound invalidations.
|
|
8
|
-
|
|
9
|
-
Isolation does not erase PostgreSQL's concurrency rules. Conflicting keyed writes share locks in the ordinary path. Separate databases permit independent data and real commits, while cluster-wide resources still need scenario-specific choices. Preserve these boundaries over a promise of universal concurrency.
|
package/docs/roadmap.md
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# Roadmap
|
|
2
|
-
|
|
3
|
-
## Built
|
|
4
|
-
|
|
5
|
-
- Prepare migrations and optional fixtures once in a closed template database, supply native PostgreSQL services on a shared database, and roll back ordinary tests. [PostgreSQL lifecycle tests](../src/server/postgres.test.ts) and [transaction tests](../src/server/transaction.spec.ts) prove preparation and rollback.
|
|
6
|
-
- Compose the wrapping transaction with `makeEffectIt`, harness scopes and nested `transact` savepoints. [Runner tests](../src/server/vitest.spec.ts) and [application-layer tests](../src/server/applicationLayers.spec.ts) prove the composition.
|
|
7
|
-
- Clone isolated databases for real commits and drop them after success, typed failure, defects or interruption. [Isolation tests](../src/server/isolated.spec.ts) prove these lifetimes and worker cleanup; [cleanup failure tests](../src/server/cleanupFailure.spec.ts) prove a failed drop becomes a defect carrying the SQL failure.
|
|
8
|
-
- Start with an empty schema using `prepare: false`, then use `migrationSteps` to stop at named migrations, seed old-schema data and finish the upgrade on the same database. [Migration-step tests](../src/server/migrationSteps.test.ts) prove committed backfills and rejection of unknown names and wrapping transactions; [lifecycle tests](../src/server/migrationStepsLifecycle.spec.ts) prove empty preparation, scoped loader resources, resume and rejection of backwards steps.
|
|
9
|
-
- Use `migrationUpgrade` to commit an old migration prefix and apply the remaining migrations, then compare live PostgreSQL columns with an Effect SQL model using `assertModelColumns`. [Upgrade tests](../src/server/migrationUpgrade.test.ts) prove committed old data, exact column types, drift detection and invalid-state rejection; [model-column tests](../src/server/assertModelColumns.test.ts) prove model field and type comparisons.
|
|
10
|
-
- Default to two pooled connections per database, allow `maxConnections` overrides and close administrative sessions between operations. [Connection-budget tests](../src/server/connectionBudget.spec.ts) measure twelve concurrent databases with default and explicit pool sizes; [idle-cleanup tests](../src/server/postgresIdleCleanup.spec.ts) prove idle workers release their connections.
|
|
11
|
-
- Preserve SQLSTATE `53300` on connection exhaustion and add connection-limit and worker-count guidance. [Connection-limit tests](../src/server/connectionLimit.spec.ts) prove setup and wrapper diagnostics against PostgreSQL and preserve other SQL failures' identity.
|
|
12
|
-
- Check public contracts with [compiler tests](../src/server/postgres.typecheck.test.ts), [migration-step compiler tests](../src/server/migrationSteps.typecheck.test.ts), [upgrade compiler tests](../src/server/migrationUpgrade.typecheck.test.ts) and [packed-consumer checks](../../../script/package-check/fixtures/effect-test-sql/types.ts.txt).
|
|
13
|
-
|
|
14
|
-
## Next
|
|
15
|
-
|
|
16
|
-
No additional package work is selected. Let application migration and test-isolation needs identify the next change.
|
|
17
|
-
|
|
18
|
-
## Open questions
|
|
19
|
-
|
|
20
|
-
No package scope questions are currently selected.
|