Skip to content

design: define initial net.socket transport contract #104

Description

@vycdev2

Context

docs/progress.md lists net.socket as Not started. The repository has a
Network capability, Network.allow narrowing, opaque capability handles,
and an architecture note about async I/O, but it does not yet select a public
socket API or the transport/lifecycle semantics behind it. The initial
net.http client contract is tracked separately in #101 and explicitly leaves
low-level sockets out of scope.

Goal

Define one initial, portable net.socket contract before adding runtime or
stdlib code. The design should make the effect, ownership, failure, and
cancellation behavior visible to an agent reading a call site.

Questions to settle

  • Which first transport slice is supported (for example TCP, UDP, or TCP-only),
    and which later transports are explicitly deferred?
  • What are the canonical address/endpoint and socket-handle representations,
    including IPv4/IPv6, hostname resolution, port validation, and invalid-input
    errors?
  • What public operations are required for the first slice (connect, bind,
    listen, accept, read, write, shutdown, and close), and which return
    types/error variants do they use?
  • Are operations blocking, asynchronous, or capability-mediated futures/tasks?
    How do timeouts, cancellation, partial reads/writes, EOF, peer resets, and
    backpressure appear as values?
  • How does Network.allow constrain destination and listening addresses, and
    what permission checks apply to connect, bind, accept, and DNS resolution?
  • Which handles are owned versus viewed, when are they consumed/closed, and how
    can actors or concurrent tasks safely borrow or transfer them?
  • What portability guarantees are required across the host platforms, and what
    belongs in a private trusted runtime kernel versus public compiler-shipped
    .jett declarations?
  • How should the contract be tested without requiring ambient network access,
    and how does it compose with the HTTP client issue design: define initial net.http client contract #101?

Acceptance criteria

  • A design note records the selected first-slice transport, public signatures,
    endpoint/error model, capability and ownership rules, async/cancellation
    semantics, portability guarantees, and deferred scope.
  • The note identifies the private runtime boundary and a staged implementation
    path without prematurely adding a public API whose semantics are undecided.
  • The net.http relationship and the dependency on future runtime/backend work
    are explicit, with no duplicate socket or HTTP issue created by this work.

Out of scope

HTTP client behavior already tracked by #101, server frameworks, TLS/QUIC
policy unless required to define the first socket boundary, native codegen, and
an implementation PR before the contract is selected.

This was generated by an AI agent (vycdev2). Please verify any changes before merging or applying.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions