Skip to content

refactor: delete vestigial surface; demote CloseWrite to optional HalfCloser (candidate #7) - #2

Draft
sigma wants to merge 1 commit into
mainfrom
grill-candidate7-vestigial-surface
Draft

refactor: delete vestigial surface; demote CloseWrite to optional HalfCloser (candidate #7)#2
sigma wants to merge 1 commit into
mainfrom
grill-candidate7-vestigial-surface

Conversation

@sigma

@sigma sigma commented Jul 18, 2026

Copy link
Copy Markdown
Member

Candidate #7 from the architecture review — delete the vestigial surface.

Governing rule

Applies the deletion test bounded by the committed public surface: the keep-set is shepherd's pull-list ∪ symbols used inside mosey. Anything exported, unused in-repo, and absent from that list is a deletion candidate before v0.1. Verified against shepherd's actual source (not the doc's stated intent): shepherd imports api, attach, auth, cert, transport, transport/libp2p, vterm directly and references none of the deleted symbols; it imports neither streambuf nor screen.

Changes

Surface Action Basis
streambuf.InputQueue (+ test) delete exported, no in-repo caller; shepherd doesn't import streambuf
screen package delete no in-repo importer; not on shepherd's list
unix/ws Backend.Serve() no-ops delete in no interface, zero callers; the "implements transport.Transport" doc was stale
vterm.encodeResumeSeq delete defined, never called (server only decodes)
vterm.newOutputRing inline into its one caller its "tests can swap a smaller ring" doc was false (no parameter)
transport.Stream.CloseWrite() demote to optional transport.HalfCloser mandatory method documented "Optional"; 2/5 backends returned ErrUnsupported; no caller in mosey or shepherd
transport.ErrUnsupported delete orphaned once the two CloseWrite stubs went — its only use
OutputRing.Write doc fix advertised an io.Copy escape hatch via a WriteBytes method that never existed
docs/src/relationship-to-shepherd.md fix shepherd imports directly now (not vendored); added api; framed the list as the committed surface

CloseWrite demotion: Stream shrinks to io.ReadWriteCloser + RemoteID. A new transport.HalfCloser { CloseWrite() error } is implemented by unix, libp2p, and the http2 client stream; WebSocket and the http2 server stream simply don't implement it (no more ErrUnsupported stubs). Backend tests type-assert to HalfCloser.

Kept — the review's "vestigial" premise was wrong (these are used in-repo): cert.MasterPublicKey, wallet.Address / EncodeBase58 / DecodeBase58 / ParseAddress.

Verification

go build ./..., go vet (changed pkgs), and go test ./... all pass.

Docs (delivered separately)

This session ran via /grill-with-docs; the glossary term (committed surface) and a committed-surface ADR documenting this rule are delivered into the in-flight domain-modeling series (uncommitted WIP: CONTEXT.md, docs/adr/), not in this PR — they depend on that WIP base. The ADR number is assigned when that series is committed (0001–0003 are already taken by concurrent candidate #1/#2/#3 work). This PR is code-only and branches cleanly from main.

🤖 Generated with Claude Code

… CloseWrite to optional HalfCloser

Candidate #7 from the architecture review. Applies the deletion test,
bounded by the committed public surface (shepherd's pull-list union
in-repo use) and verified against shepherd's actual source.

- delete streambuf.InputQueue: no in-repo caller; shepherd does not
  import the streambuf package at all
- delete the screen package: no in-repo importer; not on shepherd's
  pull-list
- delete unix/ws Backend.Serve() no-ops: in no interface, zero callers;
  their 'implements transport.Transport' doc was stale (Serve is not a
  Transport method, and libp2p/http2 have no such method)
- delete vterm.encodeResumeSeq: defined, never called (server only decodes)
- inline vterm.newOutputRing into its single caller: its 'so tests can
  swap a smaller ring' doc was false (the wrapper took no parameter)
- demote transport.Stream.CloseWrite() to a separate optional
  transport.HalfCloser; drop the two ErrUnsupported stubs (websocket,
  http2 server); backend tests type-assert to HalfCloser
- fix streambuf.OutputRing.Write doc: it advertised an io.Copy escape
  hatch via a WriteBytes method that never existed
- fix docs/src/relationship-to-shepherd.md: shepherd imports mosey
  directly now (not vendored), add api to the pull-list

Kept (the review's 'vestigial' premise was wrong -- these are used
in-repo): cert.MasterPublicKey, wallet.Address / EncodeBase58 /
DecodeBase58 / ParseAddress.

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.

1 participant