Skip to content

ci: Add cache of Synapse migration setup - #5856

Closed
backspace wants to merge 3 commits into
mainfrom
cs-12583-synapse-db-cache
Closed

ci: Add cache of Synapse migration setup#5856
backspace wants to merge 3 commits into
mainfrom
cs-12583-synapse-db-cache

Conversation

@backspace

Copy link
Copy Markdown
Contributor
Claude explanationSynapse takes ~52s from container start to answering its healthcheck, and `create realm users` spends that time waiting: in a shard log all twelve realm users queue at 18:34:33 and the first registration goes out at 18:35:03. Almost all of it is first-run schema migration against an empty SQLite file, and every one of the 20 shards pays it.

Bake it once on main and drop the result in before the services start. This removes work rather than moving it, which is the only thing that helps here: shard setup is bound by the runner's cores, not by latency. Starting Synapse earlier was measured twice — its own boot stretched from 52s to 84s as it competed with the image warm and the index import, and setup did not move.

Schema only. No users are registered into the bake, so create realm users still runs and nothing about credentials is pinned into an artifact.

Staleness is handled by the artifact's name rather than a separate gate: the key hashes the Synapse support tree, the docker helpers and the pinned image tag, so a checkout that changes any of them asks for a name that does not exist and boots from scratch. Those inputs moved 18 times in the last 7,246 commits. The key reads content through git ls-files -s rather than hashing files, because the support tree gains a signing key and a rendered homeserver.yaml the first time Synapse runs, and hashing those would make the key depend on whether the caller had booted Synapse before.

Every failure path degrades: a missing artifact, an expired one, no gh CLI, or a half-unpacked database all leave Synapse migrating from scratch.

backspace and others added 3 commits August 21, 2026 16:21
Synapse takes ~52s from container start to answering its healthcheck, and
`create realm users` spends that time waiting: in a shard log all twelve
realm users queue at 18:34:33 and the first registration goes out at
18:35:03. Almost all of it is first-run schema migration against an empty
SQLite file, and every one of the 20 shards pays it.

Bake it once on main and drop the result in before the services start. This
removes work rather than moving it, which is the only thing that helps here:
shard setup is bound by the runner's cores, not by latency. Starting Synapse
earlier was measured twice — its own boot stretched from 52s to 84s as it
competed with the image warm and the index import, and setup did not move.

Schema only. No users are registered into the bake, so `create realm users`
still runs and nothing about credentials is pinned into an artifact.

Staleness is handled by the artifact's name rather than a separate gate: the
key hashes the Synapse support tree, the docker helpers and the pinned image
tag, so a checkout that changes any of them asks for a name that does not
exist and boots from scratch. Those inputs moved 18 times in the last 7,246
commits. The key reads content through `git ls-files -s` rather than hashing
files, because the support tree gains a signing key and a rendered
homeserver.yaml the first time Synapse runs, and hashing those would make the
key depend on whether the caller had booted Synapse before.

Every failure path degrades: a missing artifact, an expired one, no gh CLI,
or a half-unpacked database all leave Synapse migrating from scratch.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The patch that added the job wrote Python string-concatenation syntax into
the YAML verbatim, so the job's `if` and the consumer's
`SYNAPSE_CACHE_BRANCH` were nonsense and GitHub rejected the whole workflow
file — every job on the branch, not just the new ones.

Valid YAML is not a valid workflow: `yaml.safe_load` accepted this happily.
`actionlint` is installed locally and would have caught it, so it is now the
check that runs before pushing workflow changes.

Also swaps the bake step's `ls | head -1` for a nullglob array, which
shellcheck flags, and fails the job loudly if Synapse produced no database
rather than uploading an empty artifact for shards to trip over.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The previous run published boxel-synapse-db-b8c4cbc56dd3cf0c (1.9M
migrated, 40K compressed); its own shards ran before it existed. This run's
shards should restore it and skip Synapse's schema migration.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Host Test Results

    1 files      1 suites   1h 49m 57s ⏱️
4 368 tests 4 354 ✅ 14 💤 0 ❌
4 387 runs  4 373 ✅ 14 💤 0 ❌

Results for commit dfa3d3e.

@backspace backspace closed this Aug 21, 2026
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.

1 participant