diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f9198d..a50cdc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -242,7 +242,7 @@ npm treats versions as semver and semver forbids leading zeros. `envelopeFrom`, `buildManifest`, `createMeshControl`, `MESH_CONTROL_PATH`, `Manifest`, `RequestEnvelope`, `Frame` and `MeshConfig`. They stay exported, unchanged. The mesh already needs `createApp({ experimental: true })`; the tag says the same thing in the types: these are outside - the API freeze and may change in a minor release. + the API freeze and may change in any release. - **Every `304` is bodiless** (#114). A `304` has no body and no `content-*` headers on any adapter, including one from `throw new NotModified()`, which used to go out with the default JSON envelope's `content-type`. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1a5c06f..322c60c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -155,7 +155,7 @@ Bun and the edge in its `runtimes` job. - Write tests for new behavior (TDD welcome). We use Vitest. - `complexity:check` caps the cognitive complexity of every function in `src/`. What it measures is how much you have to hold in your head to follow a function from top to bottom, and it charges nesting more heavily than branching: a condition inside a closure inside a function costs several times what the same condition costs at the top level. Going over the threshold is not a verdict on your code — it means one function has grown to ask too much of whoever reads it next. The fix is nearly always to lift a nested closure out to module scope, where its branches are charged once instead of three times over. Raising `COMPLEXITY_MAX` is not the fix, even though the script suggests it. - Keep runtime dependencies at zero beyond `reflect-metadata`. -- **The public API is frozen from RC.1, and `api/` is its record.** `api/*.api.md` holds one report per export-map entry, and `npm run api:check` fails when the build declares something they do not. If you meant to change the API, run `npm run build && npm run api` and commit the regenerated report with your change, so the reviewer reads the API change as a diff rather than finding it after release. From RC.1 to stable, releases are fixes only, so a pull request that changes a report needs the owner to reopen the freeze first. The policy is in the README under [API stability](./README.md#api-stability). The check also fails when a public signature names a type its entry point does not export, because a user would have no way to name it. Mesh is `@experimental` and outside the freeze, but it is still in the report, so a mesh change shows up there too. +- **The public API is frozen from RC.1, and `api/` is its record.** `api/*.api.md` holds one report per export-map entry, and `npm run api:check` fails when the build declares something they do not. If you meant to change the API, run `npm run build && npm run api` and commit the regenerated report with your change, so the reviewer reads the API change as a diff rather than finding it after release. From RC.1 to stable, releases are fixes only, so a pull request that changes a report needs the owner to reopen the freeze first. The policy is in the README under [API stability](./README.md#api-stability). The check also fails when a public signature names a type its entry point does not export, because a user would have no way to name it. Mesh is alpha, `@experimental` and outside the freeze. Mesh adapts to the stable API and never changes it. Its own surface is the exports tagged `@experimental`, the shape of `MeshConfig` behind the `mesh` option, and the `mesh:*` lifecycle events. A mesh change may alter those and nothing else. It cannot add a `createApp` option, an `App` method or a decorator, and it cannot change a stable type. If mesh needs something the stable API does not offer, it builds on what is there. It is still in the report, so a reviewer can confirm a mesh change touched only mesh. - A new option or method on a public interface has to change that interface too. An implementation that grows a parameter without `src/app/types.ts` growing it as well is unreachable for anyone consuming the package. - New public API needs a doc note in `README.md`, **and a companion pull request to [green-tea-docs](https://github.com/Expressive-Tea/green-tea-docs) updating the page that documents it.** It is a second pull request because a pull request cannot span two repositories — link the two to each other so a reviewer can see both. The documentation site used to be built by this repository's CI, so a stale page broke the build; it is now a separate repository that imports nothing from here, and nothing fails when the two disagree. Issue #18 happened when the two still lived together, which is the reason this line exists rather than a hope. If you would rather not write the docs change, say so in your pull request and a maintainer will — an unmentioned API change is the failure this line exists to prevent, not an unwritten page. - If your change only works on one runtime, say so in the pull request. green-tea runs on Node, Deno, Bun and the edge, and behavior that quietly differs between them is treated as a bug — an explicit "not available here" is fine, silence is not. diff --git a/README.md b/README.md index 1c0df07..2fad360 100644 --- a/README.md +++ b/README.md @@ -372,7 +372,7 @@ green-tea uses **calendar versioning**: `YY.M.PATCH` (e.g. `26.8.0` = the first - **RC.1 to stable: fixes only.** No release in that window adds, removes, renames or narrows a public API. It also deprecates nothing. If a fix needs an API change, the freeze is reopened, and the change is called out under `### Breaking` in the CHANGELOG. - **After stable, deprecations come before removals.** A deprecated API keeps working for at least two monthly releases. It carries JSDoc `@deprecated` naming its replacement. Where it has a runtime path, it warns once per process through `app.logger`, never `console`. It is removed only in a release whose CHANGELOG lists the removal under `### Breaking`. - **Every API change shows up in review.** [`api/`](./api) holds the committed API report for each entry point, and CI fails when the build no longer matches it. A deliberate change regenerates the report in the same pull request. -- **Mesh is outside the promise.** It is `@experimental` and gated behind `createApp({ experimental: true })`, so it may change in any release. Its exports still appear in the reports, so those changes still show up in review. +- **Mesh is alpha and outside the promise.** It is `@experimental` and gated behind `createApp({ experimental: true })`, so it may change in any release. Mesh adapts to the stable API and never changes it. Its own surface is the exports tagged `@experimental`, the shape of `MeshConfig` behind the `mesh` option, and the `mesh:*` lifecycle events. A mesh change may alter those and nothing else. It cannot add a `createApp` option, an `App` method or a decorator, and it cannot change a stable type. If mesh needs something the stable API does not offer, it builds on what is there. Its exports still appear in the reports, so those changes still show up in review. ## License diff --git a/src/app/types.ts b/src/app/types.ts index 0925c2e..e9ac091 100644 --- a/src/app/types.ts +++ b/src/app/types.ts @@ -129,7 +129,7 @@ export interface RoutePlan { * Mesh networking options: a secret to gate this node's exports and/or remote teapots to connect to. * * @experimental Part of the mesh, which needs `createApp({ experimental: true })`: outside the - * API freeze, so it may change in a minor release. + * API freeze, so it may change in any release. */ export interface MeshConfig { secret?: string; diff --git a/src/http/ws-adapter.ts b/src/http/ws-adapter.ts index d4b3369..de1ef06 100644 --- a/src/http/ws-adapter.ts +++ b/src/http/ws-adapter.ts @@ -41,7 +41,7 @@ export function toWsRequest(request: Request, ip: string): WsRequest { * The subset of a host WebSocket that {@link eventSocket} drives (Deno's WebSocket and workerd's both satisfy it). * * @experimental Part of the mesh, which needs `createApp({ experimental: true })`: outside the - * API freeze, so it may change in a minor release. + * API freeze, so it may change in any release. */ export interface EventfulSocket { readonly readyState: number; @@ -162,7 +162,7 @@ async function pollDrained(host: Pick EventfulSocket; diff --git a/src/index.ts b/src/index.ts index 774dea6..061c6cf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -105,7 +105,7 @@ export type { TlsOptions, CorsOptions, SecurityOptions } from './security'; export type { UploadedFile, MultipartBody } from './multipart'; export type { StandardSchemaV1, StandardIssue, StandardResult } from './standard-schema'; -// Mesh — experimental (`createApp({ experimental: true })`): outside the API freeze, may change in a minor. +// Mesh — experimental (`createApp({ experimental: true })`): outside the API freeze, may change in any release. export { connectLink } from './mesh/link'; export { buildRemote, envelopeFrom } from './mesh/teacup'; export { buildManifest, createMeshControl, MESH_CONTROL_PATH } from './mesh/teapot'; diff --git a/src/mesh/link.ts b/src/mesh/link.ts index 550b232..e524130 100644 --- a/src/mesh/link.ts +++ b/src/mesh/link.ts @@ -9,7 +9,7 @@ import { encode, decode, MESH_PROTOCOL_VERSION, type Manifest, type RequestEnvel * Client handle to a remote mesh server: its manifest, an RPC caller, and a close(). * * @experimental Part of the mesh, which needs `createApp({ experimental: true })`: outside the - * API freeze, so it may change in a minor release. + * API freeze, so it may change in any release. */ export interface Link { manifest: Manifest; @@ -21,7 +21,7 @@ export interface Link { * Backoff bounds for reconnection. `false` disables reconnecting entirely. * * @experimental Part of the mesh, which needs `createApp({ experimental: true })`: outside the - * API freeze, so it may change in a minor release. + * API freeze, so it may change in any release. */ export interface ReconnectOptions { /** Delay before the first retry; doubles from here (default: 500ms). */ @@ -38,7 +38,7 @@ export interface ReconnectOptions { * cadences, and silently changing what the default means is the worst kind of breaking change. * * @experimental Part of the mesh, which needs `createApp({ experimental: true })`: outside the - * API freeze, so it may change in a minor release. + * API freeze, so it may change in any release. */ export type ManifestPolicy = 'refuse'; @@ -474,7 +474,7 @@ function backoffBounds( * `Ctor` is injectable to exercise both client implementations on a single runtime. * * @experimental Part of the mesh, which needs `createApp({ experimental: true })`: outside the - * API freeze, so it may change in a minor release. + * API freeze, so it may change in any release. */ export function connectLink(args: { url: string; diff --git a/src/mesh/protocol.ts b/src/mesh/protocol.ts index 36dbf2e..6d285bc 100644 --- a/src/mesh/protocol.ts +++ b/src/mesh/protocol.ts @@ -36,7 +36,7 @@ export const MESH_PROTOCOL_VERSION = 1; * green-tea simply ignores them, which costs the correlation of that hop and nothing else. * * @experimental Part of the mesh, which needs `createApp({ experimental: true })`: outside the - * API freeze, so it may change in a minor release. + * API freeze, so it may change in any release. */ export interface RequestEnvelope { method: string; @@ -58,7 +58,7 @@ export interface RequestEnvelope { * Manifest entry for an exported route. * * @experimental Part of the mesh, which needs `createApp({ experimental: true })`: outside the - * API freeze, so it may change in a minor release. + * API freeze, so it may change in any release. */ export interface RouteEntry { method: string; @@ -73,7 +73,7 @@ export interface RouteEntry { * lazy — the token exists in the teacup's graph, and running it is an RPC. * * @experimental Part of the mesh, which needs `createApp({ experimental: true })`: outside the - * API freeze, so it may change in a minor release. + * API freeze, so it may change in any release. */ export interface Manifest { steps: string[]; @@ -88,7 +88,7 @@ export interface Manifest { * so a protocol-level heartbeat could not work on every runtime mesh claims to support. * * @experimental Part of the mesh, which needs `createApp({ experimental: true })`: outside the - * API freeze, so it may change in a minor release. + * API freeze, so it may change in any release. */ export type Frame = | { type: 'hello'; v: number; secret: string } diff --git a/src/mesh/teacup.ts b/src/mesh/teacup.ts index 39e6434..c7c0d2e 100644 --- a/src/mesh/teacup.ts +++ b/src/mesh/teacup.ts @@ -6,7 +6,7 @@ import type { ResponseShape } from '../pipeline'; * Local proxy for a remote scope: runs the RPC and returns its token→value binding. * * @experimental Part of the mesh, which needs `createApp({ experimental: true })`: outside the - * API freeze, so it may change in a minor release. + * API freeze, so it may change in any release. */ export interface RemoteScopeNode { name: string; @@ -16,7 +16,7 @@ export interface RemoteScopeNode { * Local proxy for a remote route: forwards the request envelope over the link. * * @experimental Part of the mesh, which needs `createApp({ experimental: true })`: outside the - * API freeze, so it may change in a minor release. + * API freeze, so it may change in any release. */ export interface RemoteRoute { method: string; @@ -32,7 +32,7 @@ export interface RemoteRoute { * and its events on the far side join the same trace instead of starting a new one. * * @experimental Part of the mesh, which needs `createApp({ experimental: true })`: outside the - * API freeze, so it may change in a minor release. + * API freeze, so it may change in any release. */ export function envelopeFrom(ctx: any): RequestEnvelope { const req = ctx?.req; @@ -54,7 +54,7 @@ export function envelopeFrom(ctx: any): RequestEnvelope { * Turn a link's manifest into local proxy nodes: lazy request-scope steps, and routes. * * @experimental Part of the mesh, which needs `createApp({ experimental: true })`: outside the - * API freeze, so it may change in a minor release. + * API freeze, so it may change in any release. */ export function buildRemote(link: Link): { steps: RemoteScopeNode[]; routes: RemoteRoute[] } { const steps: RemoteScopeNode[] = link.manifest.steps.map((token) => ({ diff --git a/src/mesh/teapot.ts b/src/mesh/teapot.ts index 1c7b7dc..3984739 100644 --- a/src/mesh/teapot.ts +++ b/src/mesh/teapot.ts @@ -24,7 +24,7 @@ import { * to it on an app without a control channel closes `1008` on every adapter. * * @experimental Part of the mesh, which needs `createApp({ experimental: true })`: outside the - * API freeze, so it may change in a minor release. + * API freeze, so it may change in any release. */ export const MESH_CONTROL_PATH = '/__mesh__/control'; @@ -77,7 +77,7 @@ export function controlFrameLimit(maxBodyBytes = DEFAULT_MAX_BODY_BYTES): number * Assemble a {@link Manifest} from exported step tokens and buffered routes. * * @experimental Part of the mesh, which needs `createApp({ experimental: true })`: outside the - * API freeze, so it may change in a minor release. + * API freeze, so it may change in any release. */ export function buildManifest(args: { steps: string[]; routes: RouteEntry[] }): Manifest { return { steps: [...args.steps], routes: args.routes }; @@ -94,7 +94,7 @@ function safeEqual(left: string, right: string): boolean { * Dependencies for the mesh control handler: shared secret, manifest, and scope/route resolvers. * * @experimental Part of the mesh, which needs `createApp({ experimental: true })`: outside the - * API freeze, so it may change in a minor release. + * API freeze, so it may change in any release. */ export interface MeshControlDeps { secret: string; @@ -292,7 +292,7 @@ async function serveFrames( * Build a control handler that authenticates peers and serves scope/route RPCs from the manifest. * * @experimental Part of the mesh, which needs `createApp({ experimental: true })`: outside the - * API freeze, so it may change in a minor release. + * API freeze, so it may change in any release. */ export function createMeshControl(deps: MeshControlDeps): { path: string; diff --git a/src/pipeline.ts b/src/pipeline.ts index b526886..a980f9c 100644 --- a/src/pipeline.ts +++ b/src/pipeline.ts @@ -15,7 +15,7 @@ export interface PipelineStep { * A fully materialized HTTP response produced by a transformer. * * @experimental Public only through the mesh (`MeshControlDeps`, `RemoteRoute`), which needs - * `createApp({ experimental: true })`: outside the API freeze, so it may change in a minor release. + * `createApp({ experimental: true })`: outside the API freeze, so it may change in any release. */ export interface ResponseShape { status: number;