Skip to content

console: bump kysely to 0.29 and fix yarn gen:types - #40550

Merged
leedqin merged 5 commits into
MaterializeInc:mainfrom
leedqin:console-fix-gen-types
Nov 6, 2026
Merged

leedqin merged 5 commits into
MaterializeInc:mainfrom
leedqin:console-fix-gen-types

Conversation

@leedqin

@leedqin leedqin commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

yarn gen:types fails with function "pg_get_serial_sequence" does not exist. kysely-codegen runs kysely's Postgres introspector for its table query. Since the bump to kysely 0.28 (#35669), that query calls pg_get_serial_sequence, which Materialize lacks. kysely 0.29 still does. The query also lists only relkinds r, v and p, so the catalog's builtin materialized views (m) never reached the types under kysely-codegen 0.17. #40044's types were generated with both patched by hand in node_modules.

This also bumps kysely to 0.29 and kysely-codegen to 0.20, superseding #39686.

Description

  • bin/kysely-codegen.ts runs kysely-codegen programmatically with an introspector that overrides only the table query. kysely-codegen's materialized view query, enum handling and serializer still apply.
  • The script writes the copyright header to types/materialize.d.ts. The codegen output lacks it, and the copyright lint fails without it.
  • bin/generate-types exits on errors, pulls the requested image (a cached latest went stale), and stops the container on exit. Before, each run left a container bound to port 6875, and the next run generated types from that old container.
  • kysely 0.28.17 → 0.29.8 and kysely-codegen 0.17 → 0.20.0:
    • 0.29 rejects limit(sql.raw(...)). rawLimit and the lag history limit now call query.limit(sql.lit(n)), which still inlines the limit as a literal, as Materialize requires.
    • rawLimit used to append its limit with modifyEnd. In 0.29, compiling end modifiers calls Array.prototype.toSorted, which Chrome 109 lacks. No console query uses end modifiers now. Neither rawLimit caller has an OFFSET or another end modifier, so the compiled SQL is unchanged.
    • kysely 0.29 is ESM-only and kysely-codegen 0.20 requires it, so yarn gen:types needs Node 22.12 or later. CI and the Volta pin run Node 26, and console: bump vite-plugin-svgr to 5 and jsdom to 30 #39683 updates engines.node.
  • types/materialize.d.ts is regenerated against v26.49.1. kysely-codegen 0.17 and 0.20 produce identical output.

Worth checking on the preview, since these run the changed limits:

  • the Query History list;
  • a sink's Errors tab;
  • the freshness lag charts on the environment overview and the cluster pages.

🤖 Generated with Claude Code

