Skip to content

PR 0: future-size measurement harness + build-std/nm CI gates (#125)#127

Closed
JustinKovacich wants to merge 9 commits into
feat/no-alloc-bare-metalfrom
feature/pr0_measurement_harness
Closed

PR 0: future-size measurement harness + build-std/nm CI gates (#125)#127
JustinKovacich wants to merge 9 commits into
feat/no-alloc-bare-metalfrom
feature/pr0_measurement_harness

Conversation

@JustinKovacich

Copy link
Copy Markdown
Contributor

First PR of the #125 / phase-22 close-out stack
(docs/simple_someip/plans/2026-06-09-phase22-125-memory-reduction-design.md).

Stacked on #124 (feat/no-alloc-bare-metal) — when that merges, this
retargets to feature/phase21_api_symmetry.

  • Host-proxy future-size witness tests (budgets = baseline x1.25) for client
    run/socket-loop + server run futures, tokio AND static-channel configs.
  • tools/capture_type_sizes.sh + size_probe client-future instantiation:
    authoritative thumbv7em -Zprint-type-sizes table. Baseline committed under
    docs/simple_someip/plans/baselines/.
  • CI: -Zbuild-std=core gate (halo no-alloc-sysroot certification; the
    prebuilt-sysroot job ships alloc and cannot catch this class) + nm
    alloc audit extended to server,bare_metal (alloc-free since feat(server): make server alloc-free on bare_metal, and surface inbound non-SD unicast #124).

No production-code behavior changes; transport::probe adds public
zero-behavior stubs (documented probe-only). First commit is rustfmt/clippy
cleanup over the #124 base; review commit-by-commit if that's noisy.

🤖 Generated with Claude Code

JustinKovacich and others added 8 commits June 10, 2026 17:06
Pure formatting/lint fixes on Feliciano's #124 commits: import
ordering, line reflow, allow(unused_imports) on the no-tracing log
aliases (every call site compiles out under --no-default-features),
and Box::pin on the embassy example's ~16 KiB setup future
(clippy::large_futures). No behavior changes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Moves the zero-behavior NullSocket/NullFactory/NullTimer/
NullE2ERegistry/NullInterface impls out of #[cfg(test)] into
transport::probe (cfg'd test-or-bare_metal) and adds NullSpawner, so
tools/size_probe can instantiate the client futures on
thumbv7em-none-eabihf for -Zprint-type-sizes layout capture.
Documented probe-only: not for production use (#125 PR 0).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Host-arch proxy budgets (baseline x1.25, rounded up to 64) for
Inner::run_future and the spawned socket loop, measured via
size_of_val before tokio::spawn moves them. Trips on layout
regressions; authoritative thumb numbers come from
tools/capture_type_sizes.sh (#125 PR 0).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Same proxy-budget rules as the client witness. Also rustfmt reflow of
the #124-era test bodies in this file. (#125 PR 0)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…nnels

Bare-metal-channel configuration witnesses for the client run/socket-
loop futures and the server run future — the configuration TC4
actually ships, host-arch proxy numbers (#125 PR 0).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…seline

- tools/size_probe grows a client feature: instantiates Inner::run_future
  / socket_loop_future no_std over transport::probe Null* deps and a
  probe-local heapless ProbePayload (mirrors TestPayload — cross-ref
  note added there), so -Zprint-type-sizes reports real on-target layouts.
- tools/capture_type_sizes.sh: one-command host + thumb capture into
  target/type-sizes/summary.md.
- docs/.../baselines/pr0-size-baseline.md: committed pre-optimization
  numbers the #125 PRs diff against (thumb table is client-only in PR 0;
  server thumb probe lands with PR 3's static plumbing).
- docs/.../2026-06-09-phase22-125-memory-reduction-design.md: the spec
  this stack implements, referenced by CI comments and the baseline.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…are_metal

- New build_std_core job: builds client/server/combined bare_metal with
  -Zbuild-std=core on thumbv7em — halo's TC4 proxy has NO alloc in its
  sysroot, and the prebuilt-sysroot job ships alloc so it cannot catch
  an extern-crate-alloc regression.
- no_std job: server,bare_metal gets the same clean-build + nm
  alloc-symbol audit as the client (alloc-free since #124); stale
  Arc<EventPublisher> comments fixed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Also updates the 0.8.0 'known limitation: server pulls alloc' note,
which PR #124 made false (recorded deviation — #124 didn't touch the
changelog, and this PR's CI now asserts the opposite).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a measurement/regression harness for async future layout growth (issue #125) and strengthens CI gates to ensure thumbv7em bare-metal builds remain alloc-free, including under -Zbuild-std=core. This fits the codebase’s embedded/no-alloc goals by making memory regressions detectable early and by providing authoritative on-target type-size capture tooling.

Changes:

  • Introduces thumbv7em -Zprint-type-sizes capture tooling (tools/capture_type_sizes.sh) and a tools/size_probe no_std probe that instantiates client run/socket-loop futures for authoritative layout measurement.
  • Adds host “future size witness” tests (tokio + bare-metal static-channel configs) with +25% proxy budgets to trip on regressions.
  • Extends CI with a nightly -Zbuild-std=core thumb gate and expands alloc-symbol (nm) audits to cover server,bare_metal.

Reviewed changes

Copilot reviewed 22 out of 23 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tools/size_probe/src/lib.rs Adds a no_std client-future instantiation entrypoint and probe-local payload/channel types for type-size capture.
tools/size_probe/Cargo.toml Updates probe crate purpose/docs and adds deps needed for the probe-local payload implementation.
tools/size_probe/Cargo.lock Locks new transitive deps introduced by enabling client + adding probe-local deps.
tools/capture_type_sizes.sh New script to generate host + thumbv7em -Zprint-type-sizes summaries.
tests/no_alloc_server_witness.rs Formatting-only update to static subscription storage initialization.
tests/bare_metal_server.rs Minor import/formatting adjustments around NonSdRequestCallback and a test assertion.
tests/bare_metal_e2e.rs Adds documentation about shared static pools + adds bare-metal future-size witness test with budgets.
src/transport.rs Promotes “null” dependency stubs into transport::probe for layout probing / trait conformance.
src/server/subscription_manager.rs Formatting-only change to the boxed-future associated type.
src/server/runtime.rs Minor formatting and log message formatting improvements.
src/server/mod.rs Formatting-only adjustments and import consolidation.
src/protocol/sd/test_support.rs Notes coupling between test payload and size-probe payload layout mirroring.
src/log.rs Suppresses unused_imports when tracing is off and callsites are cfg’d out.
src/lib.rs Minor module ordering change (log moved).
src/client/socket_manager.rs Import ordering change for crate::log aliases.
src/client/mod.rs Adds tokio client future-size witness test + budgets; minor import ordering change.
src/client/inner.rs Import ordering change for crate::log aliases.
simple-someip-embassy-net/tests/loopback.rs Formatting-only change to boxed future associated types.
examples/embassy_net_client/src/main.rs Avoids large async stack frame via Box::pin; tweaks buffer allocation style.
docs/simple_someip/plans/baselines/pr0-size-baseline.md Adds PR0 baseline capture data and regeneration instructions.
docs/simple_someip/plans/2026-06-09-phase22-125-memory-reduction-design.md Adds design/plan doc for the #125 memory reduction PR stack.
CHANGELOG.md Documents new infra (witness tests, probes, capture script, CI gates) and updated alloc-free server status.
.github/workflows/ci.yml Adds -Zbuild-std=core thumb gate and extends alloc-symbol audit coverage.

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

Comment thread tests/bare_metal_e2e.rs
Comment on lines +669 to +692
let run_size = core::mem::size_of_val(&run_fut);
let _run_handle = tokio::spawn(run_fut);
client.bind_discovery().await.expect("bind_discovery");
let loop_size = max_spawned.load(Ordering::SeqCst);

println!("FUTURE_SIZE bm_client_run_future {run_size}");
println!("FUTURE_SIZE bm_client_socket_loop {loop_size}");
println!("FUTURE_SIZE bm_server_run_future {server_run_size}");

assert!(loop_size > 0, "spawner never received the socket loop");
assert!(
run_size <= BM_CLIENT_RUN_FUTURE_BUDGET,
"client run future grew: {run_size} B > budget {BM_CLIENT_RUN_FUTURE_BUDGET} B"
);
assert!(
loop_size <= BM_CLIENT_SOCKET_LOOP_BUDGET,
"socket loop future grew: {loop_size} B > budget {BM_CLIENT_SOCKET_LOOP_BUDGET} B"
);
assert!(
server_run_size <= BM_SERVER_RUN_FUTURE_BUDGET,
"server run future grew: {server_run_size} B > budget {BM_SERVER_RUN_FUTURE_BUDGET} B"
);
client.shut_down();
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Declining this one. The pool-budget header at the top of the file (lines ~46-53) already accounts for it: each Client::new_with_deps claims one ControlMessage + one ClientUpdate slot, both pools hold 4, and this witness is counted in the documented "3 client-constructing tests worst-case" — with the growth rule spelled out for whoever adds a 4th. Also, #[tokio::test] drops its runtime when the test fn returns, which drops the spawned run future at test exit — a claim can't outlive its test, so there's no cross-test leak beyond the budgeted concurrent overlap. Awaiting teardown with a timeout would add machinery the budget already makes unnecessary (and the sibling e2e test in this file uses the same spawn-then-abort shape).

Comment thread tools/size_probe/Cargo.toml Outdated
Comment on lines +47 to +49
# `client,bare_metal` — the audited alloc-free combo (no `server`,
# which pulls `extern crate alloc` per the lib.rs feature table).
# `bare_metal` covers the codec-only FFI surface (matches halo PR

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in ef988f7 — and this comment turned out to be one of four sites still claiming server pulls extern crate alloc: the lib.rs feature-table row, the extern crate alloc rationale block in lib.rs, and Cargo.toml's _alloc marker comment (which contradicted the server feature comment 20 lines below it). All four now state the post-#124 reality: _alloc is implied by std / embassy_channels only and gates the Arc-backed conveniences.

PR #124 made the server engine alloc-free but left four doc/comment
sites claiming otherwise: the lib.rs feature table row, the
extern-crate-alloc rationale block, Cargo.toml's _alloc marker
comment, and tools/size_probe's dependency comment (the flagged one).
All now state the post-#124 reality: _alloc comes from
std/embassy_channels only, gating the Arc-backed conveniences.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@JustinKovacich

Copy link
Copy Markdown
Contributor Author

Folded into main via the 0.8.0 consolidation (#138). Content verified present in main; closing and deleting the branch as part of post-0.8.0 cleanup.

@JustinKovacich
JustinKovacich deleted the feature/pr0_measurement_harness branch June 29, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants