[PR #1586] [MERGED] Shader packs, clean room 3: .properties files with conditional directives #3613

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

📋 Pull Request Information

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

Base: main ← Head: feat/shader-packs-properties


📝 Commits (3)

  • 07e46da Shader packs, clean room 1: read packs and their lang files
  • eb0a6f7 Shader packs, clean room 2: macros and #if conditions
  • 397d529 Shader packs, clean room 3: .properties files with conditional directives

📊 Changes

12 files changed (+1199 additions, -1 deletions)

View changed files

📝 AGENTS.md (+1 -0)
📝 Cargo.lock (+8 -0)
📝 Cargo.toml (+1 -1)
➕ crates/horizon-shaders/Cargo.toml (+14 -0)
➕ crates/horizon-shaders/src/condition.rs (+265 -0)
➕ crates/horizon-shaders/src/discover.rs (+82 -0)
➕ crates/horizon-shaders/src/lang.rs (+74 -0)
➕ crates/horizon-shaders/src/lib.rs (+23 -0)
➕ crates/horizon-shaders/src/macros.rs (+131 -0)
➕ crates/horizon-shaders/src/pack.rs (+262 -0)
➕ crates/horizon-shaders/src/properties.rs (+279 -0)
➕ crates/horizon-shaders/tests/real_packs.rs (+59 -0)

📄 Description

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

Shader packs, clean room 3 of 3 (slice 1c): .properties files with their conditional directives: shaders.properties and the id files. Stacked on #1585.

What

Properties::parse(text, macros):

  • key=value lines kept in file order with the line they start on, # comments, blank and indented lines, and a value continued on the next line by a trailing \ (an even run of backslashes is literal).
  • #if #ifdef #ifndef #elif #else #endif evaluated with the standard and option macros. A # line is a directive only when its first word is one, so a commented-out key such as #ifdefault=1 stays a comment.
  • #define and #undef apply to the lines after them in every one of these files. The spec's sources say #define is not allowed in shaders.properties, but the black-box test found a public pack that does #ifdef MC_OS_MAC / #define <option> 0 / #endif there and tests that option further down. Ignoring the define would turn on, on macOS, the code the pack switches off there.
  • A later duplicate key replaces the earlier one. Broken conditionals, lines that are not key=value and duplicates become notes for the pack's log, with their line.

Nothing uses it yet: players see no change (skip-release).

Clean room

Clean-room: implemented from cleanroom/shader-packs-spec.md revision 1, §1.5 item 2, §3.1 and §4.1 (syntax); no other loader's code read. Decisions OQ-16 (continuation, escapes, duplicates, directives against comments, #define in shaders.properties) are in the clean room's impl-plan.md. The #define decision came from the black-box run, and one spec question about it went back to the spec team.

How tested

  • Unit tests: keys, values and comments, continuation lines, nested conditionals with #elif/#else, comment lines that look like directives, defines and undefs, duplicates, broken conditionals and their line numbers.
  • Black box on the public test packs (never committed), tests/real_packs.rs: every shaders.properties and id file reads with 0 notes. Keys read: 29 to 142 in shaders.properties and 20 to 510 in the id files. 0.3–2.8 ms per pack, lang included, on the Mac mini.

Self-check (whole stack, on its top branch)

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 16d49fe66, 18 min 0 s)

