Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ concurrency:
jobs:
check:
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
# The runner image ships Postgres 16; starting it avoids Docker Hub pulls and their rate limits.
- name: Start Postgres
Expand All @@ -36,6 +37,8 @@ jobs:
run: bun run check
- name: Test
run: bun run test
- name: Chain
run: bun run test:chain

policy:
if: github.event_name == 'pull_request'
Expand Down
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Check these for a stock route or primitive before touching the hub, sidecars or

- Only load-bearing tests, end to end where possible.
- Tests beside the code are fast and offline; anything that runs real services lives in `e2e/`.
- The one exception is `tests/chain/`: it starts the real hub and local sidecars but reaches no outside service (a fake GitHub and a stub decision model), and CI runs it as its own step, `bun run test:chain`.
- Never read `process.env` in tests.
- A change to how a workflow judges or reviews states its package's eval result before and after.

Expand Down
14 changes: 14 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions docs/DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,15 @@ Code review against the emulator: the emulator ignores GitHub's diff media type

```sh
bun run test # unit + integration; hub tests need Postgres
bun run test:chain # the live chain: hub, sidecars, listener, manager, judge; about three minutes
bun run check # typecheck web, tooling, extension, hub; bundle the hub
bun run lint
```

Hub tests connect to `postgres://postgres:postgres@localhost:5432/interchange` and ignore `DATABASE_URL`.

`bun run test:chain` (`tests/chain/`) starts the hub on a database of its own, publishes and upgrades the workspace as Settings does, and sends GitHub's webhooks to it. GitHub and the decision model are local stand-ins, so it needs no account or key; each sidecar is a local process, and it installs the workflows' native modules from the npm registry as a deploy does. Code review needs an isolated sidecar, which a local process is not, so it is not part of the chain test.

Scripts are listed in [IMPLEMENTATION.md](IMPLEMENTATION.md#scripts).

## Check a change locally
Expand Down
3 changes: 2 additions & 1 deletion docs/IMPLEMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ A WXT browser extension that checks the open GitHub pull request locally; see
| `bun run dev` | Database migrations, then hub and portal with prefixed logs (`tooling/dev.ts`). |
| `bun run db:migrate` | Apply every database migration the hub needs to `DATABASE_URL`; run before the hub starts. |
| `bun run hub` | Hub only; does not migrate. |
| `bun run check` | Typecheck tooling, portal, extension, hub, packages and `e2e/`, and bundle the hub. |
| `bun run check` | Typecheck tooling, portal, extension, hub, packages, `e2e/` and `tests/chain/`, and bundle the hub. |
| `bun run test` | Unit and integration tests; hub tests need Postgres. |
| `bun run test:chain` | The live triage chain from webhook to pull request on one machine, against a fake GitHub and a stub decision model; needs Postgres and reaches the npm registry for native modules. |
| `bun run lint` | oxlint. |
| `bun e2e/provisioners/<name>.ts` | Live checks against real services, by hand only; see [e2e/README.md](../e2e/README.md). |
| `bun run eval` in `packages/triage-workflows` | Decision-model eval; see [DECISION_MODEL.md](DECISION_MODEL.md#measured-accuracy). |
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"apps/*",
"packages/*",
"e2e",
"tests/chain",
"vendor/interchange/packages/*",
"vendor/interchange/apps/*",
"vendor/interchange/tests/admin-ui-e2e"
Expand All @@ -28,7 +29,8 @@
"dev": "bun run db:migrate && bun --conditions=intx-src tooling/dev.ts",
"db:migrate": "bun --conditions=intx-src apps/hub/src/migrate.ts",
"test": "bun --conditions=intx-src test --path-ignore-patterns='**/*.dom.test.tsx' ./apps/ ./packages/ ./tooling/ && bun --conditions=intx-src test --preload ./apps/web/src/lib/dom-preload.ts .dom.test",
"check": "bun tooling/exact-deps-check.ts && tsc --noEmit -p tooling && tsc -b apps/web && tsc --noEmit -p apps/extension && tsc --noEmit -p apps/extension/tsconfig.background.json && tsc --noEmit -p apps/extension/e2e && tsc --noEmit -p apps/hub && tsc --noEmit -p packages/triage-workflows && tsc --noEmit -p packages/triage-manager && tsc --noEmit -p packages/triage-judge && tsc --noEmit -p packages/pr-code-review && tsc --noEmit -p packages/pr-code-review-anthropic && tsc --noEmit -p packages/pr-workflow-anthropic && tsc --noEmit -p packages/provisioner-test && tsc --noEmit -p packages/provisioner-template && tsc --noEmit -p packages/provisioner-docker && tsc --noEmit -p packages/provisioner-e2b && tsc --noEmit -p packages/provisioner-railway && tsc --noEmit -p packages/policy-check-action && tsc --noEmit -p e2e && bun build --conditions=intx-src --external @ast-grep/napi apps/hub/src/server.ts --target bun --outfile /dev/null",
"check": "bun tooling/exact-deps-check.ts && tsc --noEmit -p tooling && tsc -b apps/web && tsc --noEmit -p apps/extension && tsc --noEmit -p apps/extension/tsconfig.background.json && tsc --noEmit -p apps/extension/e2e && tsc --noEmit -p apps/hub && tsc --noEmit -p packages/triage-workflows && tsc --noEmit -p packages/triage-manager && tsc --noEmit -p packages/triage-judge && tsc --noEmit -p packages/pr-code-review && tsc --noEmit -p packages/pr-code-review-anthropic && tsc --noEmit -p packages/pr-workflow-anthropic && tsc --noEmit -p packages/provisioner-test && tsc --noEmit -p packages/provisioner-template && tsc --noEmit -p packages/provisioner-docker && tsc --noEmit -p packages/provisioner-e2b && tsc --noEmit -p packages/provisioner-railway && tsc --noEmit -p packages/policy-check-action && tsc --noEmit -p e2e && tsc --noEmit -p tests/chain && bun build --conditions=intx-src --external @ast-grep/napi apps/hub/src/server.ts --target bun --outfile /dev/null",
"test:chain": "bun --conditions=intx-src test tests/chain",
"lint": "oxlint",
"eval:review": "bun --conditions=intx-src packages/pr-code-review-anthropic/evals/review.eval.ts",
"holdback": "bun --conditions=intx-src tooling/holdback-replay.ts",
Expand Down
9 changes: 0 additions & 9 deletions packages/triage-manager/src/triage-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,6 @@ describe("triage-manager", () => {
expect(welcomed).toBeGreaterThan(ready);
});

test("rules that need the judge post nothing yet", async () => {
const { writes, host } = githubHost();
const hub = fakeHub({ takes: [{ ...PASS, request: hubRequest(JUDGED) }], dones: [ENDED] });
const { ran } = await runMail(github, wake(), host, hub.hub);
expect(ran).toEqual(["approvals", "done", "facts", "held", "judgeScope", "judgeWait", "judging", "paused", "ran", "route", "rules", "take", "triaged", "unready", "waiting"]);
expect(writes).toEqual([]);
expect(doneBody(hub.calls)).not.toHaveProperty("report");
});

test("a head the hub holds for CI gets the Waiting label and is not triaged", async () => {
const { writes, host } = githubHost();
const hub = fakeHub({ takes: [{ ...PASS, events: [mailEvent(HEAD, REQUEST), mailEvent(HEAD, { ...REQUEST, kind: WAITING_KIND }, "evt_2")] }], dones: [ENDED] });
Expand Down
Loading
Loading