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 BOOTSTRAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ orun new --blueprint repo-blueprint.yaml \
--set subdomain=<workers-dev-subdomain>
```

`subdomain` is the workers.dev subdomain of the Cloudflare account you deploy
into (Workers & Pages → your subdomain). A build started from the console, or
with `orun baseline new --from bst_…`, never asks for it: the platform reads
it from the workspace's Cloudflare connection, the same one the deploy tokens
mint from. Only a hand-run build like this one passes it.

**`--run-hooks` is the difference between placing files and bootstrapping a
product.** Without it `orun new` writes the tree and stops: no repository, no
landing, no convergence watch, no probe. That is deliberate — it is what
Expand Down
7 changes: 3 additions & 4 deletions ai/context/current.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ vendor key.

| | |
|---|---|
| Latest tag | `baseline-v1` (RG5, [#6](https://github.com/sourceplane/rag-chatbot/pull/6)) |
| On `main` since | RG6 — the cirrus standard (no kiox, generated component docs, this context pack) |
| Latest tag | `baseline-v2` (RG6 — the cirrus standard, [#7](https://github.com/sourceplane/rag-chatbot/pull/7) and [#8](https://github.com/sourceplane/rag-chatbot/pull/8): no kiox, generated component docs, this context pack, and the workers.dev subdomain read from the Cloudflare connection instead of asked) |
| Before it | `baseline-v1` (RG5, [#6](https://github.com/sourceplane/rag-chatbot/pull/6)) |
| Proven live | No. Everything short of the platform is proven offline in Baseline CI, with stand-ins for Workers AI and Supabase's Management API. The real models, a deploy with the brokered token and its `AI` binding, the Terraform and db-migrate applies and a live bootstrap are still to come (risks RG-J, RG-K) |

## Where to read
Expand All @@ -37,8 +37,7 @@ vendor key.

## Next

1. Bootstrap one product from the next tag against a workspace with
1. Bootstrap one product from `baseline-v2` against a workspace with
Cloudflare and Supabase connected (two free project slots, RG-O): the first
run of the real models and of the `AI` binding under the brokered deploy
token, and the first Terraform and db-migrate applies (closes RG-J, RG-K).
2. Cut the next `baseline-vN` with `tag.yml` so the registry can pin RG6.
1 change: 1 addition & 0 deletions ai/context/decisions.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ reads in order.
| 10 | `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 (RG5), `.github/workflows/ci.yml` |
| 11 | stack-tectonic 0.19.0, not 0.20.0 | 0.20.0's lane-scoped install links `node_modules` out of the job tree, which Next 16's Turbopack refuses | `intent.yaml`, `BOOTSTRAP.md` (Troubleshooting) |
| 12 | orun is pinned only where it runs (the `orun-action` `version:` in each workflow); no kiox. Component docs are generated from the manifests and checked in CI | `kiox.yaml` pinned a version nothing ran; a hand-written copy of the dependency graph and bindings drifts silently | IMPLEMENTATION-STATUS (RG6), `tooling/catalog/gen-component-docs.py` |
| 13 | `subdomain` is read from the Cloudflare connection (`from: connection.cloudflare.workersSubdomain`), never asked | It belongs to the account like its id and has one right answer; a typed one could only be wrong, and showed up after deploy in the Open Graph origin, the smoke and the probes | `blueprint.yaml`, IMPLEMENTATION-STATUS (RG-8) |
13 changes: 13 additions & 0 deletions blueprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,19 @@ spec:
pattern: "^[a-z0-9][a-z0-9-]{0,62}$"
help: The workers.dev subdomain of the Cloudflare account the app deploys into.
example: acme
# READ FROM THE CLOUDFLARE CONNECTION, not asked. The subdomain belongs
# to the account the same way its id does, and there is exactly one
# right answer — a typed one could only be wrong, and wrong showed up
# after deploy, in the public origin the Open Graph image link is built
# from, the deploy's smoke, the phase probes and the verify URLs below.
# The integration reads it from Cloudflare at connect and on its hourly
# health check; the bootstrap door fills this input from the connection
# the build is BOUND to, the same one CLOUDFLARE_ACCOUNT_ID and the
# deploy tokens mint from, so all three name one account. The console
# renders no field for it. An account with no workers.dev subdomain
# refuses the build at the door, naming the fix, before anything is
# created.
from: connection.cloudflare.workersSubdomain

# ── PREVIEW ONLY. repo-blueprint.yaml's `orun.integrations/reconcile@v1`
# hooks mint these, brokered, during 01-product. ─────────────────────────
Expand Down
6 changes: 4 additions & 2 deletions docs/phases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ the blueprint's **required** inputs — `reponame`, `productname`,
must be supplied on every invocation, single-phase ones included. A
`--values` file is easier than repeating `--set`.

