[PR #1947] [MERGED] horizon-prepare: OUTPUT_VERSION, the number of what it prepares, checked by CI #3886

Closed
opened 2026-11-03 04:13:01 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1947
Author: @ludovic111
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/25/2026
Merged by: @ludovic111

Base: main ← Head: feat/prepare-output-check


📝 Commits (1)

  • 116a7f7 horizon-prepare: OUTPUT_VERSION, the number of what it prepares, checked by CI

📊 Changes

6 files changed (+283 additions, -0 deletions)

View changed files

📝 .github/workflows/parity.yml (+4 -0)
➕ crates/horizon-prepare/output-versions.txt (+3 -0)
📝 crates/horizon-prepare/src/lib.rs (+32 -0)
📝 docs/release-flow.md (+4 -0)
➕ tests/test_prepare_output.py (+64 -0)
➕ tools/prepare_output.py (+176 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

What

The preparer declares what it makes: pub const OUTPUT_VERSION: u32 = 1; in crates/horizon-prepare/src/lib.rs. Launchers with #1946 keep a player's prepared resources across releases whose number (and pinned jars) are the same. It is bumped by hand, and CI catches a change to the output without a bump:

  • crates/horizon-prepare/output-versions.txt lists each number with the digest of what it prepares. The file only grows.

  • tools/prepare_output.py check --cache --base <base> runs in the parity job right after vanilla-data.sh. That script already prepares with the PR's own preparer whenever the preparer, the exporters or research-lock.json change. The check fails in three cases:

    • the preparation's digest isn't the last line's. The error prints the two lines to change.
    • the number and the file disagree.
    • a line the base had was edited.

    The digest is cached beside the preparation, so it costs ~30 s once per preparer version.

  • The digest canonicalises what differs between two runs of the same preparer:

    • JSON is compared as data, so key order doesn't count;
    • creative-inventory.json's tags order doesn't count;
    • $$Lambda/0x… addresses don't count;
    • logs, .class files, the sounds (copied by another step) and the manifest's per-file hashes are left out.

    The manifest's scalars do count: schema, data_version, the jar hashes and resource_files.

  • Measurements:

    • 10 preparations by 5 preparer versions (v0.2.49 to main) on the three Mac runners give one digest, 0a608bf4…. That is version 1.
    • A Linux preparation (ThinkPad) by an older preparer gives the digest the Mac runners give for that preparer (1eb01fc9…, v0.2.47).
    • Pointed at that v0.2.47 preparation, the check fails as it should.
  • docs/release-flow.md explains the step.

OUTPUT_VERSION isn't written into any prepared file, so this PR's own preparation should still be version 1. The parity job checks this.

Merge after #1946 has shipped in a launcher release (see there). #1869 has this branch merged in, so its CI checks that its fix leaves the output at version 1.

Tests

  • cargo test -p horizon-prepare: new output_versions_end_at_the_output_version (the file is consecutive and distinct, ends at the constant, and has the exact line the launcher parses). cargo clippy -p horizon-prepare --all-targets -D warnings: clean.
  • python3 -m unittest tests.test_prepare_output: run-to-run noise doesn't count; data, schema and new files do; the versions-file rules hold.
  • tools/prepare_output.py check against the runner preparation for v0.2.64's key passes (OUTPUT_VERSION 1, 23055 files). Against v0.2.47's it fails with the bump instructions.
  • End to end with #1946's launcher: see #1946 (v0.2.64 to this branch's preparer reuses; a bumped number doesn't).

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/1947 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/prepare-output-check` --- ### 📝 Commits (1) - [`116a7f7`](https://github.com/horizon-rust/horizon/commit/116a7f7dcafc4e36d14b75600f402446ec8056ac) horizon-prepare: OUTPUT_VERSION, the number of what it prepares, checked by CI ### 📊 Changes **6 files changed** (+283 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/parity.yml` (+4 -0) ➕ `crates/horizon-prepare/output-versions.txt` (+3 -0) 📝 `crates/horizon-prepare/src/lib.rs` (+32 -0) 📝 `docs/release-flow.md` (+4 -0) ➕ `tests/test_prepare_output.py` (+64 -0) ➕ `tools/prepare_output.py` (+176 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What The preparer declares what it makes: `pub const OUTPUT_VERSION: u32 = 1;` in `crates/horizon-prepare/src/lib.rs`. Launchers with #1946 keep a player's prepared resources across releases whose number (and pinned jars) are the same. It is bumped by hand, and CI catches a change to the output without a bump: - `crates/horizon-prepare/output-versions.txt` lists each number with the digest of what it prepares. The file only grows. - `tools/prepare_output.py check --cache --base <base>` runs in the parity job right after `vanilla-data.sh`. That script already prepares with the PR's own preparer whenever the preparer, the exporters or `research-lock.json` change. The check fails in three cases: - the preparation's digest isn't the last line's. The error prints the two lines to change. - the number and the file disagree. - a line the base had was edited. The digest is cached beside the preparation, so it costs ~30 s once per preparer version. - The digest canonicalises what differs between two runs of the same preparer: - JSON is compared as data, so key order doesn't count; - `creative-inventory.json`'s `tags` order doesn't count; - `$$Lambda/0x…` addresses don't count; - logs, `.class` files, the sounds (copied by another step) and the manifest's per-file hashes are left out. The manifest's scalars do count: `schema`, `data_version`, the jar hashes and `resource_files`. - Measurements: - 10 preparations by 5 preparer versions (v0.2.49 to main) on the three Mac runners give one digest, `0a608bf4…`. That is version 1. - A Linux preparation (ThinkPad) by an older preparer gives the digest the Mac runners give for that preparer (`1eb01fc9…`, v0.2.47). - Pointed at that v0.2.47 preparation, the check fails as it should. - `docs/release-flow.md` explains the step. `OUTPUT_VERSION` isn't written into any prepared file, so this PR's own preparation should still be version 1. The parity job checks this. **Merge after #1946 has shipped in a launcher release** (see there). #1869 has this branch merged in, so its CI checks that its fix leaves the output at version 1. ## Tests - `cargo test -p horizon-prepare`: new `output_versions_end_at_the_output_version` (the file is consecutive and distinct, ends at the constant, and has the exact line the launcher parses). `cargo clippy -p horizon-prepare --all-targets -D warnings`: clean. - `python3 -m unittest tests.test_prepare_output`: run-to-run noise doesn't count; data, schema and new files do; the versions-file rules hold. - `tools/prepare_output.py check` against the runner preparation for v0.2.64's key passes (`OUTPUT_VERSION 1, 23055 files`). Against v0.2.47's it fails with the bump instructions. - End to end with #1946's launcher: see #1946 (v0.2.64 to this branch's preparer reuses; a bumped number doesn't). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:13:01 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#3886
No description provided.