kysely 0.28's Postgres introspector, which kysely-codegen uses for its
table query, calls pg_get_serial_sequence. Materialize lacks it, so
`yarn gen:types` has failed since the bump from kysely 0.27 (MaterializeInc#35669).
The query also lists only relkinds 'r', 'v' and 'p', which skips the
catalog's builtin materialized views ('m').

Run kysely-codegen from bin/kysely-codegen.ts with an introspector that
overrides the table query, keeping kysely-codegen's enum handling and
serializer. The script writes the copyright header, which the codegen
output lacks and the copyright lint requires.

bin/generate-types now exits on errors, pulls the requested image, and
stops the container on exit. Before, each run left a container bound to
port 6875, and the next run generated types from that old container.
@leedqin
leedqin requested a review from a team as a code owner November 6, 2026 21:32
@leedqin
leedqin requested review from def- and jdonelson November 6, 2026 21:32
Generated with the fixed `yarn gen:types`. Adds mz_builtin_columns and
mz_builtin_index_columns. Builtin columns lose their Generated<>
wrappers, since MaterializeInc#40316 reports no default for them in pg_attribute.
Keeps the two hand-added TODO markers for mz >= 26.34.
MaterializeInc#39992 typed mz_cluster_auto_scaling_strategies and
mz_cluster_reconfigurations by hand while gen:types was broken. The
generator now emits both, and AUTO_SCALING_MIN_VERSION gates them at
runtime, so the file is exactly the generator output.

@jdonelson jdonelson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix. The cleanup trap closes a nasty trap where a stale container silently served old types. LGTM.

kysely 0.28.17 -> 0.29.8 and kysely-codegen 0.17 -> 0.20.0. Supersedes
MaterializeInc#39686.

0.29 rejects limit(sql.raw(...)), so rawLimit and the lag history limit
call query.limit(sql.lit(n)). rawLimit used modifyEnd before, and 0.29
sorts end modifiers with Array.prototype.toSorted, which Chrome 109
lacks. Neither rawLimit caller has an OFFSET or another end modifier, so
the compiled SQL is unchanged.

kysely-codegen 0.20 renames generate's schemas option to defaultSchemas,
lists materialized views itself, and writes to a default file in
node_modules unless outFile is null. kysely 0.29's TableMetadata adds
isForeign. The generated types are identical to 0.17's.
@leedqin leedqin changed the title console: fix yarn gen:types against Materialize console: bump kysely to 0.29 and fix yarn gen:types Nov 6, 2026
@leedqin
leedqin enabled auto-merge (squash) November 6, 2026 22:38
@leedqin
leedqin merged commit b1ad999 into MaterializeInc:main Nov 6, 2026
83 checks passed
leedqin added a commit that referenced this pull request Nov 11, 2026
### Motivation

Renovate opens a batch of dependency PRs every week. CI catches most
breaks, but last month's Console upgrades hit several it can't see:

- renamed config that the new version silently ignores (msw 3's
`onUnhandledRequest`);
- dev scripts CI never runs (`yarn gen:types` was broken from #35669
until #40550);
- APIs and syntax old browsers lack (kysely 0.29's `toSorted`,
string-width 8's `v`-flag regexes);
- Node floors above `engines.node`;
- layout jsdom can't measure (visx 4's `ParentSize`);
- version holds a later bump undid (react-virtualized-auto-sizer in
#40521).

### Description

Adds the `mz-renovate-triage` skill.

- `SKILL.md` sorts open Renovate PRs by risk, checks what CI can't, and
posts one verdict comment per PR for the approver (Ready to approve,
Needs changes, Needs a decision, Waiting on CI, Superseded). It edits
that comment in place on later runs and skips PRs whose head hasn't
changed. It never approves, merges, closes, labels or pushes.
- `lessons.md` records what the Console upgrades of October and November
needed, as rules and as a table by package, each with the PR that taught
it.
- A row in `.agents/skills/README.md`.

A scheduled routine runs the skill twice a week. It can also be run by
hand, where it shows the comments and asks before posting.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
leedqin added a commit that referenced this pull request Nov 11, 2026
### Motivation

`console/package.json` declares `"node": ">=20.12.2"`, but the installed
dependency tree no longer runs there. Checking every installed package's
`engines.node` against candidate versions:

| Node | Packages whose `engines.node` rejects it |
|---|---|
| 20.12.2 | 60 (jsdom's CSS packages, …) |
| 20.19.0 | 18 (`@mswjs/interceptors` 0.45, `@rolldown/plugin-babel`,
`@testing-library/jest-dom` 7, `eslint-plugin-unicorn` 79, …) |
| 22.12.0 | 25 (`@eslint/*` needs 22.13, …) |
| 22.18.0 | 7 (`node-gyp` 13, `which` 7, `abbrev` 5, `nopt` 10,
`lint-staged` 17, `undici` 8.12, …) |
| 24.11.0 | 5 (`node-gyp` 13 and its helpers) |
| 22.22.2, 24.15.0, 26.0.0 | none |

msw 3 (#39684) and kysely 0.29 (#40550) both deferred this change to
#39683, which is still open.

### Description

`engines.node` becomes `^22.22.2 || ^24.15.0 || >=26.0.0`, the
intersection of every installed package's range. Volta (26.10.0),
`console/Dockerfile` and CI already run Node 26. It is the same range as
#39683, so that PR merges cleanly on this line.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants