diff --git a/.corbits-triage.yml b/.corbits-triage.yml index d15b7c7d..c0561478 100644 --- a/.corbits-triage.yml +++ b/.corbits-triage.yml @@ -167,7 +167,7 @@ rules: - id: empty-fallback language: typescript message: Invented fallback (an empty string, list, object or zero); handle the missing value instead. - ignores: ["**/*.test.ts", "**/*.test.tsx", "tests/**"] + ignores: ["**/*.test.ts", "**/*.test.tsx", "test/**"] rule: any: - pattern: $X || [] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f2c5faf0..5673fe9e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -128,8 +128,8 @@ change follows, whether a person or a coding agent writes it. - **Tests are load-bearing.** Write one when it guards an invariant (an approval binds to an exact version, a secret never reaches a response) or proves behaviour end to end through the real API. Unit tests live beside - their code; cross-module checks go in `tests/integration`, real service - tests in `tests/e2e`. + their code; cross-module checks go in `test/integration`, real service + tests in `test/e2e`. - **Model-agnostic.** Every role runs on any supported provider and model. - **No secrets.** The `.env.*.example` files are the only tracked env files. - **`vendor/interchange` is upstream code**, pinned at diff --git a/apps/web/README.md b/apps/web/README.md index b2337093..db206591 100644 --- a/apps/web/README.md +++ b/apps/web/README.md @@ -9,7 +9,7 @@ design and watches the app being built. The interface reaches the hub only through its HTTP API, using the typed client in [`packages/client`][client] and the shared types in [`packages/schemas`][schemas]. It never imports the hub, Postgres or -Drizzle; `tests/integration/architecture.test.ts` fails on that. In +Drizzle; `test/integration/architecture.test.ts` fails on that. In development Vite proxies `/api` to the hub at `UI_HUB_ORIGIN`; a deployed hub serves the built `dist/` on its own origin. diff --git a/docs/IMPLEMENTATION.md b/docs/IMPLEMENTATION.md index 533e21d4..683ab45c 100644 --- a/docs/IMPLEMENTATION.md +++ b/docs/IMPLEMENTATION.md @@ -111,27 +111,27 @@ Environment files, installs and build output never leave the workspace. ## Package layout -| Path | Package | What it holds | -| -------------------------- | ------------------------------ | ---------------------------------------------------------------- | -| `apps/hub` | `@corbits-builder/hub` | The server: routes, services, hub tools, provisioning, live app. | -| `packages/client` | `@corbits-builder/client` | The typed client for the hub's API. | -| `apps/web` | `@corbits-builder/web` | The interface, built only on the client and the schemas. | -| `workflows/coordinator` | `@corbits-builder/coordinator` | The coordinator's agent, prompt and workflow. | -| `workflows/writer` | `@corbits-builder/writer` | The document writer and its per-kind skills. | -| `workflows/reviewer` | `@corbits-builder/reviewer` | The document reviewer. | -| `workflows/designer` | `@corbits-builder/designer` | The designer, its starter, themes and skills. | -| `workflows/coder` | `@corbits-builder/coder` | The coder, its app starter and `check-app`. | -| `packages/schemas` | `@corbits-builder/schemas` | Types and schemas shared by the hub, client and workflows. | -| `vendor/interchange` | | Interchange at the pinned revision. | -| `deploy/` | | The Dockerfile and Compose files. | -| `tests/integration`, `e2e` | | Cross-module and full-stack tests. | +| Path | Package | What it holds | +| ------------------------- | ------------------------------ | ---------------------------------------------------------------- | +| `apps/hub` | `@corbits-builder/hub` | The server: routes, services, hub tools, provisioning, live app. | +| `packages/client` | `@corbits-builder/client` | The typed client for the hub's API. | +| `apps/web` | `@corbits-builder/web` | The interface, built only on the client and the schemas. | +| `workflows/coordinator` | `@corbits-builder/coordinator` | The coordinator's agent, prompt and workflow. | +| `workflows/writer` | `@corbits-builder/writer` | The document writer and its per-kind skills. | +| `workflows/reviewer` | `@corbits-builder/reviewer` | The document reviewer. | +| `workflows/designer` | `@corbits-builder/designer` | The designer, its starter, themes and skills. | +| `workflows/coder` | `@corbits-builder/coder` | The coder, its app starter and `check-app`. | +| `packages/schemas` | `@corbits-builder/schemas` | Types and schemas shared by the hub, client and workflows. | +| `vendor/interchange` | | Interchange at the pinned revision. | +| `deploy/` | | The Dockerfile and Compose files. | +| `test/integration`, `e2e` | | Cross-module and full-stack tests. | Workflow packages declare their agents and workflows with Interchange's definition exports (`@intx/agent/authoring`, `@intx/workflow/definition`). Cross-workspace imports use declared `@corbits-builder/*` exports and `workspace:*` dependencies; -[tests/integration/architecture.test.ts](https://github.com/corbitsdev/corbits-builder/blob/main/tests/integration/architecture.test.ts) +[test/integration/architecture.test.ts](https://github.com/corbitsdev/corbits-builder/blob/main/test/integration/architecture.test.ts) checks that code imports Interchange by package name and that the interface never imports the server or the database. diff --git a/package.json b/package.json index a58655f5..1d97dbf7 100644 --- a/package.json +++ b/package.json @@ -32,8 +32,8 @@ "format": "bun fmt --no-script", "format:check": "bun fmt --no-script --check", "typecheck": "bun check --no-script && bun check --no-script -p packages/client && bun check --no-script -p apps/web", - "test": "bun --conditions=intx-src test ./apps/hub ./apps/web/src ./packages ./workflows ./tests/integration", - "test:e2e": "bun --env-file=.env.hub --conditions=intx-src test ./tests/e2e", + "test": "bun --conditions=intx-src test ./apps/hub ./apps/web/src ./packages ./workflows ./test/integration", + "test:e2e": "bun --env-file=.env.hub --conditions=intx-src test ./test/e2e", "vendor:verify": "bun scripts/verify-vendor.ts", "pins:verify": "bun scripts/verify-pins.ts", "skills:react-ui": "bun scripts/react-ui-api.ts" diff --git a/test/README.md b/test/README.md new file mode 100644 index 00000000..0bb90ed6 --- /dev/null +++ b/test/README.md @@ -0,0 +1,11 @@ +# Tests + +Unit tests sit next to the code they test. This folder holds the tests that +cross modules: + +- `integration/` checks contracts and architecture across packages; `bun run test` runs it. +- `e2e/` runs the hub against a real Postgres; `bun run test:e2e` runs it. + +Later folders, added with their first file: `ux/` for interface tests, +`workflows/` for agent-loop tests, `fixtures/` for recorded model sessions, +`harness/` and `support/` for what those tests share. diff --git a/tests/e2e/oauth-model-login.test.ts b/test/e2e/oauth-model-login.test.ts similarity index 100% rename from tests/e2e/oauth-model-login.test.ts rename to test/e2e/oauth-model-login.test.ts diff --git a/tests/integration/architecture.test.ts b/test/integration/architecture.test.ts similarity index 99% rename from tests/integration/architecture.test.ts rename to test/integration/architecture.test.ts index b4bb2d47..9ae531d4 100644 --- a/tests/integration/architecture.test.ts +++ b/test/integration/architecture.test.ts @@ -63,7 +63,7 @@ test("workspace imports use declared package exports and local dependencies", as "apps", "packages", "workflows", - "tests", + "test", "scripts", ]) { for (const path of await sources(resolve(root, directory))) { diff --git a/tsconfig.json b/tsconfig.json index 20d69829..a11685ef 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,7 +17,7 @@ "skipLibCheck": true, "allowImportingTsExtensions": true }, - "include": ["apps/hub", "scripts", "packages", "workflows", "tests"], + "include": ["apps/hub", "scripts", "packages", "workflows", "test"], "exclude": [ "node_modules", "vendor",