Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8189581
chore(deps): chant 0.124.46 (#278)
lex00 Oct 24, 2026
6470e10
feat(apply): the migrations Op's gate resumes after approval and keep…
lex00 Oct 24, 2026
664879a
feat(plan): warn in the plan comment when the environment's drift wat…
lex00 Oct 24, 2026
977248a
merge: #278 chant 0.124.46
lex00 Oct 24, 2026
0f646fb
feat(release): admission, approver and releaseDigest on the release r…
lex00 Oct 24, 2026
13a3ec2
feat(apply): --execute counts a gate's quorum at base through chant, …
lex00 Oct 24, 2026
75c04b5
merge: #277 release admission
lex00 Oct 24, 2026
5c00116
merge: #278 quorum at base
lex00 Oct 24, 2026
8358884
feat(steps): orm-handoff step marks the ORM's migration applied (#279)
lex00 Oct 24, 2026
14f7e70
merge: #279 orm handoff
lex00 Oct 24, 2026
51a7b7d
docs(orm): Drizzle for queries, chant for the schema (#4401)
lex00 Oct 24, 2026
f9d8ebe
merge: #4401 docs, Drizzle for queries
lex00 Oct 24, 2026
91a1fbd
refactor(check): read Flyway layout through chant's flyway-layout (#4…
lex00 Oct 24, 2026
7a47df5
merge: #4400 yodel check reads Flyway through chant
lex00 Oct 24, 2026
cfbbb70
test: sync templates, lint docs and kind coverage with chant epic pac…
lex00 Oct 24, 2026
7a14fe9
merge: sync yodeler with chant epic packs
lex00 Oct 24, 2026
9101aa4
fix(check): drop chant's replaced Flyway fields by key, not by unused…
lex00 Oct 24, 2026
b16c7fd
fix(ci): keep chant's action pin comments when yodel ci re-emits a re…
lex00 Oct 24, 2026
bdac298
chore(deps): chant 0.124.48, and the templates re-rendered with SHA-p…
lex00 Oct 24, 2026
519dc20
fix(ci): no non-null assertions in withPinComments
lex00 Oct 24, 2026
4f5f54f
chore: release 0.10.0 (the templates need this release's yodel ci)
lex00 Oct 24, 2026
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export const migrateProd = Op({
overview: "Apply the pending migrations to prod, behind an approval bound to their plan digest",
phases: [
phase("Plan", [plan]),
phase("Approve", [gate("approve-migrate-prod", { plan: digest })]),
phase("Approve", [gate("approve-migrate-prod", { plan: digest, resume: true })]),
phase("Apply", [shell("yodel apply prod --execute", { env: { YODEL_APPROVED_PLAN: digest }, timeout: "2h" })]),
],
});
Expand Down
20 changes: 19 additions & 1 deletion docs/approval.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const migrateDev = Op({
overview: "Apply the pending migrations to dev, behind an approval bound to their plan digest",
phases: [
phase("Plan", [plan]),
phase("Approve", [gate("approve-migrate-dev", { plan: digest })]),
phase("Approve", [gate("approve-migrate-dev", { plan: digest, resume: true })]),
phase("Apply", [shell("yodel apply dev --execute", { env: { YODEL_APPROVED_PLAN: digest }, timeout: "2h" })]),
],
});
Expand All @@ -39,8 +39,26 @@ export const migrateDev = Op({

The digest is checked twice: by the gate on every run, against the approval, and by the Apply step under the lock, against the digest the gate passed, so a change between the two (another runner applying first, a table altered out of band) refuses too.

The gate's `resume: true` (chant 0.124.26 or later, [chant#3947](https://github.com/INTENTIUS/chant/issues/3947)) starts the run after an approval at the gate instead of the first phase. A run that stops at the gate stores a checkpoint of the step outputs the later steps read, here the Plan step's digest, and `yodel approve` copies the checkpoint's digest onto the approval. The next `yodel apply` runs the Plan step again, as chant always does for the step a gate's plan names, then carries on from the gate when the plan, the commit and the checkpoint match what was approved (`decideGateResume`, `op/gate-checkpoint.ts:266` in chant 0.124.46). chant prints `[resume] at gate "approve-migrate-dev", from run <run>'s checkpoint <digest>`, and `yodel apply --json` reports the same three under `resumed`. The Plan step is the only step before the gate, so the resumed run runs the same steps as a fresh one; what it adds is the record of which gated run it continued. When a check fails, such as a commit landing between the two runs, the run starts at the first phase, says why on a `[resume]` line, and the approval still passes the gate.

`yodel apply` finds the Op by its shape, whatever its name. When there is none it prints this declaration to add; when more than one applies the environment, `--op <name>` picks one; an Op whose gate is not bound to the Plan step's output is refused. `chant run migrate-dev` run directly (as CI may) needs `yodel` on `PATH`; `yodel apply` puts itself there for the Op it runs. The declarative path's `ApplyOp` carries its own plan-bound gate ([The two workflows](workflows.md)).

### Renaming the gate

The approvals on `chant/lifecycle` are recorded under the Op's name and the gate's. A gate that is renamed, or moved into another Op, lists its old name in `aliases`, so an approval already given still counts ([chant#3949](https://github.com/INTENTIUS/chant/issues/3949)):

```ts
phase("Approve", [gate("approve-dev", { plan: digest, resume: true, aliases: [{ gate: "approve-migrate-dev" }] })]),
```

Leave `op` out of the alias when the gate stays in its Op, or name the old one: `{ op: "migrate-dev-legacy", gate: "approve" }`. An approval of the old name counts at the renamed gate when it answers the old gate's newest pending fact, that fact has not expired, and the approval is for this run's plan digest. The run then writes it again under the new name, with `carriedFrom` naming the line it came from, and prints a `[carried]` line. `yodel apply --execute` counts the carried line only while the gate still lists that alias, which is how chant's gate reads it (`op/gate.ts:815` in chant 0.124.46, `src/versioned/approval.ts`). A carried approval does not resume the run at the gate, since its approver saw the old gate's checkpoint: the run starts at the first phase and the carried approval passes the gate when it gets there. `yodel approve` always records an approval under the gate's current name. chant's OPS017 refuses an alias that is still a gate in some Op of the build.

### A quorum at the base commit

A gate that needs more than one approver declares `identity.gates.<gate>.quorum` in `chant.workspace.json` (chant#4324). chant reads that entry at the base commit, and its quorum replaces the Op's own `approval.quorum`, so a pull request cannot lower the quorum its own apply needs. `yodel apply --execute` counts the gate the same way, with chant's `tallyGateApprovals` over the rules at base and the roles `.chant/trust.json` at base gives a sealed approver (`src/versioned/approval.ts`). It passes when every rule is met, and otherwise refuses with exit 3 and what is still missing.

A quorum that only the Op declares, with none at base, is refused: the Op is part of the change being applied, so yodel counts nothing from it. Declare the quorum under `identity.gates` on the base branch, or run `yodel apply` without `--execute` and leave the count to the gate step. An approval `policy` is also refused under `--execute`, since only the gate step evaluates one. The Op runs with no environment, so a rule with `targets` does not cover it, as in chant's gate step. An approval carried from an alias still counts through the alias rule above, but a quorum split between old and new gate names is not added up here; approve under the current name.

## The plan digest

On the versioned path the digest covers what the run would do and the state it would start from:
Expand Down
2 changes: 1 addition & 1 deletion docs/audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Cross-check: prod vs staging
schema: sha256:4f0c... vs sha256:4f0c... — same build
```

The component is the project's directory in its repository, or `schema` for a project at the root. A tenant is recorded on its environment's ledger as `<component>/<tenant>`. The record also names the commit, the CI run, who ran it and, when a gate approved it, who approved it. The apply prints a `release:` line on stderr saying what it recorded.
The component is the project's directory in its repository, or `schema` for a project at the root. A tenant is recorded on its environment's ledger as `<component>/<tenant>`. The record also names the commit, the CI run, who ran it and, when a gate approved it, who approved it (`approver`) and which resolution did (`admission`: the `op`, the `gate` and when it was resolved, from chant's `admissionOf` in `src/versioned/approval.ts`). An apply made from a chant release, `yodel apply <env> --release <digest or label>` (or `YODEL_RELEASE`), also writes `releaseDigest`; the checkout must be at the commit the release was cut at, and any other apply writes none. An ungated apply writes no `approver` and no `admission`. Records already on the ledger are never rewritten, and a reader takes each of these fields as optional. The apply prints a `release:` line on stderr saying what it recorded.

The schema is already applied when the record is written, so a record that cannot be written is a `release:` line, not a failed run. That happens when the project is not in a git repository, when the `chant/lifecycle` branch cannot be fetched or has forked from the remote's, or when an out-of-order apply leaves the environment at a schema no migration recorded. The history table stays the record of what ran. The release ledger only says which schema each environment reached.

Expand Down
3 changes: 2 additions & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type: reference
`@intentius/sql-yodeler` is on npm. It needs Node 22.12 or later, and the project also needs chant and the `sql` lexicon, which `chant.config.ts` and the declarations import:

```sh
npm install @intentius/sql-yodeler @intentius/chant@0.124.25 @intentius/chant-lexicon-sql@0.124.25
npm install @intentius/sql-yodeler @intentius/chant@0.124.48 @intentius/chant-lexicon-sql@0.124.48
npx yodel --version
```

Expand Down Expand Up @@ -237,6 +237,7 @@ yodel plan: yodel.config.ts sets environments.dev.topology to cluster:main, but
| `YODEL_LOCK_TTL` | `yodel apply`, `yodel init`, `yodel repair` on ClickHouse | the lock's TTL in seconds |
| `YODEL_LOCK_WAIT` | `yodel apply` | how long to wait for a lock another apply holds, as `--lock-wait` (`10m`); `yodel apply` hands its `--lock-wait` to the Op's Apply step this way |
| `YODEL_STAND_DOWN` | `yodel apply` | `1`: as `--stand-down`, apply nothing and exit 0 when the run's branch has a newer commit on `origin` |
| `YODEL_RELEASE` | `yodel apply` | a chant release's digest or label: as `--release`, the apply is made from that release, and its release record names it (`releaseDigest`) |
| `YODEL_LOCK_RETRIES` | `yodel apply` on Postgres | how many more times a statement that hit `lock_timeout` is tried (default 5, the pause doubling from 250 ms) |
| `GITHUB_TOKEN`, `GITLAB_TOKEN`, `FORGEJO_TOKEN` (each after `CHANT_<FORGE>_TOKEN`; `GH_TOKEN` on GitHub and Forgejo) | `yodel plan --comment`, `yodel drift --issue` | the forge token; see [Approval](approval.md) and [Drift](drift.md#the-tracking-issue) |

Expand Down
12 changes: 12 additions & 0 deletions docs/drift.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ Op "watch-dev" completed in 1.8s

The starter templates render a scheduled pipeline per watch for each forge (`npm run ci` writes them from `ops/`): a GitHub Actions or Forgejo Actions workflow on the watch's cron, and a GitLab CI job run by a pipeline schedule you create with the cron the file notes (GitLab keeps no cron in the file). The job reads with the reader's credentials and never pushes: its snapshot and run record stay in the job. Its token writes only issues: GitHub's job token gets `issues: write`, Forgejo's can write already, and GitLab uses `GITLAB_TOKEN`, the project access token the plan comment uses.

### When the watch stops running

A scheduled job can stop with no error anywhere. GitHub turns a scheduled workflow off after 60 days with no activity in the repository, and on GitLab the job runs only from a pipeline schedule someone created. `yodel plan <env> --comment` asks the forge when the environment's watch job last ran, and when the watch's cron has fired at least twice since, the comment carries a warning ([chant#4289](https://github.com/INTENTIUS/chant/issues/4289)), and the job log the same line:

```
Warning: Op `watch-dev` is overdue: its schedule `17 * * * *` has fired at least twice and its last run was on 2026-10-18. GitHub turns a scheduled workflow off after 60 days with no activity in the repository. Turn the workflow on again under Actions, or run it by hand.
```

The watch is the `WatchOp` whose `env` is the environment, and the job is the file `npm run ci` rendered for it: `.github/workflows/watch-<env>.yml`, `.forgejo/workflows/watch-<env>.yml`, or the job in `.gitlab/yodel-watch.gitlab-ci.yml` whose rules select it (`src/pr/overdue.ts`). A watch with no rendered file is not checked. With no run on record, the count starts at the commit that added the file. chant gives the verdict (`overdueVerdict`, `op/schedule-overdue.ts:107` in chant 0.124.46), so one late or dropped run is not a warning.

The warning never fails the plan. A forge that does not answer is a line in the job log and no warning. On GitHub the plan job reads the workflow's runs with `actions: read`, which the rendered `yodel-pr.yml` asks for; run `npm run ci` to add it to pipelines rendered before.

## The tracking issue

`yodel drift <env> --issue` keeps one issue for the project and environment on the forge, found again by a marker in its body (`<!-- yodel:drift project=<dir> env=<env> -->`, where `<dir>` is the project's directory in its repository, `.` at the root):
Expand Down
2 changes: 1 addition & 1 deletion docs/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ spec:
volumeMounts: [{ name: project, mountPath: /work }]
containers:
- name: apply
image: ghcr.io/intentius/sql-yodeler:0.9.0@sha256:<digest>
image: ghcr.io/intentius/sql-yodeler:0.10.0@sha256:<digest>
workingDir: /work
command: ["yodel", "apply", "prod", "--lock-wait", "10m"]
env:
Expand Down
2 changes: 2 additions & 0 deletions docs/lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ SQLCH126 the check's level, silenceable, clickhouse
schema check: A GRANT column list names a column the table does not declare
SQLCH127 the check's level, silenceable, clickhouse
schema check: An expression calls a function the pinned server does not have
SQLCH128 the check's level, silenceable, clickhouse
schema check: An integration engine or table function argument holds a literal credential
```

`fork`, `directory`, `checksum`, `unreadable-object` and `checkpoint` are integrity rules: always errors. `unreadable-object` means an object in a recorded schema, or a step, that the `sql` lexicon cannot read or classify; it is never skipped. `destructive`, `pg-rewrite`, `pg-lock`, `ch-mutation` and `ch-rebuild` come from the classifier's class of each statement or step, and can be silenced one statement at a time. The `pg-` and `ch-` rules apply to their own dialect.
Expand Down
2 changes: 1 addition & 1 deletion docs/migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ No changes: the declared schema matches the newest migration's recorded schema (

(From the Postgres example's run, just after it writes `rename-email`; `run.ts postgres --write` rewrites this quote with the README. The committed-example check in `examples/walkthrough/run.ts` runs `yodel new check` in each example, so a declared schema that drifts from its migrations fails the e2e test.)

It refuses (exit 1) when the directory is not one chain (a fork, a missing parent) or a migration of that id is already there. `yodel new <name> --sql` writes a migration you write yourself ([below](#hand-written-migrations)). `yodel new <name> --backfill` ends the migration with a backfill step written from `backfills/<name>.json` ([Data migrations](steps.md#backfills)), and `--retain <duration>` keeps the old column of a Postgres rename, or the old table of a rebuild, that long after the switch ([Data migrations](steps.md#postgres-postgresmigrationop)).
It refuses (exit 1) when the directory is not one chain (a fork, a missing parent) or a migration of that id is already there. `yodel new <name> --sql` writes a migration you write yourself ([below](#hand-written-migrations)). `yodel new <name> --backfill` ends the migration with a backfill step written from `backfills/<name>.json` ([Data migrations](steps.md#backfills)), `--orm-handoff <orm>:<migration>` ends the migration with a step that marks an ORM's own migration applied ([Schema from an ORM](orm.md#handing-a-hard-change-to-the-orm)), and `--retain <duration>` keeps the old column of a Postgres rename, or the old table of a rebuild, that long after the switch ([Data migrations](steps.md#postgres-postgresmigrationop)).

## Hand-written migrations

Expand Down
Loading
Loading