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
41 changes: 41 additions & 0 deletions .github/workflows/baseline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,42 @@ jobs:
- run: bash testing/leak.test.sh
# The tools the phases' hooks run, against this tree.
- run: bash testing/retouch.test.sh
# A product's secret refs name the product's workspace, not this one's.
- run: bash testing/tenancy.test.sh
- run: bash testing/tag-gate.test.sh

# THE BUILD DOCUMENT RUNS WITH THE BINARY A BOOTSTRAP ACTUALLY RUNS.
#
# The contract suite above reads `repo-blueprint.yaml` with PyYAML, which
# parses anything well-formed. As first pushed to this repository the document
# was refused by every released orun at phase one —
#
# ✕ action orun.pr/land@v1 has no parameter "repo"
# ✕ input "domain" has unknown type "bool"
#
# — with every gate green, because none of them asked orun. This job pins the
# bootstrap FLOOR (BOOTSTRAP.md: v2.60, where the run-level
# `hooks.preInstantiate` list arrives) and makes orun place the whole tree,
# hooks off: offline, no credential, about ten seconds.
blueprint-runs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: sourceplane/orun-action@v1.2.0
with:
version: v2.60.0
- uses: actions/setup-node@v5
with:
node-version: 22
package-manager-cache: false
- name: Python + PyYAML
run: python3 -c 'import yaml' || pip install --quiet pyyaml
- name: Tier 1 — the tree is placed, branded, and made to answer
run: |
set -euo pipefail
orun --version
bash testing/placement.test.sh

