Initial Commit
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
## Why
|
||||
|
||||
Six of the seven `testing-integration-*` plugin packages have a packaging bug that makes them unimportable from outside their own package. Their `package.json` declares `"exports": { ".": { "import": "./dist/index.js" } }`, but their `vite.config.ts` is missing `output.entryFileNames: "[name].js"` while still using `preserveModules: true`. Vite's lib mode then derives the entry filename from the package name (`@suaveplan/testing-integration-surrealdb` → `dist/testing-integration-surrealdb.js`), so `dist/index.js` is never written.
|
||||
|
||||
Verified empirically:
|
||||
|
||||
| Package | `dist/index.js` |
|
||||
|---|---|
|
||||
| `testing-integration` | ✅ PRESENT |
|
||||
| `testing-integration-garage-s3` | ✅ PRESENT |
|
||||
| `testing-integration-mailpit` | ❌ MISSING |
|
||||
| `testing-integration-postgres` | ❌ MISSING |
|
||||
| `testing-integration-redis` | ❌ MISSING |
|
||||
| `testing-integration-step-ca` | ❌ MISSING |
|
||||
| `testing-integration-surrealdb` | ❌ MISSING |
|
||||
| `testing-integration-typesense` | ❌ MISSING |
|
||||
|
||||
Consequence: any consumer that imports `@suaveplan/testing-integration-surrealdb` (or the other five) gets `Failed to resolve entry for package … The package may have incorrect main/module/exports specified in its package.json.` from esbuild/vite/Bun. This is the root cause of the empty consumer list noted in `surrealdb-integration-tests` — the fixtures are not just unwired, they are unreachable.
|
||||
|
||||
The bug ships green from CI today because each package's own unit suite resolves fixture code via relative paths inside `src/`, never crossing the package boundary; `bunx turbo build` succeeds because Vite emitting *some* `.js` file is enough; and the existing pre-publish gate does not include a "consumer can resolve me" check.
|
||||
|
||||
## What Changes
|
||||
|
||||
### vite.config.ts in six packages
|
||||
|
||||
Add `output.entryFileNames: "[name].js"` to the `rollupOptions.output` block in each of:
|
||||
|
||||
- `packages/dev/testing-integration-mailpit/vite.config.ts`
|
||||
- `packages/dev/testing-integration-postgres/vite.config.ts`
|
||||
- `packages/dev/testing-integration-redis/vite.config.ts`
|
||||
- `packages/dev/testing-integration-step-ca/vite.config.ts`
|
||||
- `packages/dev/testing-integration-surrealdb/vite.config.ts`
|
||||
- `packages/dev/testing-integration-typesense/vite.config.ts`
|
||||
|
||||
After the change, `bunx turbo build --filter=@suaveplan/testing-integration-*` produces `dist/index.js` in every package. Output remains ESM-only with `preserveModules: true`; only the entry filename derivation changes.
|
||||
|
||||
`testing-integration-garage-s3` already has the fix and `testing-integration` (core) does not need it (different shape — flat barrel emit). Both are left untouched.
|
||||
|
||||
### Cross-package resolve smoke test
|
||||
|
||||
A new repo-level script `scripts/check-fixture-resolves.ts` performs a programmatic `import("@suaveplan/testing-integration-<name>")` for every fixture package and asserts the import does not throw. Wired into the `// #check` task in `turbo.json` so the bug cannot regress silently. Equivalent in spirit to a pre-publish smoke test that's faster than running an integration suite.
|
||||
|
||||
### Out of scope
|
||||
|
||||
- Changing the existing `lib.entry` shape in any package. The minimum delta is `output.entryFileNames`.
|
||||
- Touching `testing-integration-garage-s3` (already correct) or `testing-integration` (different shape).
|
||||
- Wiring any consumer to the now-resolvable fixtures. That is `surrealdb-integration-tests` and the per-package consumer changes that follow it.
|
||||
- Subpath exports (`./fixture/*`, `./constants`). Those resolve correctly today because they reference specific built files.
|
||||
|
||||
## Capabilities
|
||||
|
||||
### Modified Capabilities
|
||||
|
||||
- `testing-integration-mailpit` — adds a packaging requirement that `dist/index.js` MUST exist after `bun run build`.
|
||||
- `testing-integration-postgres` — same.
|
||||
- `testing-integration-redis` — same.
|
||||
- `testing-integration-step-ca` — same.
|
||||
- `testing-integration-surrealdb` — same.
|
||||
- `testing-integration-typesense` — same.
|
||||
|
||||
(Six identical "main entry resolves" requirements ADDED to the existing capability spec for each package. The repo-level resolve check is captured under a new shared capability `testing-integration-resolve-check`.)
|
||||
|
||||
### New Capabilities
|
||||
|
||||
- `testing-integration-resolve-check` — a repo-level script + turbo gate that imports every `testing-integration-*` package by its public name and fails CI if any does not resolve.
|
||||
|
||||
## Impact
|
||||
|
||||
- **Affected code:** six `vite.config.ts` files (one line each), `scripts/check-fixture-resolves.ts` (new, ~40 lines), `turbo.json` (add the `check:fixture-resolves` task).
|
||||
- **Affected consumers:** unblocks `@suaveplan/database/surrealdb` (current `surrealdb-integration-tests` change) and every future consumer that imports any of the six fixtures.
|
||||
- **CLAUDE.md / MANIFEST.md:** no package added/removed; no manifest regen.
|
||||
- **Pre-publish gate:** unchanged — coverage and lint still pass on the affected packages.
|
||||
- **Risk:** very low. The fix is the *same* output-filename rewrite that `testing-integration-garage-s3` already uses successfully; we are aligning the broken six to it.
|
||||
@@ -0,0 +1,22 @@
|
||||
# Capability Spec Delta: testing-integration-mailpit (testing-integration-vite-entry-fix)
|
||||
|
||||
**Package**: `@suaveplan/testing-integration-mailpit`
|
||||
**Status**: PROPOSED
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Main entry resolves for cross-package consumers
|
||||
|
||||
After `bun run build`, the file `dist/index.js` MUST exist at the path declared by `package.json`'s `exports."." → import.default`. A consumer importing `@suaveplan/testing-integration-mailpit` from any other workspace package MUST receive a working module without `Failed to resolve entry for package` errors. Enforced by `output.entryFileNames: "[name].js"` in `vite.config.ts`'s `build.rollupOptions.output` block.
|
||||
|
||||
#### Scenario: dist/index.js is present after build
|
||||
|
||||
- **WHEN** `bunx turbo build --filter=@suaveplan/testing-integration-mailpit` completes
|
||||
- **THEN** `packages/dev/testing-integration-mailpit/dist/index.js` exists on disk
|
||||
|
||||
#### Scenario: external consumer can import the package
|
||||
|
||||
- **WHEN** a sibling workspace package imports from `@suaveplan/testing-integration-mailpit`
|
||||
- **THEN** the import resolves and the public exports are callable
|
||||
|
||||
**Verified by:** `scripts/check-fixture-resolves.ts` (this change).
|
||||
@@ -0,0 +1,22 @@
|
||||
# Capability Spec Delta: testing-integration-postgres (testing-integration-vite-entry-fix)
|
||||
|
||||
**Package**: `@suaveplan/testing-integration-postgres`
|
||||
**Status**: PROPOSED
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Main entry resolves for cross-package consumers
|
||||
|
||||
After `bun run build`, the file `dist/index.js` MUST exist at the path declared by `package.json`'s `exports."." → import.default`. A consumer importing `@suaveplan/testing-integration-postgres` from any other workspace package MUST receive a working module without `Failed to resolve entry for package` errors. Enforced by `output.entryFileNames: "[name].js"` in `vite.config.ts`'s `build.rollupOptions.output` block.
|
||||
|
||||
#### Scenario: dist/index.js is present after build
|
||||
|
||||
- **WHEN** `bunx turbo build --filter=@suaveplan/testing-integration-postgres` completes
|
||||
- **THEN** `packages/dev/testing-integration-postgres/dist/index.js` exists on disk
|
||||
|
||||
#### Scenario: external consumer can import the package
|
||||
|
||||
- **WHEN** a sibling workspace package imports from `@suaveplan/testing-integration-postgres`
|
||||
- **THEN** the import resolves and the public exports are callable
|
||||
|
||||
**Verified by:** `scripts/check-fixture-resolves.ts` (this change).
|
||||
@@ -0,0 +1,22 @@
|
||||
# Capability Spec Delta: testing-integration-redis (testing-integration-vite-entry-fix)
|
||||
|
||||
**Package**: `@suaveplan/testing-integration-redis`
|
||||
**Status**: PROPOSED
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Main entry resolves for cross-package consumers
|
||||
|
||||
After `bun run build`, the file `dist/index.js` MUST exist at the path declared by `package.json`'s `exports."." → import.default`. A consumer importing `@suaveplan/testing-integration-redis` from any other workspace package MUST receive a working module without `Failed to resolve entry for package` errors. Enforced by `output.entryFileNames: "[name].js"` in `vite.config.ts`'s `build.rollupOptions.output` block.
|
||||
|
||||
#### Scenario: dist/index.js is present after build
|
||||
|
||||
- **WHEN** `bunx turbo build --filter=@suaveplan/testing-integration-redis` completes
|
||||
- **THEN** `packages/dev/testing-integration-redis/dist/index.js` exists on disk
|
||||
|
||||
#### Scenario: external consumer can import the package
|
||||
|
||||
- **WHEN** a sibling workspace package imports from `@suaveplan/testing-integration-redis`
|
||||
- **THEN** the import resolves and the public exports are callable
|
||||
|
||||
**Verified by:** `scripts/check-fixture-resolves.ts` (this change).
|
||||
@@ -0,0 +1,48 @@
|
||||
# Capability Spec Delta: testing-integration-resolve-check (testing-integration-vite-entry-fix)
|
||||
|
||||
**Capability**: `testing-integration-resolve-check`
|
||||
**Status**: PROPOSED
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Repo-level resolve check exists
|
||||
|
||||
The repository SHALL ship a script at `scripts/check-fixture-resolves.ts` that, when executed, performs a programmatic dynamic `import()` for every `@suaveplan/testing-integration-*` package by its public name and asserts each import succeeds. The script MUST exit with code 0 when all imports succeed and a non-zero code with a clear per-package error message otherwise.
|
||||
|
||||
#### Scenario: passes when every fixture resolves
|
||||
|
||||
- **WHEN** `bun scripts/check-fixture-resolves.ts` runs after a clean repo build
|
||||
- **THEN** the process prints a PASS row for each of the seven packages and exits with code 0
|
||||
|
||||
#### Scenario: fails with a clear per-package error
|
||||
|
||||
- **WHEN** any `testing-integration-*` package's `dist/index.js` is missing or unreachable
|
||||
- **THEN** the process prints `FAIL: @suaveplan/testing-integration-<name> — <error>` and exits with non-zero code
|
||||
|
||||
**Verified by:** `scripts/check-fixture-resolves.ts` itself; runtime execution in CI gate.
|
||||
|
||||
---
|
||||
|
||||
### Requirement: Turbo task wires the check into the dependency graph
|
||||
|
||||
`turbo.json` SHALL declare a `check:fixture-resolves` task that depends on `^build` and is invoked by `bun run check:fixture-resolves` at the repo root.
|
||||
|
||||
#### Scenario: turbo runs the check after dependent builds
|
||||
|
||||
- **WHEN** `bunx turbo check:fixture-resolves` runs
|
||||
- **THEN** turbo first executes `build` for every `testing-integration-*` package and then invokes the script
|
||||
|
||||
**Verified by:** `turbo.json`, `package.json` (root) script entry.
|
||||
|
||||
---
|
||||
|
||||
### Requirement: CI gate runs the check before any integration suite
|
||||
|
||||
CI SHALL invoke `bun run check:fixture-resolves` before any consumer integration suite (`bunx turbo test:integration --filter=*`). Failure of the resolve check MUST short-circuit the job before docker-compose is brought up — the bug is structural and a successful container would not change the outcome.
|
||||
|
||||
#### Scenario: integration job aborts when fixtures are unresolvable
|
||||
|
||||
- **WHEN** the resolve check fails in CI
|
||||
- **THEN** the job exits before any `docker compose up` step runs and the failure log names the offending package
|
||||
|
||||
**Verified by:** the CI workflow file added in this change.
|
||||
@@ -0,0 +1,22 @@
|
||||
# Capability Spec Delta: testing-integration-step-ca (testing-integration-vite-entry-fix)
|
||||
|
||||
**Package**: `@suaveplan/testing-integration-step-ca`
|
||||
**Status**: PROPOSED
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Main entry resolves for cross-package consumers
|
||||
|
||||
After `bun run build`, the file `dist/index.js` MUST exist at the path declared by `package.json`'s `exports."." → import.default`. A consumer importing `@suaveplan/testing-integration-step-ca` from any other workspace package MUST receive a working module without `Failed to resolve entry for package` errors. Enforced by `output.entryFileNames: "[name].js"` in `vite.config.ts`'s `build.rollupOptions.output` block.
|
||||
|
||||
#### Scenario: dist/index.js is present after build
|
||||
|
||||
- **WHEN** `bunx turbo build --filter=@suaveplan/testing-integration-step-ca` completes
|
||||
- **THEN** `packages/dev/testing-integration-step-ca/dist/index.js` exists on disk
|
||||
|
||||
#### Scenario: external consumer can import the package
|
||||
|
||||
- **WHEN** a sibling workspace package imports from `@suaveplan/testing-integration-step-ca`
|
||||
- **THEN** the import resolves and the public exports are callable
|
||||
|
||||
**Verified by:** `scripts/check-fixture-resolves.ts` (this change).
|
||||
@@ -0,0 +1,24 @@
|
||||
# Capability Spec Delta: testing-integration-surrealdb (testing-integration-vite-entry-fix)
|
||||
|
||||
**Package**: `@suaveplan/testing-integration-surrealdb`
|
||||
**Status**: PROPOSED
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Main entry resolves for cross-package consumers
|
||||
|
||||
After `bun run build`, the file `dist/index.js` MUST exist at the path declared by `package.json`'s `exports."." → import.default`. A consumer importing `@suaveplan/testing-integration-surrealdb` from any other workspace package MUST receive a working module without `Failed to resolve entry for package` errors from esbuild, vite, or Bun.
|
||||
|
||||
This is enforced by setting `output.entryFileNames: "[name].js"` in `vite.config.ts`'s `build.rollupOptions.output` block. Without that line, Vite's lib mode derives the entry filename from the package name and `dist/index.js` is never written.
|
||||
|
||||
#### Scenario: dist/index.js is present after build
|
||||
|
||||
- **WHEN** `bunx turbo build --filter=@suaveplan/testing-integration-surrealdb` completes
|
||||
- **THEN** `packages/dev/testing-integration-surrealdb/dist/index.js` exists on disk
|
||||
|
||||
#### Scenario: external consumer can import the package
|
||||
|
||||
- **WHEN** a sibling workspace package contains `import { SurrealDBFixture } from "@suaveplan/testing-integration-surrealdb"`
|
||||
- **THEN** vite/esbuild/Bun resolve the import and `SurrealDBFixture` is a callable class
|
||||
|
||||
**Verified by:** `scripts/check-fixture-resolves.ts` (this change), regression coverage in any consumer integration suite (e.g. `surrealdb-integration-tests`).
|
||||
@@ -0,0 +1,22 @@
|
||||
# Capability Spec Delta: testing-integration-typesense (testing-integration-vite-entry-fix)
|
||||
|
||||
**Package**: `@suaveplan/testing-integration-typesense`
|
||||
**Status**: PROPOSED
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Main entry resolves for cross-package consumers
|
||||
|
||||
After `bun run build`, the file `dist/index.js` MUST exist at the path declared by `package.json`'s `exports."." → import.default`. A consumer importing `@suaveplan/testing-integration-typesense` from any other workspace package MUST receive a working module without `Failed to resolve entry for package` errors. Enforced by `output.entryFileNames: "[name].js"` in `vite.config.ts`'s `build.rollupOptions.output` block.
|
||||
|
||||
#### Scenario: dist/index.js is present after build
|
||||
|
||||
- **WHEN** `bunx turbo build --filter=@suaveplan/testing-integration-typesense` completes
|
||||
- **THEN** `packages/dev/testing-integration-typesense/dist/index.js` exists on disk
|
||||
|
||||
#### Scenario: external consumer can import the package
|
||||
|
||||
- **WHEN** a sibling workspace package imports from `@suaveplan/testing-integration-typesense`
|
||||
- **THEN** the import resolves and the public exports are callable
|
||||
|
||||
**Verified by:** `scripts/check-fixture-resolves.ts` (this change).
|
||||
@@ -0,0 +1,48 @@
|
||||
# Tasks — testing-integration-vite-entry-fix
|
||||
|
||||
## 1. Patch the six broken vite configs
|
||||
|
||||
For each package, add `output.entryFileNames: "[name].js"` to `build.rollupOptions.output`. The block already contains `preserveModules: true` and `preserveModulesRoot: "src"`; only the new line is added. Then rebuild and verify `dist/index.js` exists.
|
||||
|
||||
- [x] 1.1 `packages/dev/testing-integration-mailpit/vite.config.ts`
|
||||
- [x] 1.2 `packages/dev/testing-integration-postgres/vite.config.ts`
|
||||
- [x] 1.3 `packages/dev/testing-integration-redis/vite.config.ts`
|
||||
- [x] 1.4 `packages/dev/testing-integration-step-ca/vite.config.ts`
|
||||
- [x] 1.5 `packages/dev/testing-integration-surrealdb/vite.config.ts`
|
||||
- [x] 1.6 `packages/dev/testing-integration-typesense/vite.config.ts`
|
||||
- [x] 1.7 Run `bunx turbo build --filter=@suaveplan/testing-integration-*` and verify `dist/index.js` is present in all six.
|
||||
|
||||
## 2. Repo-level resolve smoke test
|
||||
|
||||
- [x] 2.1 Create `scripts/check-fixture-resolves.ts` — for each of the seven `testing-integration-*` package names, dynamic-`import()` the package; collect failures; exit non-zero if any failed; print a summary table.
|
||||
- [x] 2.2 Add the script invocation to the root `package.json` as `"check:fixture-resolves": "bun scripts/check-fixture-resolves.ts"`.
|
||||
- [x] 2.3 Add a `check:fixture-resolves` task to `turbo.json` with `dependsOn: ["^build"]`, `cache: false`, `outputs: []`.
|
||||
|
||||
## 3. Verify each fixture's own unit suite still passes
|
||||
|
||||
Coverage and behavioural tests of the fixtures themselves rely on relative imports inside `src/` and should be unaffected. Re-run them as a regression check.
|
||||
|
||||
- [x] 3.1 `bunx turbo test:coverage --filter=@suaveplan/testing-integration-mailpit`
|
||||
- [x] 3.2 `bunx turbo test:coverage --filter=@suaveplan/testing-integration-postgres`
|
||||
- [x] 3.3 `bunx turbo test:coverage --filter=@suaveplan/testing-integration-redis`
|
||||
- [x] 3.4 `bunx turbo test:coverage --filter=@suaveplan/testing-integration-step-ca`
|
||||
- [x] 3.5 `bunx turbo test:coverage --filter=@suaveplan/testing-integration-surrealdb`
|
||||
- [x] 3.6 `bunx turbo test:coverage --filter=@suaveplan/testing-integration-typesense`
|
||||
|
||||
## 4. Cross-package resolve from a real consumer
|
||||
|
||||
- [x] 4.1 In `packages/database/surrealdb` (already wired with the `surrealdb-integration-tests` scaffolding), run `bunx turbo typecheck --filter=@suaveplan/surrealdb` — must stay green.
|
||||
- [x] 4.2 In `packages/database/surrealdb`, attempt `bun run test:integration` with docker down. The expectation here is NOT a green pass; it is that the runner reaches the global-setup phase rather than failing on `Failed to resolve entry for package`. (Subsequent skip-when-unavailable behaviour is owned by the surrealdb-integration-tests change, not this one.)
|
||||
|
||||
## 5. CI integration
|
||||
|
||||
- [x] 5.1 Add `bun run check:fixture-resolves` as an early step in CI, before any integration suite invocation. Failure exits the job with a clear message naming the offending package.
|
||||
|
||||
## 6. Documentation
|
||||
|
||||
- [x] 6.1 Add a short paragraph to `docker/README.md` (or `packages/dev/testing-integration/README.md`) noting that adding a new `testing-integration-<service>` package requires `output.entryFileNames: "[name].js"` in its vite.config.ts. Cross-reference the resolve check.
|
||||
|
||||
## 7. OpenSpec gate
|
||||
|
||||
- [x] 7.1 Run `openspec validate testing-integration-vite-entry-fix --strict`; resolve any errors.
|
||||
- [x] 7.2 On ship: fold each MODIFIED Requirements delta into `openspec/specs/testing-integration-<name>/spec.md`, fold the new `testing-integration-resolve-check` spec into `openspec/specs/testing-integration-resolve-check/spec.md`, and move the change folder to `openspec/archive/<yyyy-mm-dd>-testing-integration-vite-entry-fix/`.
|
||||
Reference in New Issue
Block a user