- `subdomain` — the workers.dev subdomain of the Cloudflare account. It is
in every URL the phases probe.
- `subdomain` — the workers.dev subdomain of the Cloudflare account you
deploy into. It is in every URL the phases probe. A console or
`--from bst_…` build reads it from the Cloudflare connection; pass it only
for a hand-run build.
- `orunWorkspace` — workspace id (`ws_…`). Unset, it is the workspace the
build runs in (`from: workspace`); with none anywhere, a placeholder that
fails loudly rather than silently claiming another tenant's workspace.
Expand Down
5 changes: 4 additions & 1 deletion repo-blueprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ inputs:
default: "your-workers-subdomain"
description: >-
The workers.dev subdomain of the Cloudflare account the app deploys
into — its URLs and the probes.
into — its URLs and the probes. A console or `--from bst_…` build gets
it from the workspace's Cloudflare connection (blueprint.yaml declares
`from: connection.cloudflare.workersSubdomain`); pass it with --set
only for a hand-run build.
repoPrivate:
type: boolean
default: true
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 |
|------|---------|--------|------------|
| [`rag-chatbot/`](./rag-chatbot/) | **RG** | ✅ Shipped (`baseline-v1`); live bootstrap pending | Vercel's AI SDK RAG chatbot, equivalent in code and function, on Cloudflare Workers with Supabase Postgres (pgvector) through Hyperdrive — and an Orun baseline that instantiates it in one landing, chatting on Workers AI (RG5) |
| [`rag-chatbot/`](./rag-chatbot/) | **RG** | ✅ Shipped (`baseline-v2`); live bootstrap pending | Vercel's AI SDK RAG chatbot, equivalent in code and function, on Cloudflare Workers with Supabase Postgres (pgvector) through Hyperdrive — and an Orun baseline that instantiates it in one landing, chatting on Workers AI (RG5) |

