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
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Changelog

All notable changes to Parlel are documented here. The format is based on
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [Unreleased]

### Added

- **Emulator contract conformance test** (`test/conformance.test.ts`). Asserts
across the whole catalog that every service has a valid manifest, a unique port,
a `src/server.js` exporting a `*Server` class, and that the class implements
`start()`, `stop()`, and `reset()`. Guards against convention drift as the
catalog grows. Includes a live boot → `/health` → `reset()` smoke test for a
representative sample of services.
- **`reset()` standardized as part of the emulator contract.** Added `reset()` to
the services that were missing it (`cassandra`, `kafka`, `mysql`, `rabbitmq`,
`elasticsearch`, `supabase`), so every emulator can be returned to a clean state
for per-test isolation and by the forthcoming Parlel control plane.

### Changed

- `CONTRIBUTING.md` now documents the full emulator contract (`reset()` required,
all state initialized inside `reset()`), and the PR checklist references the
conformance test.
25 changes: 22 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,32 @@ A service lives in `services/<slug>/` and needs three things:

### 2. `services/<slug>/src/server.js`

Export a class named `<Something>Server` with a `constructor(port, options)`,
a `start()` method (returns a promise once listening), and a `stop()` method.
Export a class named `<Something>Server` implementing the **emulator contract**:

- `constructor(port, options)` — store config; call `this.reset()`. No I/O here.
- `start()` — returns a promise that resolves once listening.
- `stop()` — returns a promise that resolves once closed.
- `reset()` — clears **all** in-memory state back to empty. Idempotent, no I/O.

`reset()` is required: it gives every test a clean slate and is what the Parlel
control plane calls between test cases. Initialize all state inside `reset()` and
call it from the constructor so the two never drift. The conformance test
(`test/conformance.test.ts`) enforces this contract across the whole catalog.

```js
import { createServer } from "node:http";

export class MyServiceServer {
constructor(port = 4900) {
this.port = port;
this.server = null;
this.reset();
}

// Clears all in-memory state back to empty. Idempotent, no I/O.
reset() {
this.things = new Map();
this.counter = 0;
}

start() {
Expand Down Expand Up @@ -104,9 +121,11 @@ npm run probe # health-check
## PR checklist

- [ ] `manifest.json`, `src/server.js`, `test/<slug>.test.ts` added.
- [ ] `*Server` implements the contract: `constructor(port, options)`, `start()`,
`stop()`, `reset()` (all state initialized in `reset()`).
- [ ] No new runtime dependencies (emulators stay pure Node).
- [ ] Port doesn't clash with an existing service.
- [ ] `npm test` passes.
- [ ] `npm test` passes (including `test/conformance.test.ts`).
- [ ] Real client library round-trips against the emulator.

## Code of conduct
Expand Down
Loading
Loading