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
3 changes: 3 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ that is not part of core, built and versioned as if it were its own repository
| [`config`](config/README.md) | settings groups, `@secret` / `@envName` / `@phase`, vaults (Infisical) and their scopes; `.env.example`, key manifest and `.keys-axi.toml` generators | core | TypeScript |
| [`systems`](systems/README.md) | systems, apps (service, client, job), resources | core | TypeScript |
| [`delivery`](delivery/README.md) | environments, builds, runtime processes, deployments, value bindings | `systems` | TypeScript |
| [`railway`](railway/README.md) | `deployment.railway` (vocabulary only; the emitter is later work) | `delivery` | TypeScript |
| [`railway`](railway/README.md) | `deployment.railway`; `.railway/railway.ts` (Railway Infrastructure as Code), unexpressed-facts list, secret sync, deploy and doctor scripts and a deploy skill | `delivery`, `config` | TypeScript |

An independent pack is not in the default bundle. A project opts in by naming its provider. It is
never in `fixtures/registry-conformance/expected-registry.json` and never moves
Expand Down
2 changes: 1 addition & 1 deletion packs/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ environment name, in the scope the vault maps to the environment being deployed.
| Generator | Writes | Holds |
|---|---|---|
| `envExampleFile()` | `.env.example` | Every setting by name, grouped; the default of a non-secret setting; a comment line with type, required, secret and build-time |
| `keyManifestFile()` | `keys.manifest.json` | Every setting's name, model name, type, required, secret, phase and default, sorted by name; each vault and its scopes. What a deploy or doctor script compares a vault and a platform against |
| `keyManifestFile()` | `keys.manifest.json` | Every setting's name, model name, type, required, secret, phase and default, sorted by name; each vault and its scopes. A script or agent reads the names and vault scopes here without the model; the `railway` pack's deploy scripts read the model instead |
| `keysAxiTomlFile({ vault? })` | `.keys-axi.toml` | The vault's backend, default scope and one `[environments.<slug>]` table per scope, the file `keys-axi` reads so `keys-axi run` needs no project flag. Name the vault when the model declares more than one |

Each takes `path` and `target`. No value of a secret ever reaches their output: the model
Expand Down
12 changes: 12 additions & 0 deletions packs/delivery/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,15 @@ This pack's own changelog (ADR-0069). The root `CHANGELOG.md` records core only.
`@secrets` and `@setting` are names only. A deployment holds one value per `@setting`
(`ERR_DELIVERY_DUPLICATE_SETTING`) and a model one deployment per (`@app`, `@environment`)
(`ERR_DELIVERY_DUPLICATE_DEPLOYMENT`). TypeScript port.
- An abstract deployment (`"abstract": true`) is a template for the deployments that extend it:
the one-deployment-per-(`@app`, `@environment`) check skips it, so a base that names an
environment no longer collides with its own child.
- `@watchInclude` on every `build.*`, beside `@watchExclude`: the paths whose change starts a
build, for an app that lives in one directory of a monorepo.
- `@path` on `value.ref`: a path appended to a URL output (`/api`), for a setting that addresses
one context of another app.
- `readBuild(app)` and `readProcesses(app)`: an app's build and processes as plain records, for a
platform pack's generator to read instead of decoding the attributes itself.
- `ERR_DELIVERY_UNSUPPORTED_OUTPUT`: a `value.ref` that asks for an output its producer does not
have fails the load: `@path` on an output that is not a URL, an app asked for its `url`, `user`
or `password`, or for its `port` or `privateUrl` when no process declares a `@port`.
33 changes: 28 additions & 5 deletions packs/delivery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ in one environment on one platform, and holds only what differs there.
| Node | Where | What it is | Attributes |
|---|---|---|---|
| `environment.standing`, `.ephemeral`, `.local` | document root | A named environment: production, a pull-request preview, a workstation | (documentation only) |
| `build.dockerfile` | under an `app.*`, at most one build | Built as an image from a Dockerfile | `@path`, `@context`, `@watchExclude` |
| `build.command` | under an `app.*` | Built by a command the platform's builder runs | `@command`, `@watchExclude` |
| `build.static` | under an `app.*` | A directory of files served as they are | `@directory`, `@command`, `@watchExclude` |
| `build.dockerfile` | under an `app.*`, at most one build | Built as an image from a Dockerfile | `@path`, `@context`, `@watchInclude`, `@watchExclude` |
| `build.command` | under an `app.*` | Built by a command the platform's builder runs | `@command`, `@watchInclude`, `@watchExclude` |
| `build.static` | under an `app.*` | A directory of files served as they are | `@directory`, `@command`, `@watchInclude`, `@watchExclude` |
| `runtime.process` | under an `app.*` | How one of its processes runs | `@command`, `@port`, `@healthPath`, `@healthTimeoutSeconds`, `@drainSeconds`, `@restart` (`always`, `onFailure`, `never`) |
| `deployment.<platform>` | document root | An app in an environment on a platform. A **platform pack** registers the subtype (the [`railway`](../railway/README.md) pack registers `deployment.railway`) | `@app`, `@environment`, `@domains`, `@replicas`, `@region`, `@branch`, `@secrets`, plus the platform's own |
| `value.literal` | under a deployment | A setting's fixed value there | `@setting`, `@literal` |
| `value.ref` | under a deployment | A setting's value produced by another node at deploy time | `@setting`, `@producedBy`, `@output` |
| `value.ref` | under a deployment | A setting's value produced by another node at deploy time | `@setting`, `@producedBy`, `@output`, `@path` |

`deployment.base` is the abstract anchor platform packs specialise (`extendsBase: true`); this pack
registers no concrete deployment, and an authored `deployment.base` fails to load
Expand All @@ -46,7 +46,12 @@ the config pack and the deployment names its vault in `@secrets`. The full defin
- A model holds at most one deployment per (`@app`, `@environment`), compared as resolved nodes, so
`Game.server` and `acme::game::Game.server` collide (`ERR_DELIVERY_DUPLICATE_DEPLOYMENT`).

Each fails the load with `ERR_DELIVERY_UNRESOLVED_REF` when it resolves to nothing or to the wrong
A `value.ref` asks only for an output its producer has (`ERR_DELIVERY_UNSUPPORTED_OUTPUT`): `@path`
extends a URL output only (`url`, `privateUrl`, `publicUrl`); an app produces `host`, `port`,
`privateUrl` and `publicUrl`, and `port` and `privateUrl` need a process that declares `@port`. A
resource's outputs depend on its engine and are left to the platform pack.

A reference fails the load with `ERR_DELIVERY_UNRESOLVED_REF` when it resolves to nothing or to the wrong
kind of node. A platform pack holds its deployments to the same rule by passing
`validateDeployment` as its subtype's validator. `@secrets` (a config pack `vault.*`) and
`@setting` (`Group.field` of an `object.settings`) are names only: this pack does not require the
Expand All @@ -66,6 +71,24 @@ overlay, using the loader's existing merge:

The `railway` pack's `railway-worked-example` fixture is the whole example, both sides.

### One abstract deployment, one per environment

What is true of every environment (the app, the project, the service, the repository, the values
that do not change) is written once, in an abstract deployment (`"abstract": true`, which is core's
structural keyword, not a new attribute). Each environment's deployment `extends` it and holds only
the differences: its `@environment`, `@branch`, `@domains`, `@replicas` and its own `value.*`
children. A child value that reuses the base value's name overrides it. An abstract deployment may
omit `@app` and `@environment`, a concrete one must resolve both (its own or inherited), and an
abstract one is never counted by the one-deployment-per-(`@app`, `@environment`) check or
deployed. The `railway` pack's `railway-emit-environments` fixture shows it, and
`abstract-deployment-with-environment` is the case where the base also names an environment.

## Readers

`readBuild(app)` and `readProcesses(app)` return an app's build and processes as plain records
(resolving accessors, so an inherited build counts). A platform pack's generator reads through
them.

## Ports

TypeScript only (ADR-0069's port rule: elsewhere a model that uses it fails by name).
Expand Down
3 changes: 2 additions & 1 deletion packs/delivery/fixtures/conformance/ERROR-CODES.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"codes": {
"ERR_DELIVERY_UNRESOLVED_REF": "A deployment's @app or @environment, or a value.ref's @producedBy, names no node, or names a node of the wrong kind (@app takes an app.*, @environment an environment.*, @producedBy a resource.* or an app.*).",
"ERR_DELIVERY_DUPLICATE_SETTING": "A deployment holds two value.* nodes for one @setting. An estate overlay that overrides a value must reuse the value node's name so it merges.",
"ERR_DELIVERY_DUPLICATE_DEPLOYMENT": "Two deployments target the same (@app, @environment), compared as resolved nodes."
"ERR_DELIVERY_DUPLICATE_DEPLOYMENT": "Two deployments target the same (@app, @environment), compared as resolved nodes.",
"ERR_DELIVERY_UNSUPPORTED_OUTPUT": "A value.ref asks its producer for an output it does not have: @path on an output that is not a URL (url, privateUrl, publicUrl), an app asked for anything but host, port, privateUrl or publicUrl, or an app with no runtime.process @port asked for its port or privateUrl."
}
}
43 changes: 39 additions & 4 deletions packs/delivery/fixtures/expected-vocabulary.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@
"valueType": "string",
"isArray": true,
"required": false,
"description": "Repository path globs whose change must not start a new build (`docs/**`, `*.md`). A platform that has no place for them in its own file gets them as a fact to set by hand, which its generator lists."
"description": "Repository path globs whose change must not start a new build (`docs/**`, `/*.md`), written as gitignore-style globs from the repository root; an exclusion wins over an inclusion. A platform that has no place for them in its own file gets them as a fact to set by hand, which its generator lists."
},
{
"name": "watchInclude",
"valueType": "string",
"isArray": true,
"required": false,
"description": "Repository path globs whose change starts a new build (`api/**`), written as gitignore-style globs from the repository root. Absent means every path: a monorepo app names only its own directories. A platform that has no place for them in its own file gets them as a fact to set by hand, which its generator lists."
}
],
"children": []
Expand All @@ -34,7 +41,14 @@
"valueType": "string",
"isArray": true,
"required": false,
"description": "Repository path globs whose change must not start a new build (`docs/**`, `*.md`). A platform that has no place for them in its own file gets them as a fact to set by hand, which its generator lists."
"description": "Repository path globs whose change must not start a new build (`docs/**`, `/*.md`), written as gitignore-style globs from the repository root; an exclusion wins over an inclusion. A platform that has no place for them in its own file gets them as a fact to set by hand, which its generator lists."
},
{
"name": "watchInclude",
"valueType": "string",
"isArray": true,
"required": false,
"description": "Repository path globs whose change starts a new build (`api/**`), written as gitignore-style globs from the repository root. Absent means every path: a monorepo app names only its own directories. A platform that has no place for them in its own file gets them as a fact to set by hand, which its generator lists."
}
],
"children": []
Expand Down Expand Up @@ -64,7 +78,14 @@
"valueType": "string",
"isArray": true,
"required": false,
"description": "Repository path globs whose change must not start a new build (`docs/**`, `*.md`). A platform that has no place for them in its own file gets them as a fact to set by hand, which its generator lists."
"description": "Repository path globs whose change must not start a new build (`docs/**`, `/*.md`), written as gitignore-style globs from the repository root; an exclusion wins over an inclusion. A platform that has no place for them in its own file gets them as a fact to set by hand, which its generator lists."
},
{
"name": "watchInclude",
"valueType": "string",
"isArray": true,
"required": false,
"description": "Repository path globs whose change starts a new build (`api/**`), written as gitignore-style globs from the repository root. Absent means every path: a monorepo app names only its own directories. A platform that has no place for them in its own file gets them as a fact to set by hand, which its generator lists."
}
],
"children": []
Expand Down Expand Up @@ -94,7 +115,14 @@
"valueType": "string",
"isArray": true,
"required": false,
"description": "Repository path globs whose change must not start a new build (`docs/**`, `*.md`). A platform that has no place for them in its own file gets them as a fact to set by hand, which its generator lists."
"description": "Repository path globs whose change must not start a new build (`docs/**`, `/*.md`), written as gitignore-style globs from the repository root; an exclusion wins over an inclusion. A platform that has no place for them in its own file gets them as a fact to set by hand, which its generator lists."
},
{
"name": "watchInclude",
"valueType": "string",
"isArray": true,
"required": false,
"description": "Repository path globs whose change starts a new build (`api/**`), written as gitignore-style globs from the repository root. Absent means every path: a monorepo app names only its own directories. A platform that has no place for them in its own file gets them as a fact to set by hand, which its generator lists."
}
],
"children": []
Expand Down Expand Up @@ -314,6 +342,13 @@
],
"description": "Which of its values: url, host, port, user, password, privateUrl, publicUrl. A platform generator maps the name to the platform's own reference and refuses one it cannot supply."
},
{
"name": "path",
"valueType": "string",
"isArray": false,
"required": false,
"description": "A path appended to a URL output (`/api`): the address of one context of the producing app. Only on a url, privateUrl or publicUrl output; a platform generator refuses it on another."
},
{
"name": "producedBy",
"valueType": "string",
Expand Down
6 changes: 4 additions & 2 deletions packs/delivery/metamodel/delivery.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"subType": "base",
"description": "Abstract build base: the attributes every build.* shares. A build is a child of an app and says how its deployable is made, the same in every environment. Not authored directly: a `build.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED).",
"children": [
{ "type": "attr", "subType": "string", "name": "watchExclude", "isArray": true, "min": 0, "max": 1, "description": "Repository path globs whose change must not start a new build (`docs/**`, `*.md`). A platform that has no place for them in its own file gets them as a fact to set by hand, which its generator lists." }
{ "type": "attr", "subType": "string", "name": "watchInclude", "isArray": true, "min": 0, "max": 1, "description": "Repository path globs whose change starts a new build (`api/**`), written as gitignore-style globs from the repository root. Absent means every path: a monorepo app names only its own directories. A platform that has no place for them in its own file gets them as a fact to set by hand, which its generator lists." },
{ "type": "attr", "subType": "string", "name": "watchExclude", "isArray": true, "min": 0, "max": 1, "description": "Repository path globs whose change must not start a new build (`docs/**`, `/*.md`), written as gitignore-style globs from the repository root; an exclusion wins over an inclusion. A platform that has no place for them in its own file gets them as a fact to set by hand, which its generator lists." }
]
},
{
Expand Down Expand Up @@ -104,7 +105,8 @@
"whenToUse": "A setting whose value only the platform knows once the resource or app exists.",
"children": [
{ "type": "attr", "subType": "string", "name": "producedBy", "min": 1, "max": 1, "description": "The node that produces the value: a resource.* or app.*, as `System.child` (`Shop.db`, or `pkg::System.child`). It must resolve (ERR_DELIVERY_UNRESOLVED_REF)." },
{ "type": "attr", "subType": "string", "name": "output", "min": 1, "max": 1, "allowedValues": ["url", "host", "port", "user", "password", "privateUrl", "publicUrl"], "description": "Which of its values: url, host, port, user, password, privateUrl, publicUrl. A platform generator maps the name to the platform's own reference and refuses one it cannot supply." }
{ "type": "attr", "subType": "string", "name": "output", "min": 1, "max": 1, "allowedValues": ["url", "host", "port", "user", "password", "privateUrl", "publicUrl"], "description": "Which of its values: url, host, port, user, password, privateUrl, publicUrl. A platform generator maps the name to the platform's own reference and refuses one it cannot supply." },
{ "type": "attr", "subType": "string", "name": "path", "min": 0, "max": 1, "description": "A path appended to a URL output (`/api`): the address of one context of the producing app. Only on a url, privateUrl or publicUrl output; a platform generator refuses it on another." }
]
}
],
Expand Down
Loading
Loading