Skip to content

Phase8 bare metal#82

Open
JustinKovacich wants to merge 1 commit intofeature/phase7_select_biased_timerfrom
feature/phase8_bare_metal
Open

Phase8 bare metal#82
JustinKovacich wants to merge 1 commit intofeature/phase7_select_biased_timerfrom
feature/phase8_bare_metal

Conversation

@JustinKovacich
Copy link
Copy Markdown
Contributor

@JustinKovacich JustinKovacich commented Apr 23, 2026

Initial marker suggesting support for bare_metal with more work to be done to actually implement/integrate.

This PR is part of a chain. See Prev: #81; See Next: #83

@JustinKovacich JustinKovacich requested a review from Copilot April 23, 2026 14:54
This was referenced Apr 23, 2026
@JustinKovacich JustinKovacich added documentation Improvements or additions to documentation enhancement New feature or request labels Apr 23, 2026
@JustinKovacich JustinKovacich self-assigned this Apr 23, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an initial “bare metal” marker and a dedicated workspace example crate intended to validate the library’s no-std transport trait surface, while also continuing the ongoing refactor away from library-internal tokio::spawn usage (except for the per-socket loop that still needs a future Spawner abstraction).

Changes:

  • Add bare_metal marker feature and a new examples/bare_metal workspace member that depends on simple-someip with default-features = false.
  • Add an integration test that builds the bare_metal workspace member to guard against trait-surface regressions.
  • Update client internals/docs: adjust socket loop spawning shape, make dropped-oneshot paths debug! instead of warn!, and update examples/tests to the newer “return run future and spawn it” pattern.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Cargo.toml Adds bare_metal marker feature and includes the new example crate in the workspace.
Cargo.lock Adds the new bare_metal workspace package entry.
src/lib.rs Updates crate-level feature documentation to mention bare_metal and default std.
src/client/socket_manager.rs Refactors socket loop spawning to build a future and spawn at call sites; adds rationale docs.
src/client/mod.rs Makes subscribe_no_wait truly fire-and-forget by dropping the oneshot receiver; adds a stress test.
src/client/inner.rs Downgrades “response receiver dropped” logs from warn to debug (and handles subscribe_no_wait paths).
tests/bare_metal_example_builds.rs New integration test that runs cargo build -p bare_metal.
examples/discovery_client/src/main.rs Spawns the returned client run-loop future.
examples/client_server/src/main.rs Spawns the returned client run-loop future; updates SD announcement loop usage.
examples/bare_metal/Cargo.toml New workspace member depending on simple-someip with default-features = false.
examples/bare_metal/src/main.rs New “bare metal” demo implementing TransportSocket/TransportFactory/Timer with an in-memory mock.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread examples/bare_metal/src/main.rs Outdated
Comment thread examples/bare_metal/src/main.rs Outdated
Comment thread src/lib.rs Outdated
@JustinKovacich JustinKovacich requested a review from Copilot April 23, 2026 17:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/client/mod.rs Outdated
Comment thread src/client/mod.rs
Comment thread examples/bare_metal/src/main.rs Outdated
Comment thread tests/bare_metal_example_builds.rs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread examples/client_server/src/main.rs
Comment thread src/client/socket_manager.rs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/bare_metal_example_builds.rs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread examples/bare_metal/src/main.rs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/bare_metal_example_builds.rs Outdated
Comment thread src/client/inner.rs Outdated
JustinKovacich added a commit that referenced this pull request Apr 24, 2026
- tests/bare_metal_example_builds.rs: reword the module doc and test
  body to explicitly reference workspace-wide Cargo commands
  (`cargo build --workspace`, `cargo clippy --workspace`) instead of
  leaving it ambiguous whether a plain `cargo build` from the repo root
  covers the `bare_metal` workspace member. In a workspace whose root
  is also a package, it often does not.
- src/client/inner.rs: "cancelation" → "cancellation" for consistency
  with the rest of the file (which already uses the double-l spelling).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@JustinKovacich JustinKovacich requested a review from Copilot April 24, 2026 22:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JustinKovacich JustinKovacich marked this pull request as ready for review April 24, 2026 22:15
@JustinKovacich JustinKovacich force-pushed the feature/phase7_select_biased_timer branch from 33ce551 to 398289b Compare April 25, 2026 01:02
Final state of #82, squashed from 14 commits to keep the rebase onto
the rewritten #81 tractable. Several intermediate commits reshape the
same areas (bare_metal example reframing, test hygiene, doc updates,
clippy fixes), so a single rebase against the final shape avoids
fighting transient mid-PR states.

Original commits, oldest first:

- 287b47a  Removed warns on dropped callers, removed tokio::spawn in
           subscribe_no_wait, response oneshot is now silent.

- 6b8dfc3  subscribe_no_wait orphan cleanup.

- c519d4f  Added a bare_metal feature to feature flags and Cargo.toml.

- cff87a8  Added a bare_metal example with no tokio, no socket2, no
           std::net — exercises the TransportSocket / TransportFactory
           / Timer / SpawnFuture trait surface end-to-end on host so
           that breakage of the abstraction is caught before any real
           bare-metal port.

- e2465ef  Added integration tests, gave examples of running
           bare_metal, added warnings against using demo code as
           implementation prototypes.

- 5cd838b  (same subject — second commit of the same change set).

- d4cb3b1  Merge remote-tracking branch
           'origin/feature/phase8_bare_metal' into
           feature/phase8_bare_metal.

- 7e46c3a  phase 8: reframe bare_metal example as host-side
           trait-surface canary. Doc comments and test descriptions
           clarify that the example is a trait-surface canary, not a
           real bare-metal target.

- 16e3b84  round-2: docs + test-hygiene fixes for phase 8.

