feat: migrate to per-domain generated/ codegen layout (#96) #6

Merged
timur merged 1 commit from issue-96-generated-folders into development 2026-05-20 23:51:32 +00:00
Owner

Summary

  • Migrates the hero_service template to the new per-domain generated/ codegen layout from hero_rpc#96 (merged as hero_rpc#101).
  • Codegen output is now gitignored everywhere it appears; only contributor-authored files stay tracked.
  • cargo build --workspace leaves git status empty.

What changed

  • Deleted stale *_generated.rs files in crates/hero_service/src/catalog/ and crates/hero_service_server/src/catalog/; codegen now writes to <domain>/generated/ instead.
  • Deleted stale crates/hero_service_sdk/src/catalog.rs; the hero_rpc2 trait file is now at crates/hero_service_sdk/src/generated/catalog.rs.
  • Repo-root .gitignore gets the codegen entries: docs/openrpc.json, docs/*/openrpc.json, crates/hero_service_sdk/src/generated/, sdk/js/src/, sdk/js/types_generated.js, sdk/python/*/ (with the usual !pyproject.toml exception).
  • crates/hero_service_sdk/Cargo.toml declares build = "build.rs" plus a [build-dependencies] hero_service = { path = "../hero_service" }. The shim build.rs is a no-op; the dep edge forces cargo to run hero_service's build.rs (which writes hero_service_sdk/src/generated/ via client_crate_dir) before compiling here.
  • crates/hero_service_server/src/catalog/rpc.rs imports updated: use super::*; (instead of the now-removed super::rpc_generated::*; / super::osis_server_generated::OsisCatalog;). The parent mod.rs's pub use generated::*; re-export surfaces the trait + handler types.
  • Untracked previously-committed codegen output (docs/openrpc.json, docs/catalog/openrpc.json, sdk/js/src/*, sdk/js/types_generated.js).

Acceptance check

$ cargo clean && rm -rf docs crates/hero_service/src/catalog \
    crates/hero_service_server/src/catalog/{generated,mod.rs} \
    crates/hero_service_sdk/src/generated sdk/js/src
$ cargo build --workspace
   ... compiles cleanly ...
$ git status
   (empty)

No *_generated.rs filenames remain in the workspace; everything codegen-emitted lives under a generated/ subfolder that's gitignored next to a contributor-authored sibling.

Test plan

  • Fresh clone + cargo build --workspace succeeds
  • git status after build is empty
  • No *_generated.rs filenames remain anywhere outside target/
  • lab infocheck passes (manifest still parseable from the lib.rs stubs)
  • lab service hero_service --start works (server still finds the embedded docs/openrpc.json)

🤖 Generated with Claude Code

## Summary - Migrates the `hero_service` template to the new per-domain `generated/` codegen layout from hero_rpc#96 (merged as hero_rpc#101). - Codegen output is now gitignored everywhere it appears; only contributor-authored files stay tracked. - `cargo build --workspace` leaves `git status` empty. ## What changed - Deleted stale `*_generated.rs` files in `crates/hero_service/src/catalog/` and `crates/hero_service_server/src/catalog/`; codegen now writes to `<domain>/generated/` instead. - Deleted stale `crates/hero_service_sdk/src/catalog.rs`; the hero_rpc2 trait file is now at `crates/hero_service_sdk/src/generated/catalog.rs`. - Repo-root `.gitignore` gets the codegen entries: `docs/openrpc.json`, `docs/*/openrpc.json`, `crates/hero_service_sdk/src/generated/`, `sdk/js/src/`, `sdk/js/types_generated.js`, `sdk/python/*/` (with the usual `!pyproject.toml` exception). - `crates/hero_service_sdk/Cargo.toml` declares `build = "build.rs"` plus a `[build-dependencies] hero_service = { path = "../hero_service" }`. The shim `build.rs` is a no-op; the dep edge forces cargo to run `hero_service`'s `build.rs` (which writes `hero_service_sdk/src/generated/` via `client_crate_dir`) before compiling here. - `crates/hero_service_server/src/catalog/rpc.rs` imports updated: `use super::*;` (instead of the now-removed `super::rpc_generated::*;` / `super::osis_server_generated::OsisCatalog;`). The parent `mod.rs`'s `pub use generated::*;` re-export surfaces the trait + handler types. - Untracked previously-committed codegen output (`docs/openrpc.json`, `docs/catalog/openrpc.json`, `sdk/js/src/*`, `sdk/js/types_generated.js`). ## Acceptance check ``` $ cargo clean && rm -rf docs crates/hero_service/src/catalog \ crates/hero_service_server/src/catalog/{generated,mod.rs} \ crates/hero_service_sdk/src/generated sdk/js/src $ cargo build --workspace ... compiles cleanly ... $ git status (empty) ``` No `*_generated.rs` filenames remain in the workspace; everything codegen-emitted lives under a `generated/` subfolder that's gitignored next to a contributor-authored sibling. ## Test plan - [ ] Fresh clone + `cargo build --workspace` succeeds - [ ] `git status` after build is empty - [ ] No `*_generated.rs` filenames remain anywhere outside `target/` - [ ] `lab infocheck` passes (manifest still parseable from the lib.rs stubs) - [ ] `lab service hero_service --start` works (server still finds the embedded `docs/openrpc.json`) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Following hero_rpc#96 — codegen output now lives in `generated/`
subfolders that are gitignored everywhere they appear.

Changes:
- Delete stale `*_generated.rs` files in catalog/ and the SDK
  (now under generated/)
- Repo-root `.gitignore` picks up `docs/openrpc.json`,
  `docs/*/openrpc.json`, `sdk/js/src/`, `sdk/python/*/`, and
  `crates/hero_service_sdk/src/generated/`
- `crates/hero_service_sdk` gets a `build.rs` shim plus a
  `[build-dependencies] hero_service = { path = "../hero_service" }`
  so cargo runs the core crate's `build.rs` (which writes this
  crate's `src/generated/`) before compiling here
- Update `crates/hero_service_server/src/catalog/rpc.rs` imports
  to go through the new parent-module `pub use generated::*;`
  re-export instead of the now-removed `rpc_generated`/`osis_server_generated`
  module paths

After this change:
- `cargo build --workspace` leaves `git status` empty
- No `*_generated.rs` filenames remain in the workspace
- Codegen output regenerates cleanly from a fresh clone

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
timur merged commit 447f44b9ff into development 2026-05-20 23:51:32 +00:00
Sign in to join this conversation.
No reviewers
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_service!6
No description provided.