Skip to content

Pin the engine only in the source lock, and name new engines by date and content - #79

Merged
maralcbr merged 2 commits into
mainfrom
engine-single-source
Oct 19, 2026
Merged

maralcbr merged 2 commits into
mainfrom
engine-single-source

Conversation

@scottjones

@scottjones scottjones commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Every engine change edits the same pin in six places besides the lock: the Swift locator and its test, the pipeline config, both release templates and rebuild-python-overlay.py. Every branch also picks "the next number". So two branches that change the engine always conflict, and two that both pick the same number can merge the version lines silently while their digests conflict. Going from .28 to .50 on main did exactly this: rebasing this PR hit 11 conflicting files.

What

Engine/source-lock.json becomes the only place the engine is pinned. Everything else reads it:

  • App: OmarchyEnginePinPlugin (modelled on OmarchyInstallerIdentityPlugin) generates ValidationEngineArtifactLocator's version, file name, digest and size from the lock at build time. The values are still compiled in; nothing is read at runtime.
  • Scripts: Packaging/read-validation-engine.py now reads the lock and checks it the way the generator does, instead of scraping the Swift source. build-app.sh and prepare-engine.py (and so mac-app-release.yml) are unchanged callers. rebuild-python-overlay.py, assemble-candidate-v8.sh and cutover-wizard also read the lock.
  • Pipeline config: the engine block of .github/mac-release-pipeline.json is now just {"downstreamRevision"}. catalog-inputs composes the full block from the lock (catalog_release.pipeline_engine) and runs the same check_engine.
  • Release templates: they drop engine_name/engine_version, and make-unsigned-catalog.py always takes them from the lock.

New engines are named v0.9.2-omarchy.<YYYYMMDD>.<content id>. The id is a hash of the lock's build inputs, so branches never race for a number. Engine/engine_pin.py name --write sets it. Its check (run by ./test/all) fails if a dated name no longer matches the inputs. A merge of two engine changes therefore has to be renamed and rebuilt; it can't pass as either side's engine. .50 keeps its name until the next engine change.

Policy change to review: every catalog now requires app 2.1.0 or later, rather than deciding that from the engine's name. Every engine since .18 already needs it, and nothing parses engine names any more. As a result, mac-catalog.yml's installer input and catalog_release.py prepare --installer are now required.

A new test fails if any file outside the lock, docs/ and evidence/ repeats the engine digest.

See docs/engine-versions.md.

Evidence

Rebased onto main c276a1c (engine .50) as d8a2175.

  • Conflicts: two branches that each change a different overlay file and record their own engine, merged in throwaway clones of today's main (c276a1c) and of this branch:

    • main, both bumping to .51: 4 files conflict (the pipeline config, the lock, the Swift pin and its test). Three more (rebuild-python-overlay.py and both templates) merge silently, because both sides wrote the same .51, so two different engines end up with one name. With different numbers they conflict too, giving 7.
    • this branch: only Engine/source-lock.json conflicts, on the engine's name, size and digest. Each side's name is different, so nothing merges silently. The overlay files' digests in the lock merge cleanly.
  • Tests:

    • ./test/all passes with Python 3.12.14 (mise). Main's engine code no longer runs on macOS's /usr/bin/python3 3.9.
    • swift-format strict lint passes.
    • swift test passes: debug 820 passed and release 804 passed, 1 skipped in each. XcodeBuildMCP isn't installed on this Mac; CI runs it.
  • Reproducible rebuild: Engine/prepare-engine.py, with the rebuild script edited to take the version from the lock, rebuilt .50 twice from the authenticated .28 base and the locked Asahi checkout. Both repacks are byte-identical to the pin: 313f9157…, 18,037,588 bytes, archive modes passed.

  • Packaging: an ad-hoc build-app.sh build of d8a2175 passes codesign --verify --deep --strict. It used a scratch release.json whose helper requirement is the ad-hoc one.

    • The app and the helper both contain .50's digest and archive name, and neither contains .28's, so no stale generated pin survived the incremental build.
    • The bundled engine is 313f9157…. The Recovery app doesn't use the engine pin and doesn't contain it.
  • CI passes on d8a2175: portable, macOS, image builder and the Neo image contract.

Not run: a real pipeline or app-release workflow run.

🤖 Generated with Claude Code

…and content

Engine/source-lock.json becomes the only place the engine is pinned, so two
branches that change the engine conflict only in the lock, not in six files:

- the app's pin is generated from the lock at build time
  (OmarchyEnginePinPlugin) instead of committed;
- read-validation-engine.py (used by build-app.sh and prepare-engine.py),
  rebuild-python-overlay.py, assemble-candidate-v8.sh and cutover-wizard
  read the lock;
- the pipeline config's engine block keeps only downstreamRevision, and
  catalog-inputs composes the rest from the lock (pipeline_engine);
- the release-input templates drop engine_name and engine_version, and
  make-unsigned-catalog.py always takes them from the lock.

New engines are named v0.9.2-omarchy.<YYYYMMDD>.<content id>, where the id
hashes the lock's build inputs, so branches never race for the next number.
Engine/engine_pin.py writes the name; its check fails if a dated name no
longer matches the inputs, so a merged engine must be renamed and rebuilt.