- c99a9ee  chore(clippy): tidy new warnings in phase8 PR.

- 99eff06  docs: update stale function-name references in comments.

- a45bd5b  test(bare_metal_example_builds): drop runtime
           CARGO_MANIFEST_DIR assert. The runtime check was redundant
           with the at-compile-time path resolution and noisy when run
           outside cargo.

- f770bf9  Update examples/bare_metal/src/main.rs.

- 1e92f43  PR #82 round: workspace-command wording + spelling fixes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@JustinKovacich JustinKovacich force-pushed the feature/phase8_bare_metal branch from 1e92f43 to e4ab414 Compare April 25, 2026 01:05
JustinKovacich added a commit that referenced this pull request Apr 25, 2026
Final state of #83, squashed from 6 commits to keep the rebase onto
the rewritten #82 tractable.

Original commits, oldest first:

- cfbd17a  Added a Spawner trait in transport.rs. TokioSpawner is the
           default std impl. Client::new_with_spawner_and_loopback
           accepts a caller-supplied spawner so the bare-metal port
           can drive socket loops without tokio. New unit tests and
           bare_metal example now demonstrates usage with a
           MockSpawner.

- 9122afd  New bind tests; corrected documentation throughout to
           reflect the concrete next steps toward bare-metal support.

- ee305e0  phase 9: fix intra-doc links that break default-feature
           rustdoc builds. Three sites that referenced feature-gated
           items via intra-doc links: tokio_transport's
           `[Spawner]` -> `[crate::transport::Spawner]`; transport.rs
           link to `[crate::tokio_transport::TokioSpawner]` -> code
           literal with feature-gate note; same pattern at
           transport.rs:478 for `[crate::client::Client]`. Also
           lib.rs module table: intra-doc links for feature-gated
           `[client]` / `[server]` modules -> plain code literals.

- d618081  round-2: fix intra-doc link + correct channel-capacity
           docs. Replace the intra-doc link to
           Client::new_with_spawner_and_loopback in tokio_transport.rs
           with a plain code literal (breaks default-feature rustdoc
           in feature="server"-without-feature="client"). Correct
           socket_manager module doc: per-socket mpsc channels are
           16/16 for discovery sockets, 4/4 for unicast (verified
           against mpsc::channel call sites).

- d2c44e0  chore(clippy): address new warnings in phase9 PR (13 fixes).
           doc_markdown: backtick `no_alloc`, `no_std`, `bare_metal`
           identifiers in new docs. double_must_use on
           Client::new_with_spawner_and_loopback: replace bare
           #[must_use] with a message about the run-loop future.
           dead_code on SocketManager::{bind, bind_discovery_seeded}:
           gate under #[cfg(test)] since the Spawner refactor removes
           non-test callers.

- 721223c  round-3: address Copilot review on socket_manager doc
           links + test JoinHandle. socket_manager: render
           TokioTransport / TokioSpawner refs as code literals (same
           rustdoc-feature-gating pattern as elsewhere in the PR) so
           default-feature doc builds no longer see broken intra-doc
           links. client::tests: bind the JoinHandle from
           tokio::spawn(future) to `_` in the CountingSpawner test so
           the #[must_use] lint does not fire.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@JustinKovacich JustinKovacich requested a review from Copilot April 27, 2026 13:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lib.rs
//! `e2e` modules only — pass `--no-default-features`. The
//! trait-surface canary at `examples/bare_metal/` depends on the crate
//! with `default-features = false, features = ["bare_metal"]` and
//! proves the no-default-features build compiles.
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The crate docs say the examples/bare_metal/ canary “proves the no-default-features build compiles.” That’s only strictly true when that workspace member is built in isolation (e.g. cargo build -p bare_metal), because workspace builds can unify features and end up compiling simple-someip with std enabled due to other members. Consider clarifying the wording to avoid implying cargo build --workspace validates the minimal feature set.

Suggested change
//! proves the no-default-features build compiles.
//! validates that configuration when the `bare_metal` workspace member
//! is built in isolation (for example, `cargo build -p bare_metal` or
//! `cargo run -p bare_metal`), rather than as part of a workspace-wide
//! build where features may be unified.

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +18
//! or running this example proves **that the trait surface compiles
//! under exactly the feature set a firmware consumer would use** —
//! no `std`-feature paths from `simple-someip`, no tokio, no socket2.
//! `cargo build --workspace` catches any regression that breaks this
//! surface even without running the binary.
//!
//! # How to run
//!
//! ```text
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs claim that cargo build --workspace will catch regressions in the default-features = false, features = ["bare_metal"] dependency configuration. In a workspace build, Cargo feature unification can enable simple-someip's default/std features due to other workspace members, so this may not actually validate the minimal (no-default-features) consumer surface. Consider rewording to recommend cargo build -p bare_metal / cargo run -p bare_metal (or adding a dedicated CI step that builds/clippies -p bare_metal in isolation) as the source of truth.

Suggested change
//! or running this example proves **that the trait surface compiles
//! under exactly the feature set a firmware consumer would use** —
//! no `std`-feature paths from `simple-someip`, no tokio, no socket2.
//! `cargo build --workspace` catches any regression that breaks this
//! surface even without running the binary.
//!
//! # How to run
//!
//! ```text
//! or running this package in isolation proves **that the trait
//! surface compiles under exactly the feature set a firmware consumer
//! would use** — no `std`-feature paths from `simple-someip`, no
//! tokio, no socket2. Use `cargo build -p bare_metal` (or
//! `cargo run -p bare_metal`) as the source of truth for that check;
//! `cargo build --workspace` can unify features across workspace
//! members and may therefore mask regressions in this minimal
//! configuration.
//!
//! # How to run
//!
//! ```text
//! cargo build -p bare_metal

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants