[PR #2] [MERGED] Support noncancellable HEAD hooks on bodies containing macros #9

Closed
opened 2026-11-02 15:32:26 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon-mixins/pull/2
Author: @rdbtCVS
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @levzzz5154

Base: main ← Head: fix/head-only-body-macros


📝 Commits (1)

  • 29a8f8f Allow preserved body macros for noncancellable HEAD hooks

📊 Changes

9 files changed (+246 additions, -13 deletions)

View changed files

📝 Cargo.lock (+1 -0)
📝 README.md (+3 -1)
📝 crates/horizon-mixins-cli/Cargo.toml (+1 -0)
📝 crates/horizon-mixins-cli/tests/cases/boundary.rs (+186 -0)
📝 crates/horizon-mixins-cli/tests/integration.rs (+3 -3)
📝 crates/horizon-mixins-core/src/plan.rs (+34 -2)
📝 crates/horizon-mixins-core/src/state.rs (+1 -1)
📝 docs/boundary-head-and-modules.md (+15 -5)
📝 docs/mixin-api.md (+2 -1)

📄 Description

Fixes #1.

Noncancellable HEAD-only hooks can now target functions containing opaque expression and statement macros such as matches!. The planner preserves those macro tokens and uses the existing prepend-only transformation; no macro expansion or body-site analysis is introduced.

Signature, type, pattern and item macros, unresolved cfg, attribute macros, and cancellable HEAD hooks retain their restrictions. RETURN/interior hooks and state constructor analysis still reject macro-containing bodies, including when combined with HEAD.

Regression coverage compiles two independently declared HEAD callbacks and verifies priority order, exactly-once execution, macro-generated early returns and tail values, local/argument destruction, original body AST preservation, immutable inputs, and unchanged staging mtimes. Negative cases cover unsupported macro contexts, invocation attributes, cancellation and mixed hooks. Documentation describes the supported boundary.

Validation:

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets --locked -- -D warnings
  • cargo test --workspace --locked — 67 integration tests passed
  • python3 tools/feasibility.py

Validation uses the compilation fixtures; the complete Horizon game was not built.


🔄 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-mixins/pull/2 **Author:** [@rdbtCVS](https://github.com/rdbtCVS) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/head-only-body-macros` --- ### 📝 Commits (1) - [`29a8f8f`](https://github.com/horizon-rust/horizon-mixins/commit/29a8f8f84b253ea89422c0049ff5e8bfda36f1fb) Allow preserved body macros for noncancellable HEAD hooks ### 📊 Changes **9 files changed** (+246 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+1 -0) 📝 `README.md` (+3 -1) 📝 `crates/horizon-mixins-cli/Cargo.toml` (+1 -0) 📝 `crates/horizon-mixins-cli/tests/cases/boundary.rs` (+186 -0) 📝 `crates/horizon-mixins-cli/tests/integration.rs` (+3 -3) 📝 `crates/horizon-mixins-core/src/plan.rs` (+34 -2) 📝 `crates/horizon-mixins-core/src/state.rs` (+1 -1) 📝 `docs/boundary-head-and-modules.md` (+15 -5) 📝 `docs/mixin-api.md` (+2 -1) </details> ### 📄 Description Fixes #1. Noncancellable HEAD-only hooks can now target functions containing opaque expression and statement macros such as `matches!`. The planner preserves those macro tokens and uses the existing prepend-only transformation; no macro expansion or body-site analysis is introduced. Signature, type, pattern and item macros, unresolved cfg, attribute macros, and cancellable HEAD hooks retain their restrictions. RETURN/interior hooks and state constructor analysis still reject macro-containing bodies, including when combined with HEAD. Regression coverage compiles two independently declared HEAD callbacks and verifies priority order, exactly-once execution, macro-generated early returns and tail values, local/argument destruction, original body AST preservation, immutable inputs, and unchanged staging mtimes. Negative cases cover unsupported macro contexts, invocation attributes, cancellation and mixed hooks. Documentation describes the supported boundary. Validation: - `cargo fmt --all --check` - `cargo clippy --workspace --all-targets --locked -- -D warnings` - `cargo test --workspace --locked` — 67 integration tests passed - `python3 tools/feasibility.py` Validation uses the compilation fixtures; the complete Horizon game was not built. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:32:26 +07:00
Sign in to join this conversation.
No labels
pull-request
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-mixins#9
No description provided.