# The migration checksums. This lived in `verify.yml` and travelled into every
# product, where `tooling/migrations/` does not exist because no module places
# it — the lane could only be red. It is the baseline's own invariant, so it
Expand All @@ -64,7 +98,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
# `package-manager-cache: false` is load-bearing. setup-node@v5 reads
# `packageManager` from the ROOT package.json and turns pnpm caching on by
# itself, then fails looking for a pnpm this job never installs. Inside
# Cirrus this workflow never ran — a nested `.github/` is inert — so the
# first run of this lane was the first push of the split repository, and
# it was red. The script needs node and nothing else.
- uses: actions/setup-node@v5
with:
node-version: 22
package-manager-cache: false
- run: node tooling/migrations/rechecksum.mjs --check
2 changes: 1 addition & 1 deletion ai/context/open-risks.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
| R2 | Broadcast size: a Worker invocation has CPU and subrequest limits; a large list must be paced. | mail-worker sends in batches and records progress per delivery, so a re-run resumes. Queues are the upgrade path (see the epic's open questions). |
| R3 | Abuse of public write paths (subscribe, forms, reactions). | KV token-bucket rate limiting per fingerprint + optional Turnstile + honeypot; fail-open so an outage never takes the site down. |
| R4 | The owner token is a single secret. | Constant-time comparison, never logged, rotated via `wrangler secret put`; the CLI reads it from the environment only. |
| R5 | No Virga product has been bootstrapped end to end yet. | The phases are one selection each on `repo-blueprint.yaml`, ported from Cirrus's one-document model in VG8; the first bootstrap records real timings in `docs/phases/TIMINGS.md`. |
| R5 | No Virga product has been bootstrapped end to end yet, and no phase has run with its hooks on. | Placement is gated (`testing/placement.test.sh`); everything past it is listed, with what would prove it, in [`docs/GAPS.md`](../../docs/GAPS.md). The first bootstrap records real timings in `docs/phases/TIMINGS.md`. |
4 changes: 2 additions & 2 deletions apps/mail-worker/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ spec:
- component: cloudflare-d1
- component: db-migrate
secretEnv:
WIRING_CLOUDFLARE_D1_STAGE: "secret://lumen/virga/stage/WIRING_CLOUDFLARE_D1"
WIRING_CLOUDFLARE_D1_PROD: "secret://lumen/virga/prod/WIRING_CLOUDFLARE_D1"
WIRING_CLOUDFLARE_D1_STAGE: "secret://virga/virga/stage/WIRING_CLOUDFLARE_D1"
WIRING_CLOUDFLARE_D1_PROD: "secret://virga/virga/prod/WIRING_CLOUDFLARE_D1"

subscribe:
environments:
Expand Down
8 changes: 4 additions & 4 deletions apps/site-api/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ spec:
# Wiring documents from orun secrets: lease-published by the infra
# components; wire-live renders the wrangler template from these.
secretEnv:
WIRING_CLOUDFLARE_D1_STAGE: "secret://lumen/virga/stage/WIRING_CLOUDFLARE_D1"
WIRING_CLOUDFLARE_D1_PROD: "secret://lumen/virga/prod/WIRING_CLOUDFLARE_D1"
WIRING_CLOUDFLARE_KV_STAGE: "secret://lumen/virga/stage/WIRING_CLOUDFLARE_KV"
WIRING_CLOUDFLARE_KV_PROD: "secret://lumen/virga/prod/WIRING_CLOUDFLARE_KV"
WIRING_CLOUDFLARE_D1_STAGE: "secret://virga/virga/stage/WIRING_CLOUDFLARE_D1"
WIRING_CLOUDFLARE_D1_PROD: "secret://virga/virga/prod/WIRING_CLOUDFLARE_D1"
WIRING_CLOUDFLARE_KV_STAGE: "secret://virga/virga/stage/WIRING_CLOUDFLARE_KV"
WIRING_CLOUDFLARE_KV_PROD: "secret://virga/virga/prod/WIRING_CLOUDFLARE_KV"

subscribe:
environments:
Expand Down
113 changes: 113 additions & 0 deletions docs/GAPS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Gaps — what is proven about this baseline, and what is not

Written 2026-10-01, when Virga was split out of `sourceplane/cirrus` into this
repository, made public, and attached to its own workspace. Every line under "proven" was
run, not inferred; every line under "not proven" names what would prove it.
Delete an entry when it stops being true — a gaps file that is never shortened
is a file nobody reads.

## Proven

| What | How |
|---|---|
| The build document is one orun can run. | `testing/placement.test.sh` places the whole blueprint with hooks off, under orun v2.60.0 (the floor) and v2.71.0. Baseline CI's `blueprint-runs` job repeats it on every pull request. |
| A product placed from it is a product. | The placed tree is branded as `01-scaffold` brands it: no factory path, no baseline identity, `intent.yaml` and all 18 secret refs naming the product's workspace. |
| That product builds. | A placed, branded product passed its own `install`, `wire:fixture`, `typecheck`, `lint`, `test` and `build`. Run by hand once; **not** a gate. |
| The static contract holds. | `coverage`, `phases`, `manifest`, `leak`, `retouch`, `tag-gate`, `tenancy` — all in Baseline CI. |
| This repository is attached to a workspace. | `orun workspace` resolves `ws_F6PEAMKD` (`virga`) from `intent.yaml`; `orun cloud check` reports `sourceplane/virga` allow-listed; `orun plan` resolves 16 components into 33 jobs. |
| CI reaches the platform without a credential. | With `ORUN_CI=true`, run 36834192908 planned 12 jobs and each run lane was answered by the platform: `secret resolution failed … Secret not found (code: not_found) [requestId: req_…]`. That is the answer a workspace with no minted secrets should give. |
| An unproven tag cannot be pushed. | The ruleset `baseline-tags-restrict-creation` refused `baseline-v0-ruleset-probe` from an org admin: `Cannot create ref due to creations being restricted`. |

## Not proven

### 1. No phase has ever run with its hooks on

Placement proves the document parses and the files land. It does not run
`orun.task/ensure`, `orun.repo/ensure`, `orun.pr/land`, `orun.run/watch`,
`orun.integrations/reconcile`, `orun.secrets/exists` or `orun.http/probe` —
which is everything a bootstrap does that is not copying a file. Two defects
that stopped the document at phase one (`repo:` on `orun.pr/land@v1`, and
`type: bool`) were found only because placement was finally run; the same
class of defect in a hook's *behaviour* is still unlooked-for.

*Would prove it:* one real `orun new --resume --run-hooks` into a throwaway
repository and workspace.

### 2. There is no rehearsal, so there is no tag — deliberately, for now

`rehearsal.yml` and `testing/rehearsal/` are not ported from Cirrus. The tag
gate therefore answers exit 3, "the question could not be answered", for every
commit, and `baseline-v1` does not exist. Left out on purpose at the split: a
harness that creates and destroys real Cloudflare resources should not be
written without being run.

Consequences that follow from it and are easy to forget:

- **Virga is not in the registry.** `orun baseline list` shows `cirrus`,
`lumen` and `multi-tenant-saas`. A row in orun-cloud's
`infra/baselines-registry/baselines.yaml` needs a tag to pin, and the sync
refuses a tag that does not exist. Nobody can build from Virga through the
console until this is closed.
- **`docs/phases/TIMINGS.md` and `expectedMinutes: 43` are estimates.** No
bootstrap has been timed.

### 3. The tag ruleset is binding in one direction only

The ruleset restricts creation of `baseline-v*` and has **no bypass actor**.
GitHub refuses the Actions integration on a bypass list (`Actor GitHub Actions
integration must be part of the ruleset source or owner organization`), so
"`tag.yml`'s token is the only creator" cannot be expressed with
`GITHUB_TOKEN`. Today that costs nothing, because the gate refuses everything.
The day a rehearsal goes green, `tag.yml`'s `cut` job will pass the gate and
then be refused by the ruleset.

*Closes it:* a GitHub App or a deploy key on the bypass list, and `cut`
creating the tag with that identity. It also only restricts **creation** —
moving an existing tag is not restricted, and should be once one exists.

### 4. The workspace is not yet one a bootstrap can finish in

Cloudflare is connected (inherited from the account, `Nexo@sourceplane.ai's
Account`), and `orun baseline check cirrus` — the nearest registered
Cloudflare-only baseline — answers `ready to build` here. What is left:

- **The token's D1 Write permission group is unchecked.** Without it
`03-infrastructure`'s `d1-edit` mint is refused with
`parent_grant_insufficient`, and nothing short of a mint proves it either
way. The `d1-edit` template is listed as active, which says the platform
offers it, not that the connection's token can grant it.
- **GitHub is connected to the wrong account.** The only connection is
inherited from the account and is to `pullely`, a user. The platform learns
of a pull request through the App installation on the account that OWNS the
repository — `sourceplane` — so `orun integrations list` says "github:
active" and the landings would still not be filed.
- **No admin-role API key has been minted.** Builder and viewer keys read
fine and have their secret writes denied, masked as `not_found`.
- **No secrets.** `orun secrets list` is empty, which is why every run lane
above failed, and why `ORUN_CI` is **unset** again: the variable exists so a
pre-bootstrap repository is not red, and this is one. Set it with
`gh variable set ORUN_CI --body true` once this repository's own secrets
exist.

### 5. This repository's own environments have never deployed

`intent.yaml` declares `dev`, `stage` and `prod` with `BASE_DOMAIN: virga.site`.
With `ORUN_CI` on, a push to `main` converges them for real. Whether the
`virga.site` zone exists in the connected Cloudflare account is unchecked.

### 6. Smaller things, written down so they are not rediscovered

- `kiox.lock` keeps `name: virga` in a product while `kiox.yaml` is renamed —
the rebrand excludes lock files. Cirrus does the same. Harmless so far.
- The secret refs here use the workspace **slug** (`secret://virga/virga/…`)
on purpose: the rebrand's scoped rule matches `[a-z0-9-]+`, so a `ws_…` id
in that segment would not be rewritten and a product would keep this tenant.
- `orun workspace create` cannot name an account, and a login that owns more
than one is refused. This workspace was created with a locally patched CLI
that sends `accountId`. The released CLI still cannot do it.
- **This repository is public because its workspace is.** `virga` is under the
openproduct account, whose workspaces are public and whose covenant is that
their repositories are too. It was made public on 2026-10-01 for that reason;
its tree was already public inside `sourceplane/cirrus`. Making it private
again breaches the covenant — move it to a workspace under a standard account
first.
6 changes: 3 additions & 3 deletions infra/db-migrate/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ spec:
# connection fact, and the database id arrives in the wiring document the
# cloudflare-d1 component lease-publishes.
secretEnv:
CLOUDFLARE_API_TOKEN: "secret://lumen/virga/{{ .environment }}/CLOUDFLARE_D1_TOKEN"
CLOUDFLARE_ACCOUNT_ID: "secret://lumen/virga/{{ .environment }}/CLOUDFLARE_ACCOUNT_ID"
WIRING_CLOUDFLARE_D1: "secret://lumen/virga/{{ .environment }}/WIRING_CLOUDFLARE_D1"
CLOUDFLARE_API_TOKEN: "secret://virga/virga/{{ .environment }}/CLOUDFLARE_D1_TOKEN"
CLOUDFLARE_ACCOUNT_ID: "secret://virga/virga/{{ .environment }}/CLOUDFLARE_ACCOUNT_ID"
WIRING_CLOUDFLARE_D1: "secret://virga/virga/{{ .environment }}/WIRING_CLOUDFLARE_D1"

subscribe:
environments:
Expand Down
6 changes: 3 additions & 3 deletions infra/terraform/cloudflare-d1/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ spec:
# touch D1). Declared at component level because plan-only lanes refresh
# against the live Cloudflare API too, not just apply.
secretEnv:
CLOUDFLARE_API_TOKEN: "secret://lumen/virga/{{ .environment }}/CLOUDFLARE_D1_TOKEN"
CLOUDFLARE_API_TOKEN: "secret://virga/virga/{{ .environment }}/CLOUDFLARE_D1_TOKEN"
# Non-secret connection fact (account-id template).
CLOUDFLARE_ACCOUNT_ID: "secret://lumen/virga/{{ .environment }}/CLOUDFLARE_ACCOUNT_ID"
TF_VAR_cloudflare_account_id: "secret://lumen/virga/{{ .environment }}/CLOUDFLARE_ACCOUNT_ID"
CLOUDFLARE_ACCOUNT_ID: "secret://virga/virga/{{ .environment }}/CLOUDFLARE_ACCOUNT_ID"
TF_VAR_cloudflare_account_id: "secret://virga/virga/{{ .environment }}/CLOUDFLARE_ACCOUNT_ID"

subscribe:
environments:
Expand Down
6 changes: 3 additions & 3 deletions infra/terraform/cloudflare-domain/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ spec:
- component: web-site

secretEnv:
CLOUDFLARE_API_TOKEN: "secret://lumen/virga/{{ .environment }}/CLOUDFLARE_API_TOKEN"
CLOUDFLARE_ACCOUNT_ID: "secret://lumen/virga/{{ .environment }}/CLOUDFLARE_ACCOUNT_ID"
TF_VAR_cloudflare_account_id: "secret://lumen/virga/{{ .environment }}/CLOUDFLARE_ACCOUNT_ID"
CLOUDFLARE_API_TOKEN: "secret://virga/virga/{{ .environment }}/CLOUDFLARE_API_TOKEN"
CLOUDFLARE_ACCOUNT_ID: "secret://virga/virga/{{ .environment }}/CLOUDFLARE_ACCOUNT_ID"
TF_VAR_cloudflare_account_id: "secret://virga/virga/{{ .environment }}/CLOUDFLARE_ACCOUNT_ID"

# PARKED BY DESIGN — no environment subscriptions, so no jobs are planned.
# A fresh product has no zone in the connected account, and
Expand Down
6 changes: 3 additions & 3 deletions infra/terraform/cloudflare-kv/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ spec:
secretOutputs: "WIRING_CLOUDFLARE_KV=wiring"

secretEnv:
CLOUDFLARE_API_TOKEN: "secret://lumen/virga/{{ .environment }}/CLOUDFLARE_API_TOKEN"
CLOUDFLARE_ACCOUNT_ID: "secret://lumen/virga/{{ .environment }}/CLOUDFLARE_ACCOUNT_ID"
TF_VAR_cloudflare_account_id: "secret://lumen/virga/{{ .environment }}/CLOUDFLARE_ACCOUNT_ID"
CLOUDFLARE_API_TOKEN: "secret://virga/virga/{{ .environment }}/CLOUDFLARE_API_TOKEN"
CLOUDFLARE_ACCOUNT_ID: "secret://virga/virga/{{ .environment }}/CLOUDFLARE_ACCOUNT_ID"
TF_VAR_cloudflare_account_id: "secret://virga/virga/{{ .environment }}/CLOUDFLARE_ACCOUNT_ID"

subscribe:
environments:
Expand Down
11 changes: 7 additions & 4 deletions intent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ execution:
# enforce claim ⊆ authorized. Declaring it implies strict mode — a
# non-interactive run that resolves no workspace fails fast.
#
# REPLACE THIS before the first bootstrap. The placeholder is deliberate
# and fails loudly: inheriting another product's workspace id would make
# this repo's CI claim someone else's tenant.
workspace: ws_REPLACE_ME
# This repository's OWN workspace: `virga`, under the openproduct account.
# It is not a default for anything built from here — 01-scaffold's
# `orun-workspace` hook rewrites this line to the product's workspace, and
# rebrand.mjs rewrites the workspace segment of every `secret://` ref,
# because a product that inherits this id claims this tenant on every
# remote op. `testing/placement.test.sh` fails if either stops happening.
workspace: ws_F6PEAMKD
requireOrg: true
# Push the resolved catalog after a successful plan on the default branch,
# keeping the workspace-global catalog head fresh without an explicit
Expand Down
12 changes: 2 additions & 10 deletions repo-blueprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ inputs:
default: "your-workers-subdomain"
description: workers.dev subdomain, used by the site build and by every deploy smoke and probe.
repoPrivate:
type: bool
type: boolean
default: true
description: Whether orun.repo/ensure creates the product repo private. Visibility is the operator's choice, so it is asked rather than assumed.
orunWorkspace:
Expand All @@ -78,7 +78,7 @@ inputs:
The epic every phase clubs its task under. Found by slug, so a fresh
run and a resumed run find the same work.
domain:
type: bool
type: boolean
default: false
description: >-
Whether to run 07-domain. It needs the Cloudflare zone to already
Expand Down Expand Up @@ -649,7 +649,6 @@ phases:
epic: "{{ .inputs.epicSlug }}"
branchSlug: "{{ .phase.name }}"
title: "feat(scaffold): the repository is born"
repo: "{{ .inputs.githubOrg }}/{{ .inputs.repoName }}"

- name: 02-foundation
title: The shared packages
Expand Down Expand Up @@ -693,7 +692,6 @@ phases:
epic: "{{ .inputs.epicSlug }}"
branchSlug: "{{ .phase.name }}"
title: "feat(foundation): the shared packages"
repo: "{{ .inputs.githubOrg }}/{{ .inputs.repoName }}"
await:
- id: converge
uses: orun.run/watch@v1
Expand Down Expand Up @@ -778,7 +776,6 @@ phases:
epic: "{{ .inputs.epicSlug }}"
branchSlug: "{{ .phase.name }}"
title: "feat(infrastructure): D1 and KV on stage and prod"
repo: "{{ .inputs.githubOrg }}/{{ .inputs.repoName }}"
await:
- id: converge
uses: orun.run/watch@v1
Expand Down Expand Up @@ -852,7 +849,6 @@ phases:
epic: "{{ .inputs.epicSlug }}"
branchSlug: "{{ .phase.name }}"
title: "feat(mail): the schema and the mail Worker"
repo: "{{ .inputs.githubOrg }}/{{ .inputs.repoName }}"
await:
- id: converge
uses: orun.run/watch@v1
Expand Down Expand Up @@ -907,7 +903,6 @@ phases:
epic: "{{ .inputs.epicSlug }}"
branchSlug: "{{ .phase.name }}"
title: "feat(api): the public site API"
repo: "{{ .inputs.githubOrg }}/{{ .inputs.repoName }}"
await:
- id: converge
uses: orun.run/watch@v1
Expand Down Expand Up @@ -969,7 +964,6 @@ phases:
epic: "{{ .inputs.epicSlug }}"
branchSlug: "{{ .phase.name }}"
title: "feat(site): the website on Workers and Static Assets"
repo: "{{ .inputs.githubOrg }}/{{ .inputs.repoName }}"
await:
- id: converge
uses: orun.run/watch@v1
Expand Down Expand Up @@ -1032,7 +1026,6 @@ phases:
epic: "{{ .inputs.epicSlug }}"
branchSlug: "{{ .phase.name }}"
title: "feat(domain): the custom domain in front of the site"
repo: "{{ .inputs.githubOrg }}/{{ .inputs.repoName }}"
await:
- id: converge
uses: orun.run/watch@v1
Expand Down Expand Up @@ -1081,7 +1074,6 @@ phases:
epic: "{{ .inputs.epicSlug }}"
branchSlug: "{{ .phase.name }}"
title: "docs(deployment): record the live deployment state"
repo: "{{ .inputs.githubOrg }}/{{ .inputs.repoName }}"
await:
- id: verify
uses: orun.http/probe@v1
Expand Down
Loading
Loading