[PR #4653] [MERGED] Parity: validate pack.mcmeta formats, clear packs on a failed reload #5757

Closed
opened 2026-11-03 05:14:47 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4653
Author: @levzzz5154
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @levzzz5154

Base: main ← Head: parity/36-packs


📝 Commits (2)

  • d214aa6 Validate pack.mcmeta formats like PackFormat.IntermediaryFormat; clear packs on a failed reload
  • f387c1d fmt

📊 Changes

4 files changed (+391 additions, -53 deletions)

View changed files

📝 crates/horizon-client-render/src/datapack.rs (+10 -2)
📝 crates/horizon-client-render/src/packs.rs (+342 -46)
📝 crates/horizon-client/src/game/packs.rs (+23 -1)
📝 crates/horizon-client/src/game/server_packs.rs (+16 -4)

📄 Description

🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally.

Part of #3520

Rows done:

  • PackFormat.IntermediaryFormat.validate: a pack.mcmeta pack section is checked as vanilla does (min_format without max_format, nothing declared, a pack_format above 64/81 without min/max); a refused section gives a pack of unknown format (vanilla's fallback codec), not whatever the ranges said.
  • PackFormat.IntermediaryFormat.validatePackFormatForRange: pack_format outside min..max, or a multi-version pack below 15, is refused.
  • PackFormat.IntermediaryFormat.validateNewFormat: min_format above max_format, supported_formats next to min_format above the last pre-minor version, and a missing or mismatching supported_formats/pack_format below it are refused.
  • PackFormat.IntermediaryFormat.validateOldFormat: a supported_formats range above 64 (resource) / 81 (data), or one without pack_format, is refused. Minor versions now follow PackFormat.BOTTOM_CODEC/TOP_CODEC ([97, 0] as max is minor 0, not "any").
  • PackRepository.isAbleToClearAnyPack: packs::able_to_clear_any_pack. When a selection reload fails (Minecraft.rollbackResourcePacks / clearResourcePacksOnError) and a selected pack exists, the selection is cleared and saved, the reload runs again, and the resourcePack.load_fail SystemToast shows. With nothing left to clear, the Options error page stays.

Vanilla methods followed: PackFormat.IntermediaryFormat.{validate,validateNewFormat,validateOldFormat,validatePackFormatForRange}, PackFormat.fullCodec, PackCompatibility.forVersion, PackRepository.isAbleToClearAnyPack, Minecraft.rollbackResourcePacks, Minecraft.clearResourcePacksOnError.

Not covered: overlay entries (validateHolderList) still use the old lenient parsing.

Tests: packs::tests::pack_format_validation, clearing_needs_an_existing_selected_pack; the existing compatibility and data pack tests now use min_format/max_format where vanilla requires them. cargo test -p horizon-client-render --lib passes, clippy clean for horizon-client-render and horizon-client.

🤖 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/4653 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `parity/36-packs` --- ### 📝 Commits (2) - [`d214aa6`](https://github.com/horizon-rust/horizon/commit/d214aa61d7b8552e7d695a642547696e78c9ae82) Validate pack.mcmeta formats like PackFormat.IntermediaryFormat; clear packs on a failed reload - [`f387c1d`](https://github.com/horizon-rust/horizon/commit/f387c1d78fa7e624b6abd408c1894174a4d8113f) fmt ### 📊 Changes **4 files changed** (+391 additions, -53 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/datapack.rs` (+10 -2) 📝 `crates/horizon-client-render/src/packs.rs` (+342 -46) 📝 `crates/horizon-client/src/game/packs.rs` (+23 -1) 📝 `crates/horizon-client/src/game/server_packs.rs` (+16 -4) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally. Part of #3520 Rows done: - `PackFormat.IntermediaryFormat.validate`: a pack.mcmeta `pack` section is checked as vanilla does (min_format without max_format, nothing declared, a pack_format above 64/81 without min/max); a refused section gives a pack of unknown format (vanilla's fallback codec), not whatever the ranges said. - `PackFormat.IntermediaryFormat.validatePackFormatForRange`: pack_format outside min..max, or a multi-version pack below 15, is refused. - `PackFormat.IntermediaryFormat.validateNewFormat`: min_format above max_format, `supported_formats` next to min_format above the last pre-minor version, and a missing or mismatching `supported_formats`/`pack_format` below it are refused. - `PackFormat.IntermediaryFormat.validateOldFormat`: a `supported_formats` range above 64 (resource) / 81 (data), or one without `pack_format`, is refused. Minor versions now follow `PackFormat.BOTTOM_CODEC`/`TOP_CODEC` (`[97, 0]` as max is minor 0, not "any"). - `PackRepository.isAbleToClearAnyPack`: `packs::able_to_clear_any_pack`. When a selection reload fails (`Minecraft.rollbackResourcePacks` / `clearResourcePacksOnError`) and a selected pack exists, the selection is cleared and saved, the reload runs again, and the `resourcePack.load_fail` `SystemToast` shows. With nothing left to clear, the Options error page stays. Vanilla methods followed: `PackFormat.IntermediaryFormat.{validate,validateNewFormat,validateOldFormat,validatePackFormatForRange}`, `PackFormat.fullCodec`, `PackCompatibility.forVersion`, `PackRepository.isAbleToClearAnyPack`, `Minecraft.rollbackResourcePacks`, `Minecraft.clearResourcePacksOnError`. Not covered: overlay entries (`validateHolderList`) still use the old lenient parsing. Tests: `packs::tests::pack_format_validation`, `clearing_needs_an_existing_selected_pack`; the existing compatibility and data pack tests now use min_format/max_format where vanilla requires them. `cargo test -p horizon-client-render --lib` passes, clippy clean for horizon-client-render and horizon-client. 🤖 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 05:14:47 +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#5757
No description provided.