Restructure into a cargo workspace and refresh GitHub Actions - #2
Conversation
….rs,crates/template/examples/ve Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
The single-root package layout is replaced with a virtual workspace whose members live under `crates/`, making every crate structurally uniform. Shared metadata and dependency entries are hoisted into `[workspace.package]` and `[workspace.dependencies]` so that version bumps and lint configuration apply to all members from one place, and the `exclude` list prevents cargo from walking into the vendor submodule or git worktrees. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Added a new dependency to the template-bus crate's Cargo.toml to support an upcoming feature that requires external library functionality. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce three new modules to the template-bus crate: greeting, names, and version, each with their own types and tests. This establishes the core domain logic for the bus template, enabling structured handling of greetings, name resolution, and versioning. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Update the test to verify that version comparison returns the expected ordering when comparing two different version strings. The previous assertion was checking the wrong direction, which would have caused the test to pass incorrectly for reversed comparisons. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
When parsing template version data, the code previously assumed the version field was always present. This caused a panic when encountering templates without a version field. The fix adds a check for the field's existence and returns a clear error message instead of panicking. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
The template crate was missing its Cargo.toml manifest file, which prevented it from being built as a standalone package. This change adds the necessary manifest to enable proper compilation and dependency management. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
The tinybus module and its test file were inadvertently removed during a previous refactor. This change restores the module structure and its associated tests to ensure the template crate compiles and functions correctly. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
…dule Remove three example files that were no longer referenced or maintained, and clean up the greeting module by removing unused code paths. This reduces maintenance burden and clarifies the public API surface. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the verify_github_release example to properly handle authentication and error cases that were causing failures during testing. The verify_module example was also adjusted to align with the corrected release verification logic, ensuring both examples demonstrate accurate usage patterns. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
…pendency The Cargo.lock file was updated to reflect the renaming of the `rust-template` package to `template`, and a new `template-bus` dependency was added to the project. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test assertions now compare owned strings instead of references, ensuring the equality checks work correctly when the expected values are `Vec<&str>` and `&str` respectively. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reformatted two multi-line assertions in the test module to use a more conventional Rust style with each argument on its own line, improving readability without changing any test logic. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Added a README.md file to the template-bus crate to provide an overview of its purpose and usage, helping developers understand how to integrate and work with the template bus functionality. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
The version requirement was removed from the template-bus dependency because the workspace version changes with every release and a pinned version would prevent resolution. Since nothing in this workspace is published, the path specification alone is sufficient for addressing the crate. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
The CI workflow configuration was updated to reference the latest versions of GitHub Actions, ensuring compatibility with current runner environments and avoiding deprecation warnings. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
…pace-level versioning Pin all third-party GitHub Actions to immutable commit SHAs with the release tag in a trailing comment, replacing mutable version tags to improve supply-chain security. Introduce a `RELEASE_PACKAGE` environment variable to identify the workspace member that ships as the loadable module, and update the version bump logic to operate on `[workspace.package]` so that the single version is inherited by all workspace members. Change `submodules: true` to `submodules: recursive` and adjust `cargo build` and `cargo run` invocations to target the specific package, ensuring the workflow correctly handles a multi-crate workspace. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Replace all third-party action references in CI and release workflows from pinned commit SHAs with their corresponding version tags, and remove the explanatory comments about SHA pinning. This simplifies maintenance while still using stable release references. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
The coverage script now points to `crates/` instead of `src/` to match the actual workspace layout, and the `--workspace` flag is added to include all crates in the coverage report. The release workflow also fixes variable interpolation by switching from a quoted shell variable to the proper GitHub Actions expression syntax. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Update all documentation and the module readme to reflect the crate's new name, changing `rust_template` and `rust-template` to `template` throughout. The module interface, archive names, and code examples now use the shorter identifier to match the renamed package. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
…nd contract split for two-crate The project has been restructured from a single crate into a workspace with two crates: `template-bus` for the wire contract and `template` for the module behavior. The AGENTS.md file now reflects the workspace layout, the two-crate split rationale, and updated conventions for dependencies, testing, releases, and error handling. The tinybus_module README clarifies that interface names and payload types come from the contract crate, making renames a compile error rather than a runtime failure. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add `allow-wildcard-paths = true` to the `[advisories]` section of deny.toml. Workspace-internal path dependencies on unpublished crates use wildcard versions by construction, and a caret range on such a dependency would break on the first minor or major release, causing a late failure in the release workflow. The exemption is narrow: it applies only to path dependencies on crates with `publish = false`, while wildcards from any registry remain denied. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (39)
📝 WalkthroughWalkthroughThe project becomes a Cargo workspace with separate ChangesWorkspace split and typed TinyBus contract
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant TinyBusModule as template TinyBus module
participant Greeting as template::greet
participant Contract as template-bus
Caller->>TinyBusModule: Send typed GreetRequest
TinyBusModule->>Contract: Decode contract payload
TinyBusModule->>Greeting: Call greet(name)
Greeting-->>TinyBusModule: Return greeting or Error
TinyBusModule->>Contract: Encode GreetResponse
TinyBusModule-->>Caller: Return typed response
Poem
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| components: rustfmt, clippy | ||
|
|
||
| - uses: taiki-e/install-action@cargo-llvm-cov | ||
| - uses: taiki-e/install-action@v2 |
| components: rustfmt, clippy | ||
|
|
||
| - uses: taiki-e/install-action@cargo-llvm-cov | ||
| - uses: taiki-e/install-action@v2 |
How this change flows0 changed behaviours across 2 relationships. 4 surrounding behaviours are shown (60 graph nodes walked). 56 further behaviours left out to keep the diagram readable. flowchart LR
n0["Error"]:::impacted
n1["Result"]:::impacted
n2["setup"]:::impacted
n3["INTERFACE"]:::impacted
n1 -->|uses| n0
n2 -->|uses| n3
classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Green: changed behaviour. Grey: surrounding behaviour. Arrows name the call, use, implementation, or test relationship. Orange: has findings. Red: has a finding that blocks the merge. |
What changed and why
The crate was a single root package that mixed the wire contract with the
implementation. A host that loads the
cdylibcannotuseanything out of it,so it had no way to name the payload types without compiling the whole module —
tinybus,tokioand the module SDK included.This splits the repository into a virtual cargo workspace under
crates/:crates/template-bus— the wire contract. The interface name, objectpath, and one constant per member (
names); theGreetrequest/responsepayloads (
greeting); andCONTRACT_VERSIONplus the host bind rule(
version). Two pure-Rust dependencies,serdeandserde_json. Notransport, no runtime, no behavior.
crates/template— the implementation: thegreetbehavior, thecrate-wide error type, and the TinyBus adapter, built as both an
rlibandthe
cdylibthe loader consumes. It depends ontemplate-busand re-exportsall of it, so
template::GreetRequestandtemplate_bus::GreetRequestarethe same type rather than structural twins.
Shared metadata, dependencies, and the whole lint set now live once in the root
[workspace.package]/[workspace.dependencies]/[workspace.lints], andmembers inherit them.
GitHub Actions move to their latest major versions:
actions/checkout@v7,actions/upload-artifact@v7(from v4),actions/download-artifact@v8(fromv4),
taiki-e/install-action@v2with an explicittool:, andsubmodules: recursiveeverywhere.Public API and behavior changes
Yes — breaking, and deliberate for a template:
rust-template→template, so the library islibtemplate.{so,dylib,dll}and release assets aretemplate-<version>-<platform>.<tar.gz|zip>.ai.tinyhumans.rust_template.Greeting→ai.tinyhumans.template.Greeting, and the object path with it.Greetnow takes aGreetRequestand returns aGreetResponseinstead of abare string on each side. That is the point of the contract crate: a host
names the payload from a library instead of by string literal.
template-buson the public surface, re-exported fromtemplate.CI and release
check-file-coverage.shscanscrates/and runscargo llvm-cov --workspace.template-busnever pulls in a transport, an asyncruntime, an HTTP client, or a native library — the forward
cargo tree -pform, because the inverse form silently discards the
-pscope.--all-targetsonly compiles one.deny.tomlsetsallow-wildcard-paths = true. Workspace-internal pathdependencies deliberately carry no
version: it would be a caret range, sothe first bump past
0.1.xwould stop resolving and the release workflowwould discover it after the tag was pushed. The exemption is narrow — it
applies only to path deps on crates with
publish = false, and a wildcard onanything from a registry is still denied.
RELEASE_PACKAGE: template)rather than
packages[0], whose order cargo does not promise, bumps thesingle
[workspace.package]version, and verifies the bump took beforetagging.
Validation
CI is green on this branch (run 32494741317): Rust, Docs, MSRV, Supply chain.
Locally:
cargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warningscargo build --all-targets --all-featurescargo test --all-featuresRUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-featurescargo deny check all.github/scripts/check-file-coverage.sh 90 coverage.jsoncargo build --locked --release --lib -p templatecargo run -p template --example verify_module -- target/release/libtemplate.soGreetNotes
crates/templateis an ordinary workspace member, not its own workspace root.The
[workspace.package]inheritance failure that forces a separate root inother repositories does not reproduce here; it was checked rather than assumed.
README.md,AGENTS.md(and soCLAUDE.md),MODULE.md,docs/specs/,docs/plans/, and a newcrates/template-bus/README.mdexplaining why the contract is its own crate.Summary by CodeRabbit
New Features
Documentation
Tests