Check Result
Scope ⚠️ 12 files, +1199 −1; 1140 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ changes with a Cargo.toml
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (4 s)
clippy ✅ (1 min 12 s)
tests: workspace ✅ 1947 passed (15 min 38 s)
doc tests ✅ 1 passed (1 min 5 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 326 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 314 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Parity: the root Cargo.toml change selects 326 harnesses, but nothing in the game depends on the new crate, so they can't change. CI runs them.

Needs Ludovic

Nothing for this PR. Label skip-release because players see nothing yet. The clean room brief says feature, but no player-facing change ships until the Shader Packs page (slice 9).

🤖 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/1586 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/shader-packs-properties` --- ### 📝 Commits (3) - [`07e46da`](https://github.com/horizon-rust/horizon/commit/07e46daa59e2c6238a443c7992beb10af1307266) Shader packs, clean room 1: read packs and their lang files - [`eb0a6f7`](https://github.com/horizon-rust/horizon/commit/eb0a6f74e6d5911cc63e637b6dcd14076c28ac0e) Shader packs, clean room 2: macros and #if conditions - [`397d529`](https://github.com/horizon-rust/horizon/commit/397d529db72a17a1def83e1d7c50e9f866beb69e) Shader packs, clean room 3: .properties files with conditional directives ### 📊 Changes **12 files changed** (+1199 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `AGENTS.md` (+1 -0) 📝 `Cargo.lock` (+8 -0) 📝 `Cargo.toml` (+1 -1) ➕ `crates/horizon-shaders/Cargo.toml` (+14 -0) ➕ `crates/horizon-shaders/src/condition.rs` (+265 -0) ➕ `crates/horizon-shaders/src/discover.rs` (+82 -0) ➕ `crates/horizon-shaders/src/lang.rs` (+74 -0) ➕ `crates/horizon-shaders/src/lib.rs` (+23 -0) ➕ `crates/horizon-shaders/src/macros.rs` (+131 -0) ➕ `crates/horizon-shaders/src/pack.rs` (+262 -0) ➕ `crates/horizon-shaders/src/properties.rs` (+279 -0) ➕ `crates/horizon-shaders/tests/real_packs.rs` (+59 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. **Shader packs, clean room 3 of 3 (slice 1c):** `.properties` files with their conditional directives: `shaders.properties` and the id files. Stacked on #1585. ## What `Properties::parse(text, macros)`: - `key=value` lines kept in file order with the line they start on, `#` comments, blank and indented lines, and a value continued on the next line by a trailing `\` (an even run of backslashes is literal). - `#if #ifdef #ifndef #elif #else #endif` evaluated with the standard and option macros. A `#` line is a directive only when its first word is one, so a commented-out key such as `#ifdefault=1` stays a comment. - `#define` and `#undef` apply to the lines after them **in every one of these files**. The spec's sources say `#define` is not allowed in `shaders.properties`, but the black-box test found a public pack that does `#ifdef MC_OS_MAC` / `#define <option> 0` / `#endif` there and tests that option further down. Ignoring the define would turn on, on macOS, the code the pack switches off there. - A later duplicate key replaces the earlier one. Broken conditionals, lines that are not `key=value` and duplicates become notes for the pack's log, with their line. Nothing uses it yet: players see no change (`skip-release`). ## Clean room Clean-room: implemented from `cleanroom/shader-packs-spec.md` revision 1, §1.5 item 2, §3.1 and §4.1 (syntax); no other loader's code read. Decisions OQ-16 (continuation, escapes, duplicates, directives against comments, `#define` in `shaders.properties`) are in the clean room's `impl-plan.md`. The `#define` decision came from the black-box run, and one spec question about it went back to the spec team. ## How tested - Unit tests: keys, values and comments, continuation lines, nested conditionals with `#elif`/`#else`, comment lines that look like directives, defines and undefs, duplicates, broken conditionals and their line numbers. - Black box on the public test packs (never committed), `tests/real_packs.rs`: every `shaders.properties` and id file reads with **0 notes**. Keys read: 29 to 142 in `shaders.properties` and 20 to 510 in the id files. 0.3–2.8 ms per pack, lang included, on the Mac mini. ## Self-check (whole stack, on its top branch) **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 16d49fe66, 18 min 0 s) | Check | Result | | --- | --- | | Scope | ⚠️ 12 files, +1199 −1; 1140 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ changes with a Cargo.toml | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (4 s) | | clippy | ✅ (1 min 12 s) | | tests: workspace | ✅ 1947 passed (15 min 38 s) | | doc tests | ✅ 1 passed (1 min 5 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 326 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 314 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Parity: the root `Cargo.toml` change selects 326 harnesses, but nothing in the game depends on the new crate, so they can't change. CI runs them. ## Needs Ludovic Nothing for this PR. Label `skip-release` because players see nothing yet. The clean room brief says `feature`, but no player-facing change ships until the Shader Packs page (slice 9). 🤖 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:10:48 +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#3613
No description provided.