Every catalog now requires app 2.1.0 or later instead of deciding from the
engine's name, so nothing parses engine names. mac-catalog.yml's installer
input and catalog_release.py prepare --installer become required.

A test fails if any file outside the lock, docs and evidence repeats the
engine digest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@maralcbr maralcbr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@scottjones reviewed at d8a2175. One lock instead of seven pins is the right shape: the plugin, read-validation-engine.py, pipeline_engine and the catalog tools all read it, and I found no other place that still repeats the pin. ./test/all passes here with Bash 5 and Python 3.12, and CI is green. I'm fine with the 2.1.0 floor for every catalog: v2.2.0 is the first public app, so no shipped app falls below it.

One change before merge:

  • engine_pin.py check only guards dated names. Any version DATED doesn't match skips the content-id check (Engine/engine_pin.py:86–91). That covers .50, but also a hand-picked .51 and a malformed v0.9.2-omarchy.20261019.bad. On this head, changing a downstream_overlay.files[*].sha256 in the lock and naming the engine any of those three passes check with no problems. So until the first dated rename, and after it too for anyone who picks a number, two engine branches can still merge silently, which is the race this PR exists to stop. Suggest a frozen allowlist such as LEGACY = {"v0.9.2-omarchy.50": "2ede760866d5"} (this head's content id, which is right because .50 rebuilt byte-identical), and having check refuse a legacy name whose inputs no longer match that id, and any other name that isn't a well-formed dated name. Tests for: a changed input under .50, an unknown numeric name, a malformed dated name, and a dated name whose inputs changed (already covered).

Nits, not blocking:

  • make-unsigned-catalog.py takes the engine's name from the lock but digests whatever local archive has that name (model_group), without comparing it to the lock's size_bytes/sha256. This isn't new, but "the engine is always the lock's" would be true if it compared them before writing the catalog.
  • pipeline_engine now builds the stopgap engine-<version> release URL in code. Each new dated engine needs that release published before a pipeline run (--verify-remote catches a missing one), and the R2 move becomes a code change rather than a config edit. Worth a line in docs/engine-versions.md step 3.

…he lock

engine_pin.py check verified only dated names, so a hand-picked .51, a
malformed dated name, or .50 with changed inputs passed. Now .50 passes
only with the inputs it was built from (LEGACY freezes their content id,
2ede760866d5), a dated name needs a real date and a matching content id,
and any other name is refused.

make-unsigned-catalog.py took the engine's name from the lock but
digested whatever archive had that name. It now refuses one whose size
or sha256 isn't the lock's.

docs/engine-versions.md: the legacy rule, and step 5, publishing the
engine-<version> release that pipeline_engine's URL names before a
pipeline run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scottjones

Copy link
Copy Markdown
Collaborator Author

Drafted with an AI assistant (Claude Code); I reviewed it before posting.

@maralcbr: thanks, all three are in d3e9c8d.

  • check now refuses undated names. LEGACY = {"v0.9.2-omarchy.50": "2ede760866d5"}; I got the same id from this head. .50 passes only while the lock holds those inputs. A dated name needs a real date and a matching content id, and any other name fails with "is not a dated engine name". New tests cover a changed input under .50, .51, ….20261019.bad, a dated name with no id, an uppercase id, and an impossible date; the existing test still covers a dated name with changed inputs. Your repro (change an overlay digest in the lock, then use each of the three names) now fails all three.
  • make-unsigned-catalog.py refuses an engine archive whose size or sha256 differs from the lock's. It checks before writing anything. Its tests now run a copy of the generator next to a lock that pins their stand-in engine, so the production script has no override flag.
  • docs/engine-versions.md gains step 5: publish the engine-<version> release before a pipeline run. pipeline_engine builds the URL from that name, and --verify-remote refuses a missing or different archive. Moving to mac.omarchy.org will be a change to pipeline_engine, not to the config.

One consequence to be aware of: any later change to the lock's build inputs, including the rebuild recipe or the toolchain, now requires a dated rename and a rebuild, even if the archive would come out the same. If another numbered engine lands on main before this PR, I'll update LEGACY when I rebase.

@maralcbr maralcbr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@scottjones re-reviewed at d3e9c8d. Approve. All three points are resolved:

  • With a changed overlay digest in the lock, check now refuses .50, .51 and .20261019.bad, gives two problems for an impossible date, and passes a freshly named dated engine. 2ede760866d5 matches this head's inputs.
  • make-unsigned-catalog.py checks every model group's engine against the lock's size and digest before it creates or writes any output, and the tests run an isolated copy, so the real lock is never touched.
  • Docs step 5 covers publishing the engine-<version> release before a pipeline run.

./test/all passes here (141 ok) and CI is green. I'm fine with the consequence you noted: any change to the recipe or toolchain now forces a dated rename and a rebuild.

@maralcbr
maralcbr merged commit b983f95 into main Oct 19, 2026
4 checks passed
@maralcbr
maralcbr deleted the engine-single-source branch October 19, 2026 04:29
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