[deps] Convert path deps on hero_lib to git deps for reproducibility #34

Closed
opened 2026-04-26 01:50:21 +00:00 by mik-tf · 1 comment
Owner

Background

The workspace currently uses path deps to a sibling-cloned hero_lib:

# Cargo.toml (root)
[patch."https://forge.ourworld.tf/lhumina_code/hero_lib.git"]
herolib_ai = { path = "../hero_lib/crates/ai" }

# Per-crate Cargo.tomls
herolib_ai = { path = "../../../hero_lib/crates/ai" }

This works locally because devs clone all Hero repos in the same parent dir (lhumina_code/hero_lib, lhumina_code/hero_slides, ...). It breaks in any environment that doesn't have the sibling layout — including the Forgejo CI runner which only checks out hero_slides.

Current workaround

hero_slides PR #33 adds a workflow step that clones hero_lib alongside hero_slides before cargo runs. CI then resolves the path dep correctly.

This is fragile:

  • Any new external path dep added to hero_slides silently breaks CI again until the workflow is updated to clone the new sibling.
  • The pattern doesn't help anyone trying to build hero_slides outside the canonical layout (e.g., cargo install hero_slides from a fresh clone).
  • Doesn't compose with the home#187 release-artifacts goal — release builds need to work without sibling checkouts.

Proposed fix

Convert path deps to git deps in Cargo.toml:

# Cargo.toml — workspace root
[workspace.dependencies]
herolib_ai = { git = "https://forge.ourworld.tf/lhumina_code/hero_lib.git", branch = "development", package = "herolib_ai" }

Then each crate that needs it: herolib_ai = { workspace = true }.

Local devs who want to test against their own hero_lib changes can opt in by editing Cargo.toml to add a [patch] section pointing back at ../hero_lib, OR by running with a --config override. The default config — what CI sees, what cargo install sees — uses the git ref.

Acceptance

  • All path = "../hero_lib/..." and the corresponding [patch] in workspace root replaced by git-based workspace deps
  • CI workflow no longer needs the manual git clone hero_lib step (can revert that part of #33)
  • cargo install --git https://forge.ourworld.tf/lhumina_code/hero_slides.git succeeds from a clean machine without prior cloning
  • Document the local-dev [patch] pattern in README or CONTRIBUTING

Signed-off-by: mik-tf

## Background The workspace currently uses **path deps** to a sibling-cloned `hero_lib`: ```toml # Cargo.toml (root) [patch."https://forge.ourworld.tf/lhumina_code/hero_lib.git"] herolib_ai = { path = "../hero_lib/crates/ai" } # Per-crate Cargo.tomls herolib_ai = { path = "../../../hero_lib/crates/ai" } ``` This works locally because devs clone all Hero repos in the same parent dir (`lhumina_code/hero_lib`, `lhumina_code/hero_slides`, ...). It **breaks in any environment that doesn't have the sibling layout** — including the Forgejo CI runner which only checks out hero_slides. ## Current workaround [hero_slides PR #33](https://forge.ourworld.tf/lhumina_code/hero_slides/pulls/33) adds a workflow step that clones hero_lib alongside hero_slides before `cargo` runs. CI then resolves the path dep correctly. This is fragile: - Any new external path dep added to hero_slides silently breaks CI again until the workflow is updated to clone the new sibling. - The pattern doesn't help anyone trying to build hero_slides outside the canonical layout (e.g., `cargo install hero_slides` from a fresh clone). - Doesn't compose with the home#187 release-artifacts goal — release builds need to work without sibling checkouts. ## Proposed fix Convert path deps to git deps in `Cargo.toml`: ```toml # Cargo.toml — workspace root [workspace.dependencies] herolib_ai = { git = "https://forge.ourworld.tf/lhumina_code/hero_lib.git", branch = "development", package = "herolib_ai" } ``` Then each crate that needs it: `herolib_ai = { workspace = true }`. Local devs who want to test against their own hero_lib changes can opt in by editing `Cargo.toml` to add a `[patch]` section pointing back at `../hero_lib`, OR by running with a `--config` override. The default config — what CI sees, what `cargo install` sees — uses the git ref. ## Acceptance - [ ] All `path = "../hero_lib/..."` and the corresponding `[patch]` in workspace root replaced by git-based workspace deps - [ ] CI workflow no longer needs the manual `git clone hero_lib` step (can revert that part of [#33](https://forge.ourworld.tf/lhumina_code/hero_slides/pulls/33)) - [ ] `cargo install --git https://forge.ourworld.tf/lhumina_code/hero_slides.git` succeeds from a clean machine without prior cloning - [ ] Document the local-dev `[patch]` pattern in README or CONTRIBUTING ## Related - Parent CI sweep: [home#188](https://forge.ourworld.tf/lhumina_code/home/issues/188) - Distribution umbrella: [home#187](https://forge.ourworld.tf/lhumina_code/home/issues/187) - Workaround PR: [#33](https://forge.ourworld.tf/lhumina_code/hero_slides/pulls/33) Signed-off-by: mik-tf
Author
Owner

Closing — path B was done directly in PR #33 instead of deferred. The path deps were converted to git deps; the [patch] section was removed; the workflow no longer needs to clone sibling repos. The original issue was filed when I was about to take the workflow-gymnastics shortcut; user pushed back on the discipline lapse.

Closing — path B was done directly in [PR #33](https://forge.ourworld.tf/lhumina_code/hero_slides/pulls/33) instead of deferred. The path deps were converted to git deps; the `[patch]` section was removed; the workflow no longer needs to clone sibling repos. The original issue was filed when I was about to take the workflow-gymnastics shortcut; user pushed back on the discipline lapse.
Sign in to join this conversation.
No labels
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
lhumina_code/hero_slides#34
No description provided.