As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`.
41 changes: 40 additions & 1 deletion specs/epics/rag-chatbot/IMPLEMENTATION-STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ the code departed from `design.md` or from the upstream template.
| RG3 — Supabase and Hyperdrive from Terraform | ✅ Shipped (validated; apply gated on a linked workspace) | [#4](https://github.com/sourceplane/rag-chatbot/pull/4) |
| RG4 — ready to instantiate | ✅ Shipped | [#5](https://github.com/sourceplane/rag-chatbot/pull/5) |
| RG5 — a baseline | ✅ Shipped | [#6](https://github.com/sourceplane/rag-chatbot/pull/6) (RG-6), tagged `baseline-v1` |
| RG6 — the cirrus standard | ✅ Shipped | RG-7 — on `main` after `baseline-v1`, not yet tagged |
| RG6 — the cirrus standard | ✅ Shipped | [#7](https://github.com/sourceplane/rag-chatbot/pull/7) (RG-7), [#8](https://github.com/sourceplane/rag-chatbot/pull/8) (RG-8), tagged `baseline-v2` |

## Departures from the upstream template

Expand Down Expand Up @@ -273,6 +273,45 @@ Nothing about the chatbot changed. What changed is the baseline around it:
| 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 | RG5 "in review" on its branch | RG5 shipped ([#6](https://github.com/sourceplane/rag-chatbot/pull/6)) and tagged `baseline-v1` | the tag existed; the documents had not caught up |

### The subdomain from the Cloudflare connection (RG-8)

`subdomain` was the one input an operator typed that the platform could
answer itself: it belongs to the Cloudflare account the same way its id does,
and it has exactly one right answer. A typed one could only be wrong, and
wrong showed up after deploy — in the public origin the Open Graph image link
is built from (RG-P), the deploy's smoke, the phase probes and the console's
verify URLs. `blueprint.yaml` now declares
`from: connection.cloudflare.workersSubdomain`, as cirrus-baseline does since
baseline-v23: the Cloudflare integration reads the subdomain at connect and on
its hourly health check, and the bootstrap door fills the input from the
connection the build is bound to — the same one `CLOUDFLARE_ACCOUNT_ID` and the
deploy tokens mint from. The console renders no field for it, and an account
with no workers.dev subdomain is refused at the door with the fix named.

- `testing/manifest.test.sh` takes cirrus-baseline's rule verbatim: the source
is accepted, and only when `spec.requires.integrations` lists its provider.
- `repo-blueprint.yaml` keeps the input and its default; it, `BOOTSTRAP.md`
and `docs/phases/README.md` say only a hand-run build passes
`--set subdomain`.
- Nothing a product carries changes: the rename writes the value where it
always did (`workersDevSubdomain`, the build line's site URL, the URLs), and
the probes read it as before.

Verified:

- `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer}.test.sh`
green; `gen-component-docs.py --check` green (7 components).
- Mutation: with `cloudflare` dropped from `spec.requires.integrations`,
`manifest.test.sh` fails with exactly one finding, naming
`inputs[subdomain]`; restored, it passes.
- At v2.58.11 (the blueprint job's pin, placement included):
`orun new --status` reads the document (`01-product` pending, 145 files);
`testing/leak.test.sh` 145 files derived, 141 text files read;
`testing/placement.test.sh` 145 files placed, both landings, the product's
own plan orders supabase → cloudflare-hyperdrive → db-migrate → web on
stage and prod; exactly the five minted keys; `--resume` a no-op.
- `orun task check RG-8` complete.

## Verified (RG6)

- `testing/{manifest,phases,coverage,rebrand,retouch,bootstrap-defer}.test.sh`
Expand Down
6 changes: 3 additions & 3 deletions specs/epics/rag-chatbot/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 chat page, the route and its tools, the re

| Field | Value |
|-------|-------|
| Status | ✅ RG0–RG5 shipped (#1–#6), tagged `baseline-v1`; RG6 (the cirrus standard, RG-7) on `main`, not yet tagged. The Supabase, Hyperdrive and migration applies, a live deploy and a live bootstrap are still to come (risks RG-J, RG-K) |
| Status | ✅ RG0–RG5 shipped (#1–#6), tagged `baseline-v1`; RG6 (the cirrus standard, RG-7 #7 and RG-8 #8) tagged `baseline-v2`. The Supabase, Hyperdrive and migration applies, a live deploy and a live bootstrap are still to come (risks RG-J, RG-K) |
| Cluster | **RG** (RG0–RG6) |
| Owner(s) | `apps/web` (the app) · `packages/db` + `infra/db-migrate` (the schema) · `tests/web`, `tests/db` · `infra/terraform/{supabase,cloudflare-hyperdrive}` (the database) |
| Builds on | `lumen` conventions — the `supabase` and `cloudflare-hyperdrive` roots, `@saas/db` with the db-migrate composition, the per-request Hyperdrive client; `supabase-starter` for the repository and the rendered-wrangler shape |
| Upstream | [vercel-labs/ai-sdk-preview-rag](https://github.com/vercel-labs/ai-sdk-preview-rag) |
| Changes | Adds the Workers build, the monorepo wrapper, tests, the migration package, both Terraform roots and the deploy contract; in the template's code: `lib/db/index.ts` exports `getDb()` instead of `db`, its two callers await it, `DATABASE_URL` is optional in `lib/env.mjs` |
| Decisions locked | (1) OpenNext on Workers + Static Assets, static-assets incremental cache. (2) Postgres through Hyperdrive, a `postgres` client per call; no module-level pool. (3) pgvector stays: the schema is the template's SQL, applied by db-migrate; not Vectorize. (4) The models are Workers AI's through an `AI` binding — Llama 4 Scout for the chat, bge-base-en-v1.5 (768) for the embeddings, the column resized by a migration; `AI_GATEWAY_API_KEY` is optional and switches only the chat to upstream's gateway model (RG5; RG1–RG4 used the gateway only). (5) `wrangler.jsonc` rendered from the template: committed as the fixture render (the composition checks it exists before the build), re-rendered per environment from the Hyperdrive wiring document by the deploy lanes (RG5; it was never committed before). (6) Row-level security, no policy, on every table in `public` (RG5). (7) Infra before app on main: supabase → cloudflare-hyperdrive → db-migrate → web, enforced; advisory on pull requests (RG5). |
| Gate | RG1 is the first user-visible rung. RG2 and RG3 need a workspace with Supabase and Cloudflare connections to apply; both are verified by `plan` and `validate`. |
| Shipped as | `baseline-v1` ([#6](https://github.com/sourceplane/rag-chatbot/pull/6)), then RG6 on `main`; proven offline (Baseline CI), deploy gated until a workspace is linked |
| Shipped as | `baseline-v1` ([#6](https://github.com/sourceplane/rag-chatbot/pull/6)), then `baseline-v2` (RG6: [#7](https://github.com/sourceplane/rag-chatbot/pull/7), [#8](https://github.com/sourceplane/rag-chatbot/pull/8)); proven offline (Baseline CI), deploy gated until a workspace is linked |

## Read order

Expand All @@ -35,4 +35,4 @@ The upstream code stays the code: the chat page, the route and its tools, the re
| RG3 — Supabase and Hyperdrive from Terraform | both roots, the app's `dependsOn` and `secretEnv` | both roots validate; the wiring keys match the template's tokens |
| RG4 — ready to instantiate | README, as-built status | a reader can run, test, preview and deploy it |
| RG5 — a baseline | card, build document, rename, bootstrap tooling, Workers AI models, RLS, the product's README and context pack, tests | a new product goes from nothing to live on stage and prod in one landing, chatting on Workers AI with no AI vendor key; Baseline CI green |
| RG6 — the cirrus standard | no kiox, generated component docs, the context pack, status that agrees with the tags | Baseline CI green with the docs check |
| RG6 — the cirrus standard | no kiox, generated component docs, the context pack, status that agrees with the tags; the subdomain read from the Cloudflare connection | Baseline CI green with the docs check; the card asks for no subdomain |
3 changes: 2 additions & 1 deletion specs/epics/rag-chatbot/epic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ spec:
- "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 a product"
- "every milestone's status row agrees with the tags"
tasks: [RG-7]
- "the console card reads subdomain from the Cloudflare connection (from: connection.cloudflare.workersSubdomain), as cirrus-baseline since baseline-v23"
tasks: [RG-7, RG-8]
5 changes: 5 additions & 0 deletions specs/epics/rag-chatbot/implementation-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ chatbot itself changing.
`open-risks.md` beside the two pages a product ships with — this
repository's own, so no module places them.
- **Status that agrees with the tags.** RG5 is shipped and tagged.
- **The subdomain from the Cloudflare connection (RG-8).** The card declares
`subdomain` as `from: connection.cloudflare.workersSubdomain`, as
cirrus-baseline does since baseline-v23, so the console asks for nothing the
connection already knows; `testing/manifest.test.sh` requires the source's
provider in `spec.requires.integrations`.

**Done when**
- `git grep -i kiox` finds nothing outside this milestone's own record
Expand Down
25 changes: 25 additions & 0 deletions tasks/RG-8.TaskContract.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: orun.io/v1
kind: TaskContract
metadata:
name: RG-8
title: "The subdomain from the Cloudflare connection"
spec:
goal: "The console card reads the workers.dev subdomain from the workspace's Cloudflare connection (`from: connection.cloudflare.workersSubdomain`) instead of asking for it, as cirrus-baseline does since baseline-v23, and the manifest gate holds that source to a connection the card requires"
affects:
- blueprint.yaml
- repo-blueprint.yaml
- testing/manifest.test.sh
- BOOTSTRAP.md
- docs/phases/README.md
- ai/context/current.md
- ai/context/decisions.md
- specs/epics/README.md
- specs/epics/rag-chatbot/**
- tasks/RG-8.TaskContract.yaml
doneWhen:
- "blueprint.yaml declares `from: connection.cloudflare.workersSubdomain` on `subdomain`, so the console renders no field for it"
- testing/manifest.test.sh accepts that source only when spec.requires.integrations lists its provider, and fails naming the input when it does not (mutation-checked)
- BOOTSTRAP.md, docs/phases and repo-blueprint.yaml say only a hand-run build passes `--set subdomain`
- the contract tests, the docs check, the leak gate and the offline bootstrap are green
gates:
- checks
15 changes: 13 additions & 2 deletions testing/manifest.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,20 @@ for path in manifests:
# field for it (saas-bootstrap-console BC-K5). Two ways to get it
# wrong, and the platform refuses both — check them here too, so the
# mistake is caught in this repo rather than at a live bootstrap.
#
# A `connection.<provider>.<fact>` source is read from the connection
# the build is bound to, so the provider must be one the manifest
# requires — the platform's parser refuses it otherwise.
sources_known = ("repo.name", "repo.owner", "repo.fullName",
"connection.cloudflare.workersSubdomain")
src = field.get("from")
if src is not None and src not in ("repo.name", "repo.owner", "repo.fullName"):
B(f"inputs[{key}].from is {src!r} — must be repo.name, repo.owner or repo.fullName")
if src is not None and src not in sources_known:
B(f"inputs[{key}].from is {src!r} — must be one of {', '.join(sources_known)}")
if isinstance(src, str) and src.startswith("connection."):
provider = src.split(".")[1]
if provider not in ((spec.get("requires") or {}).get("integrations") or []):
B(f"inputs[{key}].from is {src!r} but spec.requires.integrations "
f"does not list {provider} — there is no connection to read it from")

# ── secrets: BOTH or NEITHER, checked both ways ───────────────────────
declared = {s.get("key"): (s.get("provider"), s.get("template")) for s in (spec.get("secrets") or [])}
Expand Down
Loading