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
6 changes: 6 additions & 0 deletions .github/workflows/baseline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ jobs:
echo "── $t"
bash "testing/$t.test.sh"
done
# Every component's docs/{overview,architecture,runbook}.md is generated
# from what the component declares (its manifest, Worker config,
# Terraform, migrations, package scripts). A pull request that changes
# one of those facts without regenerating the pages fails here.
- name: Component docs match their manifests
run: python3 tooling/catalog/gen-component-docs.py --check

# Tier 1. THE BLUEPRINT, READ AND PLACED BY THE BINARY A BOOTSTRAP RUNS.
#
Expand Down
37 changes: 37 additions & 0 deletions ai/context/current.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# hono-api — where this repository stands

The entry page for anyone (or any agent) picking this repository up. It is
this repository's own state and does not ship to an API built from it; the two
pages that do are [operations.md](operations.md) and
[deployment.md](deployment.md).

## What it is

Vercel's Hono boilerplate as one Cloudflare Worker, packaged as an Orun
baseline: `orun new --blueprint repo-blueprint.yaml` builds a new API in its
own repository and takes it to live on stage and prod in one landing
(`01-product`), then records what went live (`02-docs`).

## Release

| | |
|---|---|
| Latest tag | `baseline-v1` (HA3) |
| On `main` since | HA4 — the cirrus standard (no kiox, generated component docs, this context pack) |
| Proven live | No. Everything short of the platform is proven offline in Baseline CI; a live bootstrap from a tag is still to come (risk HA-F) |

## Where to read

| Question | Page |
|---|---|
| What shipped, and every departure from upstream | `specs/epics/hono-api/IMPLEMENTATION-STATUS.md` |
| Why it is built this way | [decisions.md](decisions.md), then `specs/epics/hono-api/design.md` |
| What could still go wrong | [open-risks.md](open-risks.md), then `specs/epics/hono-api/risks-and-open-questions.md` |
| How to instantiate it | `BOOTSTRAP.md`, `docs/phases/` |
| What each component is | `apps/api/docs/`, `tests/api/docs/` (generated; `python3 tooling/catalog/gen-component-docs.py`) |

## Next

1. Bootstrap one API from the next tag against a workspace, and record its
timings (closes HA-F).
2. Cut the next `baseline-vN` with `tag.yml` so the registry can pin HA4.
18 changes: 18 additions & 0 deletions ai/context/decisions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# hono-api — decisions

The choices that shape this repository, one line each, with where the full
reasoning lives. Superseded decisions stay listed, marked, so the history
reads in order.

| # | Decision | Why | Source |
|---|---|---|---|
| 1 | A plain Worker (`cloudflare-worker-turbo`), no adapter and no Pages Functions | Hono's default export already is a Workers module handler | `specs/epics/hono-api/design.md` |
| 2 | `wrangler.jsonc` is committed, not rendered | The Worker binds nothing, so there is nothing to wire; the lane's structure check finds it before any build | design.md, `apps/api/component.yaml` |
| 3 | Per-environment deploys through wrangler `env` sections | `hono-api-api-{stage,prod}`, the same shape cirrus-baseline's workers deploy with | design.md |
| 4 | No infra root | Nothing to provision; `infra/` and `packages/` stay as empty discovery roots | `repo-blueprint.yaml` (`discovery-roots`) |
| 5 | `GET /health` and one name seam (`apps/api/src/identity.ts`) | The deploy smoke and the bootstrap's probes read it; the rename rewrites one literal | IMPLEMENTATION-STATUS (HA3) |
| 6 | One landing (`01-product`) then the record (`02-docs`) | A landing has a fixed cost; the plan, not the phases, carries deploy order (cirrus-baseline since baseline-v22) | `repo-blueprint.yaml` |
| 7 | `ci.yml` plans nothing while `intent.yaml` names `ws_CHANGE_ME` | A bootstrap cannot set a repository variable (replaced the `ORUN_CI` gate) | IMPLEMENTATION-STATUS (HA3) |
| 8 | stack-tectonic 0.19.0, not 0.20.0 | The family's one pin: 0.20.0's linked install breaks the Next.js baselines | risk HA-J |
| 9 | orun is pinned only where it runs (the `orun-action` `version:` in each workflow); no kiox | `kiox.yaml` pinned a version nothing ran | IMPLEMENTATION-STATUS (HA4) |
| 10 | Component docs are generated from the manifests and checked in CI | A hand-written copy of the dependency graph and bindings drifts silently | `tooling/catalog/gen-component-docs.py` |
16 changes: 16 additions & 0 deletions ai/context/open-risks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# hono-api — open risks

