[PR #5] [MERGED] 0.6.0: named hooks, bundle crates, data and post-build steps #11

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

📋 Pull Request Information

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

Base: main ← Head: feat/crates-data-named-hooks


📝 Commits (2)

  • 0291f4d Named hooks, bundle crates, data and post-build steps (0.6.0)
  • b74802d Test and document 0.6.0 bundle crates, data, named hooks and post-build

📊 Changes

50 files changed (+1924 additions, -46 deletions)

View changed files

📝 AGENTS.md (+1 -1)
📝 Cargo.lock (+5 -3)
📝 Cargo.toml (+4 -2)
📝 README.md (+14 -1)
📝 crates/horizon-mixins-cli/src/main.rs (+6 -4)
📝 crates/horizon-mixins-cli/tests/cases/advanced.rs (+1 -1)
📝 crates/horizon-mixins-cli/tests/cases/boundary.rs (+3 -1)
📝 crates/horizon-mixins-cli/tests/cases/effects.rs (+1 -1)
➕ crates/horizon-mixins-cli/tests/cases/native.rs (+375 -0)
📝 crates/horizon-mixins-cli/tests/cases/scoped.rs (+1 -1)
📝 crates/horizon-mixins-cli/tests/integration.rs (+3 -0)
📝 crates/horizon-mixins-cli/tests/snapshots/advanced-plan.json (+2 -2)
📝 crates/horizon-mixins-cli/tests/snapshots/boundary-plan.json (+3 -3)
📝 crates/horizon-mixins-cli/tests/snapshots/effects-plan.json (+2 -2)
📝 crates/horizon-mixins-cli/tests/snapshots/plan.json (+2 -2)
📝 crates/horizon-mixins-cli/tests/snapshots/scoped-plan.json (+2 -2)
📝 crates/horizon-mixins-core/Cargo.toml (+2 -0)
📝 crates/horizon-mixins-core/src/diagnostic.rs (+8 -1)
📝 crates/horizon-mixins-core/src/index.rs (+17 -0)
📝 crates/horizon-mixins-core/src/lib.rs (+2 -1)

...and 30 more files

📄 Description

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

horizon-mixins 0.6.0: the horizon-mixins half of the native mod API, round 2. Native bundles can now be bigger than a few helper files.

  • Named hooks. An injection can set hook + hook_version instead of target. These are resolved from <workspace>/native-hooks.json before planning. Name resolution follows arismoko's catalog in horizon-rust/horizon#3871, using the same format. The plan keeps the resolved target and also records hook/hook_version. New codes: E_HOOK_CATALOG, E_HOOK_UNKNOWN (lists the known names) and E_HOOK_VERSION (lists the versions it has). target together with hook, or hook without hook_version, is E_MANIFEST.
  • [[crate]]. A bundle's own Cargo package is copied to native-crates/<mod>/<crate>/ and added to the root members. The dependent gets <package> = { path = … } (default dependent: horizon-client). The crate is also added to Cargo.lock in Cargo's own format, so the stage still builds with --locked. Manifests are edited with toml_edit. Dependencies must be plain registry requirements that match a package already in the lock (E_CRATE_DEPENDENCY: "boost needs rand ^0.8, which isn't in Horizon's Cargo.lock"). E_CRATE rejects [workspace]/[target]/[patch], a Cargo.lock in the crate, escaping paths, package-name collisions and unknown dependents.
  • data/ is staged to native-data/<mod>/. This closes the gap that horizon-rust/horizon#3880 notes.
  • [[post_build]] steps are checked (the crate belongs to the same mod, the bin exists) and written to native-post-build.json, which is [] when no mod has one. The tool never runs them.

Everything stays under the existing staging rules: atomic publication, deterministic output, unchanged bytes and mtimes, symlinks and .. rejected. Plans use schema 6. toml_edit and semver were already in Cargo.lock through toml and cargo_metadata, so no new packages were added. Docs: docs/crates-data-and-named-hooks.md, plus a roadmap row and README notes.

Tests: new fixtures/native + fixtures/native-mods/boost. It has a named HEAD hook whose helper calls the bundle crate (boost-engine → locked serde_json, which reads its own data/table.json with include_bytes!), reads bundle data, and has a bake post-build bin. The staged workspace passes cargo test --workspace --locked --offline. Nine new integration tests (89 in total) cover this path, two mods' crates, and every new error. cargo fmt --check, clippy -D warnings and cargo test --workspace --locked pass on both 1.95.0 and stable. I also applied a crate bundle to a Horizon main export carrying the #3871 catalog; cargo metadata --locked accepts the resulting stage.

🤖 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-mixins/pull/5 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `feat/crates-data-named-hooks` --- ### 📝 Commits (2) - [`0291f4d`](https://github.com/horizon-rust/horizon-mixins/commit/0291f4d801817f2e834b192cd3a1cd6f63e4cac4) Named hooks, bundle crates, data and post-build steps (0.6.0) - [`b74802d`](https://github.com/horizon-rust/horizon-mixins/commit/b74802d8acdf3968a520ccb11b5749cf9fcfc386) Test and document 0.6.0 bundle crates, data, named hooks and post-build ### 📊 Changes **50 files changed** (+1924 additions, -46 deletions) <details> <summary>View changed files</summary> 📝 `AGENTS.md` (+1 -1) 📝 `Cargo.lock` (+5 -3) 📝 `Cargo.toml` (+4 -2) 📝 `README.md` (+14 -1) 📝 `crates/horizon-mixins-cli/src/main.rs` (+6 -4) 📝 `crates/horizon-mixins-cli/tests/cases/advanced.rs` (+1 -1) 📝 `crates/horizon-mixins-cli/tests/cases/boundary.rs` (+3 -1) 📝 `crates/horizon-mixins-cli/tests/cases/effects.rs` (+1 -1) ➕ `crates/horizon-mixins-cli/tests/cases/native.rs` (+375 -0) 📝 `crates/horizon-mixins-cli/tests/cases/scoped.rs` (+1 -1) 📝 `crates/horizon-mixins-cli/tests/integration.rs` (+3 -0) 📝 `crates/horizon-mixins-cli/tests/snapshots/advanced-plan.json` (+2 -2) 📝 `crates/horizon-mixins-cli/tests/snapshots/boundary-plan.json` (+3 -3) 📝 `crates/horizon-mixins-cli/tests/snapshots/effects-plan.json` (+2 -2) 📝 `crates/horizon-mixins-cli/tests/snapshots/plan.json` (+2 -2) 📝 `crates/horizon-mixins-cli/tests/snapshots/scoped-plan.json` (+2 -2) 📝 `crates/horizon-mixins-core/Cargo.toml` (+2 -0) 📝 `crates/horizon-mixins-core/src/diagnostic.rs` (+8 -1) 📝 `crates/horizon-mixins-core/src/index.rs` (+17 -0) 📝 `crates/horizon-mixins-core/src/lib.rs` (+2 -1) _...and 30 more files_ </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Opus 5.5), not by levzzz5154 themselves. horizon-mixins 0.6.0: the horizon-mixins half of the native mod API, round 2. Native bundles can now be bigger than a few helper files. - **Named hooks.** An injection can set `hook` + `hook_version` instead of `target`. These are resolved from `<workspace>/native-hooks.json` before planning. Name resolution follows arismoko's catalog in horizon-rust/horizon#3871, using the same format. The plan keeps the resolved `target` and also records `hook`/`hook_version`. New codes: `E_HOOK_CATALOG`, `E_HOOK_UNKNOWN` (lists the known names) and `E_HOOK_VERSION` (lists the versions it has). `target` together with `hook`, or `hook` without `hook_version`, is `E_MANIFEST`. - **`[[crate]]`.** A bundle's own Cargo package is copied to `native-crates/<mod>/<crate>/` and added to the root `members`. The dependent gets `<package> = { path = … }` (default dependent: `horizon-client`). The crate is also added to `Cargo.lock` in Cargo's own format, so the stage still builds with `--locked`. Manifests are edited with `toml_edit`. Dependencies must be plain registry requirements that match a package already in the lock (`E_CRATE_DEPENDENCY`: "boost needs rand ^0.8, which isn't in Horizon's Cargo.lock"). `E_CRATE` rejects `[workspace]`/`[target]`/`[patch]`, a `Cargo.lock` in the crate, escaping paths, package-name collisions and unknown dependents. - **`data/`** is staged to `native-data/<mod>/`. This closes the gap that horizon-rust/horizon#3880 notes. - **`[[post_build]]`** steps are checked (the crate belongs to the same mod, the bin exists) and written to `native-post-build.json`, which is `[]` when no mod has one. The tool never runs them. Everything stays under the existing staging rules: atomic publication, deterministic output, unchanged bytes and mtimes, symlinks and `..` rejected. Plans use schema 6. `toml_edit` and `semver` were already in `Cargo.lock` through `toml` and `cargo_metadata`, so no new packages were added. Docs: `docs/crates-data-and-named-hooks.md`, plus a roadmap row and README notes. Tests: new `fixtures/native` + `fixtures/native-mods/boost`. It has a named HEAD hook whose helper calls the bundle crate (`boost-engine` → locked `serde_json`, which reads its own `data/table.json` with `include_bytes!`), reads bundle data, and has a `bake` post-build bin. The staged workspace passes `cargo test --workspace --locked --offline`. Nine new integration tests (89 in total) cover this path, two mods' crates, and every new error. `cargo fmt --check`, `clippy -D warnings` and `cargo test --workspace --locked` pass on both 1.95.0 and stable. I also applied a crate bundle to a Horizon `main` export carrying the #3871 catalog; `cargo metadata --locked` accepts the resulting stage. 🤖 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-02 15:32:28 +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#11
No description provided.