Skip to content

feat(nexus)!: port kernel to no_std (core+alloc) (#279)#303

Merged
joeldsouzax merged 7 commits into
mainfrom
feat/279-no-std-kernel
Jul 6, 2026
Merged

feat(nexus)!: port kernel to no_std (core+alloc) (#279)#303
joeldsouzax merged 7 commits into
mainfrom
feat/279-no-std-kernel

Conversation

@joeldsouzax

Copy link
Copy Markdown
Contributor

Closes #279.

Ports crates/nexus to no_std behind an additive std default feature, and moves public error bounds from std::error::Error to core::error::Error (freeze-relevant — breaking to change after 1.0).

What

  • #![cfg_attr(not(feature = "std"), no_std)]; the production kernel is pure core (no allocator), with alloc pulled in only under test/testing.
  • std::core:: in aggregate.rs, message.rs, id.rs, version.rs. The Aggregate::Error: core::error::Error bound is the freeze-relevant change.
  • thiserror made no_std at the workspace (default-features = false); the three std crates (store/fjall/postgres) opt back in via features = ["std"]. Workspace dependency inheritance cannot override default-features, hence the per-crate opt-in.
  • nexus excluded from workspace-hack (hakari final-excludes) so its std deps can't leak into the kernel build.
  • Toolchain gains wasm32-unknown-unknown + thumbv7em-none-eabihf; two nix flake check gates (nexus-wasm, nexus-nostd) build the kernel --no-default-features for both. thumbv7em is the strong, std-free gate.

Verification

  • nix flake check green, now including nexus-wasm ✅ and nexus-nostd ✅.
  • no_std thumbv7em build went RED → GREEN (was can't find crate for std).
  • std + all-features + testing builds unchanged.

Scope

Kernel only. Full store no_std is tracked as pre-freeze follow-ups #300 (extract nexus-wake) → #301 (store no_std + error bounds) → #302 (no_std WakeSource bridge).

Design + plan: docs/superpowers/specs/2026-07-06-no-std-kernel-design.md, docs/superpowers/plans/2026-07-06-no-std-kernel.md.

🤖 Generated with Claude Code

joeldsouzax and others added 6 commits July 6, 2026 14:54
Design spec for porting crates/nexus to no_std (core+alloc) behind an
additive std default feature. Scope is kernel-only; store no_std is
tracked as follow-ups #300/#301/#302.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ack (#279)

Turns off thiserror default features at the workspace (workspace inheritance
cannot override default-features), re-enabling `std` on the three std crates
(store/fjall/postgres) and via nexus's new additive `std` default feature.
Excludes `nexus` from workspace-hack (hakari final-excludes) so no std leaks
into the no_std kernel build.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…or (#279)

Adds `#![cfg_attr(not(feature = "std"), no_std)]`; production kernel is pure
`core` (no allocator), with `alloc` pulled in only under `test`/`testing`.
Swaps `std::` -> `core::` in aggregate/message/id/version. The public
`Aggregate::Error: core::error::Error` bound is the freeze-relevant change.

Verified: builds `--no-default-features` for thumbv7em-none-eabihf (strong,
std-free) and wasm32-unknown-unknown; std + all-features unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds nexus-nostd (thumbv7em-none-eabihf, the std-free strong gate) and
nexus-wasm (wasm32-unknown-unknown) as `nix flake check` derivations, so
CI stays "just run nix flake check". Both build --no-default-features.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@joeldsouzax

Copy link
Copy Markdown
Contributor Author

Follow-up filed: #304 — a no_std compile smoke-test that gates the derive macro output (#[nexus::aggregate] / #[derive(DomainEvent)]) for thumbv7em + wasm. This PR's gates build the kernel --no-default-features (bare), which proves the core compiles no_std but doesn't exercise the derive/testing feature paths on a no_std target. The derive path is the actual downstream (KERI-on-phone) use case, so #304 closes it before freeze. Kernel logic remains tested on std via nextest.

#279)

Task 3 dropped the workspace-hack edge from nexus and hakari added thiserror
to workspace-hack; Cargo.lock must reflect both or CI's --locked build fails.
(Local gate passed against the dirty tree; the committed tree was stale.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@joeldsouzax joeldsouzax merged commit f073171 into main Jul 6, 2026
4 checks passed
@joeldsouzax joeldsouzax deleted the feat/279-no-std-kernel branch July 6, 2026 14:31
@github-actions github-actions Bot mentioned this pull request Jul 6, 2026
joeldsouzax added a commit that referenced this pull request Jul 8, 2026
#279 (PR #303) made the kernel no_std and added flake gates that build it
`--no-default-features` for thumbv7em + wasm32. Those prove the *core* is
no_std, but never compile the *output* of `#[nexus::aggregate]` /
`#[derive(DomainEvent)]` for a no_std target — the macro source was only
grepped for `std::`, which is weak.

Add `nexus-nostd-smoketest`: a `#![no_std]` crate defining an aggregate via
both macros + `Handle` impls, entirely in `core` (`Events<E, 0>`, no
allocator). Both flake gates now also build it `--features derive` for
thumbv7em + wasm32, so a macro emitting a `std::` path fails the bare-metal
build. The probe lives behind the `derive` feature; `nexus`/`thiserror` are
optional and pulled only by it (`nexus/derive` is additive, not `nexus/std`).

Excluded from workspace-hack (like `nexus`) so no std edge reaches the
bare-metal build. Logic correctness stays covered on the host by the
nexus-cross-crate-test suite — this is a compile probe.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

[freeze][T1] no_std kernel: port nexus to core+alloc (public error bounds are freeze-relevant) — or drop the IoT claim

1 participant