What is not yet proven or not yet decided. The full write-up of every risk,
including the accepted and resolved ones, is
`specs/epics/hono-api/risks-and-open-questions.md`; this page lists only what
is still live, so it should be short.

| ID | Risk | State | What closes it |
|---|---|---|---|
| HA-F | No live bootstrap yet: the repository created and linked, the deploy token minted, a real `wrangler deploy`, the smoke and the probes against workers.dev are all unproven | OPEN | One bootstrap from a tag against a workspace |
| HA-G | `orun plan --changed` plans nothing for a push with no `before`; the first landing relies on merging into orun's seeded initial commit | WATCH | Confirmed by the first live bootstrap |

Accepted, and worth knowing before you change them: HA-C (wrangler's
multi-environment warning on the local build), HA-H (a custom domain is the
owner's step), HA-J (stack-tectonic 0.19.0), HA-K (`/` does not carry the
API's name).
18 changes: 18 additions & 0 deletions apps/api/docs/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# api — architecture

Built by the turbo pipeline from `apps/api` and deployed with wrangler.

| | |
| ------------------- | ------------------------- |
| Worker config | `apps/api/wrangler.jsonc` |
| Entry | `src/index.ts` |
| Compatibility date | `2026-10-01` |
| Compatibility flags | `nodejs_compat` |

## Bindings

None: the Worker binds no storage or service.

## Variables

`ENVIRONMENT` — overridden per environment (`dev`, `prod`, `stage`).
20 changes: 20 additions & 0 deletions apps/api/docs/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# api

The Hono API (a plain Cloudflare Worker, per environment)

A Cloudflare Worker, deployed per environment by its CI lane.

| | |
| ------------ | ------------------------------------------------------------------------------------------------------------------ |
| Type | `cloudflare-worker-turbo` |
| Source | `apps/api` |
| Package | `@app/api` |
| Environments | `dev`: `verify` · `stage`: `verify`, `deploy` on a push to `main` · `prod`: `verify`, `deploy` on a push to `main` |

## Depends on

- (none)

## Depended on by

- (none)
36 changes: 36 additions & 0 deletions apps/api/docs/runbook.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# api — runbook

## How it runs

Pull requests verify it; a merge to `main` deploys it to `stage`, `prod`.
CI plans what changed (`orun plan --changed`) and runs each lane with `orun run`;
the plan orders a component after everything it depends on.

## Local commands

```bash
pnpm --filter @app/api dev
pnpm --filter @app/api build
pnpm --filter @app/api typecheck
pnpm --filter @app/api lint
```

## Verify

After a deploy the lane runs this smoke against the environment it
deployed (`ORUN_ENVIRONMENT`); `DEPLOYED_URL` overrides the URL:

```bash
base="${DEPLOYED_URL:-https://hono-api-api-${ORUN_ENVIRONMENT}.your-workers-subdomain.workers.dev}" && health="$(curl -sf --max-time 20 "${base}/health")" && echo "${health}" | grep -q "\"status\":\"ok\"" && echo "${health}" | grep -q "\"environment\":\"${ORUN_ENVIRONMENT}\""
```

## Rollback

Revert the commit on `main`. The next convergence applies the previous desired
state; nothing was changed out of band, so there is nothing else to undo.

## Common failures

- **The smoke fails right after a first deploy**: a new workers.dev route can
answer 4xx for a few seconds and the lane retries. A failure that persists
is a regression in the deployed code.
2 changes: 1 addition & 1 deletion docs/phases/01-product.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**Places** everything an API built from this baseline is made of, as ONE
pull request: the root manifests (`intent.yaml`, `package.json`, the pnpm
workspace and lockfile, `turbo.json`, the kiox pin), `.github/workflows`
workspace and lockfile, `turbo.json`), `.github/workflows`
(`ci.yml` and `checks.yml` — the baseline's own `baseline.yml` and
`tag.yml` are ignored), the shared TypeScript/ESLint config and the wrangler
renderer, the API's README and its two context pages, the identity file
Expand Down
11 changes: 0 additions & 11 deletions kiox.lock

