Skip to content

carriers: meet bitwire's adopted close codes and closed classification (carrier contract, edition 1) #29

Description

@jm9e

Outcome

bitwire adopted the first part of its carrier contract in decision 0013 (bitwire a80981e, Bitspark/bitwire#69, bitwire#54). The adopted text is close codes and the closed classification. This issue brings bitruntime's carriers to it in Go and TypeScript, so that bitruntime can claim "bitwire/1 and carrier contract, edition 1".

The contract changes no protocol revision. Where bitwire/1 binds a code (4011 for a protocol violation, 1009 for an over-limit frame), nothing changes. The format rules for bitwire-stream/1 belong to #10.

What the adopted text requires

  • Valid close codes. The frozen set 1000–1003, 1007–1014 and 3000–4999. 1005, 1006 and 1015 are observe-only and never sent; 1004 and every other number are never sent either.

  • Close requests are validated before any state changes.

    • An invalid code, or a reason that is not UTF-8 or is over 123 bytes, is an argument error. Nothing is sent, the connection is unchanged, and the reason is not truncated.
    • A valid code the adapter cannot send is an unsupported-capability error. The adapter does not substitute a code, omit it, or abort instead.
    • A repeated valid close joins the ending under way. Abort is idempotent.
  • Capabilities are declared. An adapter states the valid codes it cannot send, and whether it has an abort. A claim that needs a missing capability is not made. This settles the question transports: the TypeScript pipe has no receive limit and FrameConnection no abort; a Go pipe's own over-limit end reads as an abort #26 left open: a TypeScript FrameConnection without abort() cannot claim the contract, and the write-failure rule below needs an abort.

  • One closed classification. Every endpoint, operator and helper reports a closed carrier as one local error kind carrying a termination record:

    • resource and cause;
    • the local close (code, reason, write status);
    • the first valid peer close;
    • the observed code;
    • whether the drain and the handshake completed.

    The record is local and is never serialized into a ProfileError. The public projection stays disconnected, and a received disconnected is not evidence of a local close. The v0.4.2 CloseError.Local field is a start.

  • Closed(code, reason) reports the first valid peer close, and otherwise 1006 on a network transport. The locally selected code stays available in the record.

  • Operational failures under bitwire/1.

    • A failed write path aborts and sends nothing more.
    • Other operational failures (overload, a stalled consumer, a full root queue) prefer an abort over 4011; 4011 stays for protocol violations.
  • The revision-1 tunnel keeps sending channel.close 1006 on abort, as bitwire/1 requires. A claim over the tunnel states this compatibility exception.

Evidence

The API-boundary scenarios for these rules are not written yet. bitwire tracks them on bitwire#54, and they will run against released bitruntime as the bitwire/1 runs do. Until then, record the behavior in bitruntime's own tests, and list any deviation you keep as a documented deviation. Decision 0013 fixes deviations before D1 to D3 are adopted.

Refs Bitspark/bitwire#54, #10, #26, #2.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions