Skip to content

refactor(net): fold the UTF-8 codecs into bytes.ts and make mount a droppable feature - #253

Merged
doodlewind merged 1 commit into
mainfrom
refactor/net-module-alignment
Aug 9, 2026
Merged

refactor(net): fold the UTF-8 codecs into bytes.ts and make mount a droppable feature#253
doodlewind merged 1 commit into
mainfrom
refactor/net-module-alignment

Conversation

@doodlewind

Copy link
Copy Markdown
Collaborator

The two follow-ups recorded in the #246 review, aligning the net module with the conventions the data modules (#231/#238) pinned:

Shared codecs

framework/src/bytes.ts is the one home for module-SDK byte codecs. It gains stringToUtf8 (lone surrogates become U+FFFD, so output is always well-formed UTF-8), and framework/src/net-api.ts + hosts/sim/net.ts drop their hand-rolled UTF-8 encoder/decoder/length copies for the shared spellings. PocketResponse.text() keeps its net:-prefixed error message.

mount as a droppable feature

pocket-net follows the pocket-fs pattern: feature mount (default) carries the pocket-mod adapter and NetSurface; default-features = false drops pocket-mod and compiles NetCore alone for firmware with its own QuickJS wiring. The unused direct rquickjs dependency is removed — the adapter reaches QuickJS through pocket_mod::qjs. docs/NET.md documents the split the way docs/FS.md does.

Verified

  • bun run test — 11/11 stages green
  • bunx tsc --noEmit — clean
  • cargo test -p pocket-net — 5/5 (mount round-trip included)
  • cargo check -p pocket-net --no-default-features — clean
  • cargo clippy -p pocket-net --all-targets -- -D warnings — clean, both feature sets
  • cargo check --workspace — clean

🤖 Generated with Claude Code

…roppable feature

Two alignment moves from the #246 review, matching the conventions the data
modules pinned:

- framework/src/bytes.ts is the one home for module-SDK byte codecs: it
  gains stringToUtf8 (lone surrogates become U+FFFD), and net-api.ts plus
  hosts/sim/net.ts drop their hand-rolled UTF-8 encoder/decoder/length
  copies for the shared spellings.
- pocket-net follows the pocket-fs feature split: `mount` (default) carries
  the pocket-mod adapter and NetSurface; `default-features = false` drops
  pocket-mod and compiles NetCore alone for firmware with its own QuickJS
  wiring. The unused direct rquickjs dependency is gone (the adapter uses
  pocket_mod::qjs).

Verified: gate 11/11, tsc clean, cargo test -p pocket-net 5/5, clippy -D
warnings clean with and without default features, cargo check --workspace
clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@doodlewind
doodlewind marked this pull request as ready for review August 9, 2026 13:13
@doodlewind
doodlewind merged commit 9c809bb into main Aug 9, 2026
@doodlewind
doodlewind deleted the refactor/net-module-alignment branch August 9, 2026 13:13
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.

1 participant