This file was deleted.

6 changes: 0 additions & 6 deletions kiox.yaml

This file was deleted.

12 changes: 1 addition & 11 deletions repo-blueprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,6 @@ modules:
source: baseline
from: turbo.json
to: turbo.json
- name: root-kiox
mode: copy
source: baseline
from: kiox.yaml
to: kiox.yaml
- name: root-kiox-lock
mode: copy
source: baseline
from: kiox.lock
to: kiox.lock
- name: root-gitignore
mode: copy
source: baseline
Expand Down Expand Up @@ -381,7 +371,7 @@ phases:
await: "One convergence is deploying the API to stage and prod: install, build, deploy and a smoke against /health in each. Nothing is stuck."
done: "{{ .inputs.reponame }} is live on stage and prod — {{ .meta.files }} files on main, branded as {{ .inputs.productname }}, /health answering on both. That took {{ .meta.elapsed }}."
failed: "The API did not come up. The failing lane above names the step — the build, the deploy or the smoke — and a provider error is in its log; whatever deployed is still there."
modules: [ai-deployment, ai-operations, api, api-tests, discovery-roots, github-workflows, rebrand-values, root-gitignore, root-intent, root-kiox, root-kiox-lock, root-package-json, root-pnpm-lock, root-pnpm-workspace, root-readme, root-turbo, tooling-eslint, tooling-tsconfig, tooling-wire, vscode]
modules: [ai-deployment, ai-operations, api, api-tests, discovery-roots, github-workflows, rebrand-values, root-gitignore, root-intent, root-package-json, root-pnpm-lock, root-pnpm-workspace, root-readme, root-turbo, tooling-eslint, tooling-tsconfig, tooling-wire, vscode]
# THE PLATFORM MUST BE ABLE TO SEE THE REPOSITORY BEFORE IT EXISTS. Every
# phase lands a pull request that files under its task, and the platform
# learns of a PR only through the GitHub App installation on the account
Expand Down
2 changes: 1 addition & 1 deletion specs/epics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ folder is the adoption; the merge creates the epic in the workspace.

| Epic | Cluster | Status | What it is |
|------|---------|--------|------------|
| [`hono-api/`](./hono-api/) | **HA** | 🟡 In progress | Vercel's Hono boilerplate, equivalent in code and function, as a Cloudflare Worker — and an Orun baseline that instantiates it in one landing (HA3) |
| [`hono-api/`](./hono-api/) | **HA** | ✅ Shipped (`baseline-v1`); live bootstrap pending | Vercel's Hono boilerplate, equivalent in code and function, as a Cloudflare Worker — and an Orun baseline that instantiates it in one landing (HA3) |

As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`.
32 changes: 31 additions & 1 deletion specs/epics/hono-api/IMPLEMENTATION-STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ the code departed from `design.md` or from the upstream template.
| HA0 — the spec | ✅ Shipped | [#1](https://github.com/sourceplane/hono-api/pull/1) |
| HA1 — the API on Workers | ✅ Shipped | [#2](https://github.com/sourceplane/hono-api/pull/2) |
| HA2 — ready to instantiate | ✅ Shipped | [#3](https://github.com/sourceplane/hono-api/pull/3) |
| HA3 — a baseline | 🟡 In review | this PR (HA-4), to be tagged `baseline-v1` |
| HA3 — a baseline | ✅ Shipped | [#4](https://github.com/sourceplane/hono-api/pull/4) (HA-4), tagged `baseline-v1` |
| HA4 — the cirrus standard | ✅ Shipped | HA-5 — on `main` after `baseline-v1`, not yet tagged |

## Departures from the upstream template

Expand Down Expand Up @@ -54,6 +55,35 @@ unchanged.
| discovery roots | `apps/`, `tests/` only | `infra/.gitkeep`, `packages/.gitkeep` too | `orun plan` refuses a missing discovery root (`stat infra: no such file or directory`) — `ci.yml` had never planned here |
| `tasks/HA-1..3` | no `metadata` | `metadata.name` and `title` | `orun work check` (2.79) refused them |

## The cirrus standard (HA4)

Nothing about the API changed. What changed is the baseline around it:

| What | Before | After | Why |
|---|---|---|---|
| orun pin | `kiox.yaml` (v2.15.0) + `kiox.lock`, shipped to every API | gone; orun is pinned where it runs, the `orun-action` `version:` in each workflow | nothing ran the kiox pin, and it disagreed with the lanes (v2.78.4) |
| `root-kiox`, `root-kiox-lock` modules | in `01-product` | removed (`testing/phases.test.sh` follows) | an API is placed with 38 + 6 files: no kiox, plus the docs below |
| component docs | none | `apps/api/docs/` and `tests/api/docs/` — `overview.md`, `architecture.md`, `runbook.md` | cirrus-baseline documents every component; the workspace Docs library renders `docs/` beside each `component.yaml` |
| how the docs stay true | — | `tooling/catalog/gen-component-docs.py` derives them from the manifest, the Worker config, Terraform, migrations and package scripts; Baseline CI runs it with `--check` | a hand-written copy of a manifest drifts silently |
| context pack | `operations.md`, `deployment.md` | plus `current.md`, `decisions.md`, `open-risks.md` | cirrus-baseline's shape; the three new pages are this repository's own and no module places them (the leak gate still allows exactly two) |
| status | HA3 "in review" | HA3 shipped and tagged `baseline-v1` | the tag existed; the documents had not caught up |

## Verified (HA4)

- `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer}.test.sh`
green; `gen-component-docs.py --check` green.
- `testing/leak.test.sh`: 44 files derived (40 − 2 kiox + 6 docs pages), every
one read; ai/context still exactly the two declared pages; the generated
pages name no factory path.
- `testing/placement.test.sh`: 44 files placed, both landings, branded,
re-tenanted; the API's own `orun plan` deploys `api` to stage and prod.
- `pnpm install --frozen-lockfile`, `wire:fixture`, `typecheck`, `lint`,
`test` (5 tests), `build` green.
- `testing/e2e.test.sh` green: the stage lane's planned steps in a staged job
tree, `wrangler dev --env stage`, the component's own smoke.
- `orun task check HA-5` complete.
- Locally with orun 2.85.0; CI pins v2.58.11 (blueprint) and v2.78.4 (lanes).

## Verified (HA3)

- `orun new --status` reads the blueprint at v2.58.11 (the bootstrap floor),
Expand Down
7 changes: 4 additions & 3 deletions specs/epics/hono-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ The upstream code stays the code. The port adds the Worker's config (`wrangler.j

| Field | Value |
|-------|-------|
| Status | 🟡 HA0–HA2 shipped (#1, #2, #3); HA3 — a baseline — in this PR (HA-4), not yet proven by a live bootstrap |
| Cluster | **HA** (HA0–HA3) |
| Status | ✅ HA0–HA3 shipped (#1–#4), tagged `baseline-v1`; HA4 (the cirrus standard, HA-5) on `main`, not yet tagged. Not yet proven by a live bootstrap (risk HA-F) |
| Cluster | **HA** (HA0–HA4) |
| Owner(s) | `apps/api` (the Worker) · `tests/api` (the in-process request tests) |
| Builds on | `cirrus-baseline` conventions (intent, components, `checks.yml` gate, gated `ci.yml`) and the `cloudflare-worker-turbo` composition its workers deploy with — no bounded context of the fleet is needed |
| Upstream | [vercel/examples `framework-boilerplates/hono`](https://github.com/vercel/examples/tree/main/framework-boilerplates/hono) |
| Changes | Adds the Worker config, the monorepo wrapper, tests and the deploy contract; the template's app code is untouched but for the welcome line's link |
| Decisions locked | (1) A plain Worker (`cloudflare-worker-turbo`), not Pages Functions and not an adapter: Hono's default export is already a Workers module handler. (2) `wrangler.jsonc` is committed, not rendered: the Worker binds nothing, so there is nothing to wire. (3) Per-environment deploys through wrangler `env` sections (`--env stage` / `--env prod`), naming `hono-api-api-{stage,prod}`. (4) No infra root. |
| Gate | HA1 is the first user-visible rung (the API serves from a Worker). |
| Shipped as | `main` after [#3](https://github.com/sourceplane/hono-api/pull/3); verified locally under `wrangler dev` and the `--env prod` dry run, deploy gated until a workspace is linked |
| Shipped as | `baseline-v1` ([#4](https://github.com/sourceplane/hono-api/pull/4)), then HA4 on `main`; proven offline (Baseline CI), deploy gated until a workspace is linked |

## Read order

Expand All @@ -33,3 +33,4 @@ The upstream code stays the code. The port adds the Worker's config (`wrangler.j
| HA1 — the API on Workers | `apps/api` bundled by wrangler, `tests/api`, green checks | `wrangler dev` answers `/` with the welcome text; Checks green |
| HA2 — ready to instantiate | README, as-built status | a reader can run, test, preview and deploy it |
| HA3 — a baseline | card, build document, rename, bootstrap tooling, tests | a new API goes from nothing to live in one landing; Baseline CI green |
| HA4 — the cirrus standard | no kiox, generated component docs, the context pack, status that agrees with the tags | Baseline CI green with the docs check |
2 changes: 1 addition & 1 deletion specs/epics/hono-api/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ apps/api the template (src/index.ts) + the Worker config
tests/api vitest: app.request("/") in-process — no server, no workerd
tooling/* shared tsconfig / eslint / wrangler wiring renderer (unused here: nothing to wire)
intent.yaml environments dev (verify) · stage · prod; `work:` points at specs/epics and tasks
.github/workflows checks.yml (merge gate) · ci.yml (Orun lanes, gated by the ORUN_CI variable)
.github/workflows checks.yml (merge gate) · ci.yml (Orun lanes; plans nothing while intent.yaml names ws_CHANGE_ME)
```

## 4. The build
Expand Down
7 changes: 7 additions & 0 deletions specs/epics/hono-api/epic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,10 @@ spec:
- "an API built from it carries the API only, renamed throughout to its own name, repository and Worker, through one seam (apps/api/src/identity.ts), and no shipped file names a factory path"
- "Baseline CI is green: contract tests, the blueprint read by the pinned orun, the leak gate, the offline bootstrap and the end-to-end tier — the stage lane's planned steps in a staged job tree, the Worker served by wrangler dev and smoke-tested on /health"
tasks: [HA-4]
- name: "HA4 — the cirrus standard"
exitCriteria:
- "nothing outside this milestone's own record names kiox: orun is pinned where CI runs it (the orun-action `version:` in each workflow)"
- "every component carries generated docs/{overview,architecture,runbook}.md, and Baseline CI fails a pull request whose manifests and pages disagree"
- "ai/context carries this repository's current.md, decisions.md and open-risks.md, and none of them ships to an API"
- "every milestone's status row agrees with the tags"
tasks: [HA-5]
Loading
Loading