Skip to content

1.0.0-RC: hexagonal core/adapter/compose rewrite - #20

Open
pgodwin wants to merge 285 commits into
mainfrom
feature/refactor
Open

1.0.0-RC: hexagonal core/adapter/compose rewrite#20
pgodwin wants to merge 285 commits into
mainfrom
feature/refactor

Conversation

@pgodwin

@pgodwin pgodwin commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

This merges the feature/refactor branch: a ground-up rewrite of ClassicStack onto a
hexagonal (core / adapter / compose) architecture, plus everything built on top of
it since the rewrite landed. It replaces the old internal/app, port/, protocol/,
service/, router/, pkg/, netlog, capture/, config/ tree entirely.

253 commits, 2173 files changed (+393,924 / -64,367). Latest tag on main is v0.3.0;
this is proposed as 1.0.0-RC.

  • Architecture (.refactor/00-DESIGN.md, ARCHITECTURE.md): core/ holds
    protocol-pure logic with zero I/O imports (enforced by an import-graph CI gate —
    reflect, net, encoding/binary, encoding/json etc. are all forbidden in core/,
    which is what keeps a TinyGo/embedded build possible); adapter/ holds the concrete
    I/O (pcap, sqlite, http, uci, serial, dsi, smbtcp); compose/ wires components
    together via a registry + supervisor with dependency-ordered start/stop.
  • Migration was staged and merged incrementally (Phase 1 harness → Phase 2
    strangler migration, milestones A–D, M1–M11, cutover) — see .refactor/TODO.md for
    the full step-by-step log and design rationale for each seam. The cutover itself
    (deleting the legacy runtime, repointing binaries at the new run-core) landed
    2026-06-18 (21f8d1b, 511299a); everything since is feature work on the new
    architecture, not migration.
  • Since cutover, notable additions: a unified file client (csmount/csfs)
    mounting AFP/SMB/NCP/EtherDFS shares via WinFsp/macFUSE/libfuse; a Finder-style web
    admin UI (now a git submodule, third_party/classicstack-web); macOS/Windows tray
    app (cmd/classicstack-tray); TashTalk serial and LToUDP LocalTalk transports;
    direct-hosted SMB-over-IPX and NetBIOS browser/messenger services; a Windows
    installer (Inno Setup) built in CI; read-write ZIP filesystem backend.

Compatibility notes

  • Config: legacy top-level bridge identity keys are rejected; [Bridge] is now the
    only source for backend/device/MAC/frame mode (see ARCHITECTURE.md). Existing
    server.toml files from v0.3.0 will need migration — there is no automated
    upgrade path in this PR.
  • Submodule: cloning now requires git submodule update --init --recursive
    (third_party/classicstack-web). CI and README.md are already updated for this.
  • Binaries: cmd/classicstack now boots through cmd/internal/cli → the compose
    runtime instead of internal/app. Flags/behavior should be equivalent per
    .refactor/TODO.md M9/M10, but this is the highest-risk surface for regressions
    since it's the main entry point everyone runs.

Known gaps / follow-ups (not blocking, but worth tracking post-merge)

  • ARCHITECTURE.md still describes the pre-refactor runtime topology almost verbatim
    (only one line changed vs. main) — it doesn't yet describe the core/adapter/compose
    rings, the registry/supervisor model, or the new cmd/internal/cli entry point. Worth
    a follow-up doc pass.
  • Per .refactor/TODO.md, a handful of milestones are still open: M8a (share config →
    share.Manager wiring for AFP/SMB volumes), M8-spa (new-ring SPA, explicitly
    deferred/held), M11 opener-dispatch follow-ons. None of these block a build, but
    they're real scope not yet closed out.
  • scripts/ci/compute-release-metadata.sh's tag regex only accepts strict
    vMAJOR.MINOR.PATCH — a v1.0.0-rc1 tag will fail CI's release job. If you want an
    actual pre-release tag (not just merging to main, which auto-cuts a dev-<sha>
    prerelease), that script needs a pre-release-suffix case first.

CI

Refactor Harness CI is green on the current head (75db6b8, run
32545567182).
Note this PR will run under pr-ci.yml once opened against main, which hasn't
exercised this tree before — worth watching the first run closely.

Heads-up: merging this triggers a release

release-main.yml runs on every push to main and publishes a GitHub Release
(dev-<sha>, marked prerelease) automatically — merging this PR will cut a release
build across all platform/variant matrix targets. Flagging this explicitly since it's
not something a normal PR merge does in most repos.

pgodwin and others added 30 commits June 11, 2026 15:35
Replace the catalog-read subset packer with the full AFP 2.x file/directory
parameter block in core/service/afp/parms.go: fixed fields in ascending bit
order (attributes, parent dir id, create/modify/backup dates, 32-byte Finder
info, file-number/dir-id CNID, data/resource fork lengths, offspring count,
owner/group, access rights) followed by the variable-length name area, with the
long/short name fields carrying 2-byte offsets into it -- the layout the legacy
service/afp packer produced, now sourced entirely from the section-9 seam.

Volume gains FinderInfo (via the fork engine ReadFinderInfo), ShortName (via the
NameEngine), and ParentCNID helpers; FPGetFileDirParms, FPEnumerate, FPOpenFork,
and FPGetForkParms all pack through vol.fileDirParams. Catalog dates use the
spec 2000-GMT epoch consistently, fixing the legacy port's 1904-local-epoch
divergence -- recorded in spec/errata.md "AFP catalog date epoch".

parms_test.go drives the full file and directory bitmaps and checks each field
at its bit-order offset plus the offset-addressed names; the dispatch tests now
follow the name offsets rather than reading names inline.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Wire the server-initiated two-phase write (spec/10 "Two-Phase Write
Protocol") so a large FPWrite delivers its data over its own ATP
transaction rather than relying on data riding inline in the aspWrite
command block. This is the path the .XPP driver actually uses for
ASPUserWrite, and was the documented "not yet wired" gap in the spine.

Flow:
  phase 1  aspWrite (SPFunc 6)   WS -> server, FPWrite header only
  phase 2a aspDataWrite (7)      server -> WS, "send N bytes" (TReq)
  phase 2b data response         WS -> server, TResp packets (data)
  phase 3  final reply           server -> WS, reply to the aspWrite

The server is the *initiator* of phase 2a, so the spine now sends a TReq
of its own and correlates the workstation's TResp back to the pending
write. New core-ring pieces:

- write.go: pendingWriteTable keyed by the transaction id the server
  stamps into the aspDataWrite TReq (the WS echoes it in its TResp), and
  the pendingWrite in-flight state (original aspWrite TReq, FPWrite block,
  bytes wanted, accumulated data).
- asp.go: handleWrite (phase 1 — parse FPWrite reqCount, register the
  pending write, send the aspDataWrite via the originating port's
  Unicast); handleDataResponse (phase 2b->3 — accumulate TResp data by
  arrival, run the FPWrite on EOM/want-reached, reply to the original
  aspWrite). A zero-reqCount write completes inline with no round-trip.
- atp.go: parseATPResponse decodes the inbound TResp the spine previously
  dropped; afp.go Inbound routes TResp to handleDataResponse.
- forkio.go: writeDataCount reads reqCount from an FPWrite header;
  appendWriteData splices the collected data onto the 12-byte header so
  afpWrite (which reads data inline) is reached unchanged.

Storage is still touched only through the fork engine; the two-phase
machinery is pure ASP/ATP transport with no AppleDouble/EA knowledge.

write_test.go drives single-packet, multi-packet (data spanning two
TResps), and zero-length writes end-to-end over a recording port that
captures the server-initiated aspDataWrite TReq.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…dIcon

Add the AFP Desktop database commands to the core/service/afp dispatch
spine (Inside Macintosh: Networking, AFP 2.x §C): FPOpenDT/FPCloseDT,
FPGetComment/FPAddComment/FPRemoveComment, FPAddIcon/FPGetIcon/
FPGetIconInfo, and FPAddAPPL/FPRemoveAPPL/FPGetAPPL.

The slice keeps the §9 storage seam honest by splitting the database:

- Comments ride the fork seam (v.FS().ReadComment/WriteComment), so a
  comment lives in the same metadata container (AppleDouble sidecar,
  NTFS stream, Netatalk EA) as the file it annotates and survives a
  rename through the FS, exactly like Finder info. RemoveComment writes
  an empty comment; GetComment on a file with none returns kFPItemNotFound.
- Icons + APPL mappings have no per-file home in the seam, so they live
  in a per-volume in-memory desktopDB (built lazily on first FPOpenDT).
  Persistence is an adapter concern (like the mem metastore standing in
  for sqlite); core stays free of database/path knowledge.

FPAddIcon is command 192 -- the Mac delivers it over the two-phase
ASPWrite path (the bitmap is bulk write data). writeDataCount/
appendWriteData now recognise the 20-byte FPAddIcon header alongside
FPWrite's 12-byte one, so the same data path serves both; pendingWrite
gains the header length to splice the data back on.

FPOpenDT hands out a per-session DTRefNum->volume mapping (dtTable);
every later Desktop command carries it. The Desktop machinery is pure
protocol + volume state -- storage is touched only via the fork seam.

desktop_test.go covers OpenDT/CloseDT, the comment round-trip (+ the
missing-comment item-not-found path), the FPAddIcon two-phase path ->
GetIcon/GetIconInfo over a recording port, and the APPL round-trip.
spec/errata "Desktop database persistence" documents the comment/icon
split, the FPAddIcon-via-ASPUserWrite path, and the catalog-vs-comment
path-encoding convention.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Wire FPCatSearch (command 43), the last AFP-specific command the "Remaining
M7" notes called out, into the core/service/afp dispatch spine. It is the
protocol behind the Finder's "Find File".

The spine has no on-disk catalog index, so it walks the live catalog through
the §9 FileSystem seam (Volume.Enumerate, depth-first into every
subdirectory) and packs each match with the same fileDirParams packer the
catalog-read commands use -- so CatSearch carries no storage-layout knowledge.

It decodes the real wire request (reqMatches, the opaque 16-byte
CatalogPosition cursor, file/dir result bitmaps, reqBitmap, spec1/spec2) and
honours the criteria the field exercises: PartialName (case-insensitive
substring), FullName (case-insensitive exact), and ParentDirID. A zero
reqBitmap matches everything. Criteria bits not modelled (date/length ranges,
Finder-info mask) are ignored rather than rejected -- a lenient posture that
never false-negatives the dominant name search.

Paging: the cursor carries a flat depth-first visit index; a page returns up
to reqMatches records capped at ~4 KB (one ASP quantum). More results pending
-> NoErr + next index; last page -> kFPEOFErr + zero cursor (AFP/Netatalk
convention). A resumed search re-walks but skips already-returned entries, so
pages neither repeat nor drop.

Unlike the legacy service/afp port (which delegated to a backend
FileSystem.CatSearch with a flattened printable-substring query and a required
capability flag), the spine decodes spec1/spec2 itself and walks any backend,
so memfs/local_fs search with no bespoke index.

catsearch_test.go covers a partial-name search finding matches across the tree
(root + subdir), a full-name exact match rejecting substrings, and a paged
search that resumes via the cursor without repeats. spec/errata.md documents
the seam walk, the lenient criteria, the cursor/paging scheme, and the
divergence from the legacy port. afp.go package doc + start log updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The first CatSearch slice wrongly baked "walk the tree and substring-match
names" into the AFP spine. But CatSearch semantics belong to the FileSystem
backend -- and a backend may decline it. A synthetic backend redefines search
entirely: MacGarden turns a CatSearch into an explicit query against its
upstream archive and materialises the HTML results as virtual folders/files,
entries an Enumerate of the volume would never surface.

Move the capability into the seam:

core/fs:
- CatSearcher optional interface + CatSearchCriteria (name partial/full,
  parent path, free-text Query for synthetic backends, Max) / CatSearchResult
  (path + FileInfo) / CatSearchCursor (backend-opaque page token) DTOs +
  ErrCatSearchUnsupported.
- WalkCatSearch: the default depth-first predicate walk a plain hierarchical
  backend opts into in one line (local_fs, memfs do). Lives in core/fs so it
  is reusable and the file service stays storage-agnostic.
- shareFS forwards CatSearch to a base that implements CatSearcher;
  Capabilities().CatSearch gates support. memfs/local_fs advertise + delegate
  to WalkCatSearch.

core/service/afp:
- afpCatSearch now decodes the AFP wire criteria (spec1/spec2) into
  fs.CatSearchCriteria, resolves the parent dir id to a store path, and
  DELEGATES to vol.FS() via the CatSearcher capability -- returning
  kFPCallNotSupported when the backend declines. It packs whatever store paths
  the backend returns with the existing fileDirParams packer, and round-trips
  the backend's opaque cursor through the 16-byte CatalogPosition verbatim
  (the spine never interprets it). The fixed tree-walk is gone from AFP.

Tests: core/fs/catsearch_test.go covers WalkCatSearch (partial across tree,
paged without repeats, parent scope) and shareFS reporting
ErrCatSearchUnsupported for a non-searching base. The AFP catsearch_test.go
drives the same three scenarios end-to-end over the delegated memfs backend
and now round-trips the opaque cursor. spec/errata.md rewritten to document
that CatSearch is the implementor's to define (including not to support).

Note: archtest is currently red from a PRE-EXISTING encoding/binary import in
core/fs/fork_ads.go + fork_xattr.go (landed in 47da010 / 1a03dc4, masked by a
cached result); this commit neither adds nor fixes that -- it is a separate
cleanup. This commit's own files use no forbidden imports.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…archtest green

The core ring bans encoding/binary (it transitively imports reflect, which the
no-reflection rule forbids; §1 / archtest), so a dozen core packages each
hand-rolled their own be16/putLE32/appendBE16/... — the same shifts duplicated
everywhere, and three files had drifted back to encoding/binary outright,
turning archtest red (the failure was masked by a cached result).

Consolidate the byte-order primitives into one dependency-free, reflection-free
package, core/binaryprimitives, providing every width and order in the three
call styles the codebase actually uses:

  - readers:        BE16/BE32/BE64, LE16/LE32/LE64
  - in-place Put*:  PutBE16/.../PutLE64  (write into a pre-sized slice)
  - append Append*: AppendBE16/.../AppendLE64  (grow and return)

Migrate every hand-rolling package to it and delete the local helpers:
appledouble, fs (fork_ads/fork_xattr), metastore, link/bridge,
protocol/{ddp,atp,smb,netbios,netbeui}, service/{zip,rtmp,afp}, and
adapter/capture/pcapfile (adapters may use it too — it is safe for every ring).

This also clears the archtest violations at the root: the encoding/binary
imports in core/appledouble + core/fs/fork_{ads,xattr} are gone (they cascaded
to fs/share/afp/smb), and a stray fmt.Fprintf("%02X") in core/fs/codec.go —
fmt also pulls reflect transitively — is replaced with a hand-rolled hex
formatter. archtest is green again.

.refactor/00-DESIGN.md documents the package and the "don't re-hand-roll
endian helpers" rule under the no-reflection discipline, including the fmt
caveat.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Wire the SMB1 session-establishment dispatch into core/service/smb, the SMB
analogue of the AFP ASP-session + login + open-volume spine that landed first.
Filesystem commands (NtCreate/Read/Write/Close, Trans2 find/query) come in a
later slice; this lands the connection state machine a client walks before any
file I/O.

Transport-independent: Service.Dispatch(sess, req) decodes one SMB message via
the core/protocol/smb header codec and demuxes by command. The NetBIOS /
transport seam (which frames session messages) will call Dispatch; the spine
holds no transport knowledge, so it is unit-tested directly over raw SMB
frames. Commands handled:

  - NEGOTIATE        -> accept NT LM 0.12 (WCT=17), conservative caps/buffer
                        set tuned for Win9x (no CAP_RAW/MPX), user-level
                        security with no challenge.
  - SESSION_SETUP_ANDX -> grant a guest session (UID=1, Action=guest). This is
                        a compatibility server: no credential check (the honest
                        weakness, documented in the package doc).
  - TREE_CONNECT[_ANDX] -> bind a TID to a *Share (case-insensitive name match)
                        or the virtual IPC$ pipe tree; unknown share ->
                        STATUS_BAD_NETWORK_NAME.
  - TREE_DISCONNECT / LOGOFF_ANDX / ECHO.
  - any FS command   -> STATUS_NOT_SUPPORTED (definite reply, not a hang) until
                        the FS engine slice lands.

session.go holds the per-connection smbSession (UID, TID -> treeConnect{share|
ipc}, allocators) binding a *Share directly (the §9 seam) rather than a share
index, so a share removed from the Manager mid-session rides out on the held
pointer. negotiate.go carries the faithful wire formats (mirroring the legacy
service/smb/command_core.go byte layouts validated against Win9x/WfW) and the
DOS<->NTSTATUS mapping; integer codecs come from core/binaryprimitives.

smb.go gains SetWorkgroup (NEGOTIATE domain), a case-insensitive ShareByName,
and the updated package doc. dispatch_test.go drives NEGOTIATE,
SESSION_SETUP_ANDX (guest UID), TREE_CONNECT_ANDX (bind + unknown-share
refusal), TREE_DISCONNECT, the not-supported FS path, and a non-SMB drop.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
docs: M7 TODO — CatSearch (capability), core/binaryprimitives, SMB session spine

Record the slices landed since the desktop-database note: FPCatSearch as an
optional fs.CatSearcher capability (7515477 + reshape 1cb4c08 — AFP command set
now complete), the core/binaryprimitives endian consolidation that restored
archtest green (c5de757), and the SMB session-establishment spine (e593271).
Refresh the encoding/binary errata to point at core/binaryprimitives (with the
fmt-pulls-reflect caveat) instead of the now-migrated per-package helpers, and
revise "Remaining M7" to the SMB FS command engine + NetBIOS->SMB session-data
seam as the next steps.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@
Two M7 file-services slices over the §9 storage seam.

SMB FS command engine (core/service/smb): serve the file/path/find
commands over the bound *Share's FS, not just session establishment.
OPEN[_ANDX]/CREATE, READ[_ANDX]/WRITE[_ANDX], CLOSE/FLUSH, DELETE/RENAME,
CREATE/DELETE/CHECK_DIRECTORY, QUERY_INFORMATION[_DISK], and the TRANS2
FIND_FIRST2/FIND_NEXT2/FIND_CLOSE2 + QUERY_PATH/FILE_INFO subcommands.
Every path reaches storage only through sh.FS(); RENAME/DELETE ride the
metadata-carrying FS().Rename/Remove. Per-request UTF-16/ANSI charset
threads through the share codec. Per-conn FID + search tables; TID-
disconnect and conn-end close leaked handles. The legacy DOS-name-
mangling fuzzy resolver is dropped (deferred to a core/fs NameEngine);
documented in spec/errata.

NetBIOS→SMB session-data seam (core/service/netbios): the missing
inbound-frame delivery. NewNBFEngine builds the responder-side NBF
(NetBEUI) virtual-circuit state machine, registered on the
core/router/netbeui mini-router as its NameHandler + SessionHandler. It
answers a CALL, completes establishment, reassembles each SMB message,
routes it to the installed SessionConsumer (SMB, via conn.go's
NewConn/Conn — one smbSession per circuit), and sends the response back
fragmented over DATA frames. SESSION_END and Stop close the circuits.
The seam is two small interfaces (SessionConsumer/SessionCircuit); the
engine reaches the wire only through a FrameSender seam and the upper
layer only through SessionConsumer — no link or SMB knowledge either way
(§3-bis command-core / session-transport split). Core re-home of the
legacy service/netbios/over_netbeui session half.

cs-tinygo blank-imports core/service/{afp,smb,netbios} so the file
services stay embedded-compilable. archtest + full tagged suite green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the second NetBIOS session transport feeding the same upper-layer
SessionConsumer/SessionCircuit seam the NBF engine uses, so SMB rides
NWLink (NetBIOS-over-IPX) as well as NetBEUI.

core/service/netbios/nbipx.go — ipxSessionEngine, the IPX parallel of the
NBF engine: responder-side NB-IPX session state machine. Accepts SESSION_INIT
(→ SESSION_CONFIRM carrying our connection ID; circuit keyed by peer IPX
address + the remote's SourceConnID), reassembles DATA_FIRST_MIDDLE/
DATA_ONLY_LAST(EOM) segments off the 16-byte NBIPXSessionHeader, serves the
whole SMB message to the consumer, replies as one EOM DATA_ONLY_LAST, and on
SESSION_END closes the conn + SESSION_END_ACKs. Reaches the wire only through
the DatagramSender seam (the core/router/ipx mini-router's Send) and the upper
layer only through SessionConsumer — no router/port/SAP or SMB import. It is
the core re-home of the legacy service/netbios/over_ipx transport's session
half, stripped of netlog + the router/SAP coupling.

session.go gains NewIPXEngine + the exported IPXEngine handle (HandleDatagram/
closeCircuits, satisfying core/router/ipx.SocketHandler). netbios.go now tracks
engines as a circuitCloser set (both *Engine and *IPXEngine) so Stop tears down
circuits of either transport; package doc covers both.

NB-IPX name-query/NMPI/mailslot-datagram paths stay out of this engine — they
are name/datagram-layer concerns, not the session data path SMB rides.

nbipx_test.go drives INIT-establishment, non-PEP ignore, data→consumer→reply,
segment reassembly, and SESSION_END + Stop teardown over the REAL
core/router/ipx mini-router with a recording port; compile-asserts *IPXEngine
satisfies ipxrouter.SocketHandler. go list -deps ./core/router/ipx carries no
service/netbios, so the assertion is acyclic. cs-tinygo already blank-imports
core/service/netbios, so the new engine's embedded-compilability is covered.

gofmt + vet clean, archtest green (uncached), default + -tags all builds pass,
full go test ./... green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…X capture-replay

Finish the in-core M7 file-services command engines (the items finishable at
the command-engine altitude; §10d and legacy deletion stay gated on later
milestones — see TODO).

SMB NT_CREATE_ANDX (core/service/smb/ntcreate.go) — the NT/2000/XP
open-or-create path, the open a real Windows client uses. Over the bound
*Share's FS it honours CreateDisposition (SUPERSEDE/OPEN/CREATE/OPEN_IF/
OVERWRITE/OVERWRITE_IF, gated against existence) and the FILE_DIRECTORY_FILE /
FILE_NON_DIRECTORY_FILE CreateOptions (opens files AND directories; a directory
FID carries no open fork.File). DesiredAccess maps to a read-only/RW handle the
WRITE path enforces; the WCT=34 reply packs the four NT timestamps, ext-attrs,
alloc/EOF sizes and the Directory flag. Storage reached only via sh.FS().
ntcreate_test.go covers create/collision, open/missing, read-only-handle write
denial, directory create + dir/file mismatch statuses, bad-TID. The dispatch
not-supported probe now uses LOCKING_ANDX (genuinely unimplemented).

NetBIOS datagram + node-status paths (core/service/netbios/nbf_datagram.go) —
the NBF engine's HandleFrame now answers the two connectionless responder paths
alongside the session machine: STATUS_QUERY → STATUS_RESPONSE (node-status name
table built from the engine's own name set, truncated to the requester's
advertised buffer with the more/too-big flags) and DATAGRAM/DATAGRAM_BROADCAST
decoded to names+payload and routed to a new optional DatagramConsumer seam
(SetDatagramConsumer, the datagram analogue of SessionConsumer — a browser/
mailslot service plugs in there without touching the transport; until one does,
datagrams drop after decode). nbf_test.go covers status answer/foreign-ignore/
truncation and datagram deliver/drop.

Capture-replay (core/protocol/netbios/nbipx_capture_test.go) — three real
frames from captures/ipx.pcap decode→re-encode byte-identical: NB-IPX
name-service FIND.NAME, NMPI NAME_CLAIM (0xF1), NMPI MAILSLOT_SEND (0xFC,
carrying the \MAILSLOT\BROWSE browser announcement + embedded SMB). Exercises
the codec the M7 NBIPX session transport rides on.

Deferred and recorded in TODO: §10d same-FS AFP+SMB coordination (needs the
shared bus/FS that M8a builds — today AFP/SMB build separate FS stacks with a
nil bus); the AFP captures are link-layer (LLAP/DDP/AARP) so AFP parity stays
golden-vector tests; locking/MPX/raw stay STATUS_NOT_SUPPORTED; legacy
service/{afp,smb,netbios} deletion is blocked on the M8/M8a→M10 cutover.

gofmt + vet clean, archtest green (uncached), default + -tags all builds pass,
full go test ./... green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…bject

Correct the §10d wording: each service keeps its OWN shareFS instance (AFP
needs the AppleDouble fork engine, SMB the bare data fork, each its own codec)
even when an AFP volume and SMB share export the same host directory. What they
share is the event bus — §10d is publish-on-mutation + Origin-filtered subscribe,
one Publish per mutation, many reactors. M8a recognises two specs naming the same
host path and hands both share.Build calls one common bus.Bus. The earlier
"shared bus/FS" phrasing conflated the two.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…all transports

Break the browser out of SMB in the design. The browser (host/domain announce,
master-browser elections, GetBackupList, RAP NetServerEnum2 browse list) is a
NetBIOS *datagram*-layer service, not part of the SMB *session* protocol — the
legacy code wrongly buries it in service/smb. It is the datagram analogue of the
§3-bis command-core/session-transport split: one browser command core fed by the
DatagramConsumer seam of all three NetBIOS transports (NetBEUI/IPX/NBT), zero
per-transport browser code.

00-DESIGN.md: new §3-ter (the browser service + its DatagramConsumer plug-in, the
read-only BrowseList() seam SMB's IPC$ \PIPE\LANMAN handler consumes, optional via
the §8 registry); package layout adds core/service/browser and adapter/netbios-tcp.

02-PHASE-migration.md: M7's TCP-transport bullet split — smbtcp = direct-TCP :445
only; new adapter/netbios-tcp = NBT (RFC1001/1002, name/datagram/session) feeding
the SAME NetBIOS Session+Datagram seams as NBF/NBIPX (most vintage TCP clients use
:139, not :445). New M7d step migrates the browser out of service/smb.

TODO.md: M7b re-scoped to direct-TCP :445; new M7b2 (NBT adapter) and M7d (browser
service) rows.

No code changed — design/plan only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…config value

The NetBIOS computer name is consumed by three services (NetBIOS claims it, SMB
advertises it, the browser announces it), so it must have ONE source of truth.
Today NetBIOS takes serverName via constructor while SMB carries an independent
workgroup and has no server-name field at all — nothing connects them, so config
could let them drift.

Fix is single ownership, not divergence detection: new §4-bis makes server
identity a top-level config.Identity{Hostname, Workgroup} section (alongside
Logging/Router/Bridge), NOT a field on any component section. The registry reads
it once and hands the same Hostname to NetBIOS + SMB (new SetServerName,
advertised in NEGOTIATE — today SMB only has SetWorkgroup) + browser. With no
per-service hostname field, "SMB and NetBIOS names differ" is unrepresentable —
stronger than a cross-section equality check. The model Validate backstops any
externally-surfaced second name (e.g. a hand-edited UCI key) with a clear error —
the requested "error if they vary" guard, as defence-in-depth not the primary
mechanism. Hostname change is restart-grade for NetBIOS (re-claim per transport).

Lands in M8a with the config sections (none exist before then); the disconnect is
known and deliberately not patched piecemeal ahead of the config layer.

00-DESIGN.md §4-bis; 02-PHASE-migration.md M8a identity-wiring bullet; TODO M8a row.
No code changed — design/plan only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…d (SMB runs without NetBIOS)

Correct the §4-bis framing: SMB runs without NetBIOS (direct-TCP :445 has no
NetBIOS layer; a deployment can be AFP-only or SMB-:445-only with NetBIOS off),
so the hostname is a SERVER-level property consumed by NetBIOS/SMB/browser, owned
by none — not a "NetBIOS computer name" SMB borrows.

Consequences captured: the registry hands Hostname to whichever consumers are
enabled (SMB always; NetBIOS only if enabled; browser if linked); a NetBIOS-less
server still drives SMB's advertised name from the same field. Validation is
layered — a baseline hostname check always applies, but the NetBIOS ≤15-byte /
upper-case rule is a CONSUMER constraint enforced only when NetBIOS is enabled
(a 20-char name is legal for an SMB-:445 / AFP-only server, rejected once NetBIOS
turns on, with NetBIOS named as the constraint source). Hostname change is
restart-grade for NetBIOS AND for direct-TCP SMB's advertised name.

00-DESIGN.md §4-bis; 02-PHASE-migration.md M8a bullet; TODO M8a row. Design only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… AND direct/NetBIOS-less)

SMB runs over IPX two ways, and more broadly its session transports split into
two families that SMB itself does not distinguish (all drive the one
transport-agnostic SessionConsumer seam in conn.go):

  NetBIOS-based: NBF (NetBEUI), NBIPX (IPX socket 0x0455), NBT (TCP 139).
  Direct (NetBIOS-less): SMB direct-hosted over IPX (socket 0x0550, MS "NWLink
    direct host"); direct-TCP (:445).

The direct-IPX path (legacy service/smb/over_ipx_direct, socket 0x0550) is a CORE
transport — no net, no NetBIOS layer — driving the same NewConn/ServeMessage/Close
seam as NBF/NBIPX. So SMB-over-IPX exists both with NetBIOS (NBIPX 0x0455) and
without (direct 0x0550). This is also why server identity is not NetBIOS-owned
(§4-bis): SMB has live transports that never touch NetBIOS.

00-DESIGN.md §3-bis: SMB transports listed as two families; cross-link to §4-bis.
conn.go: seam doc + SessionConsumer comment corrected from "a NetBIOS transport"
to "any session transport (NetBIOS-based or direct)" — comment-only, builds+tests
green. 02-PHASE-migration.md: M7 in-core transport list adds direct-IPX 0x0550.
TODO: new M7e row (re-home over_ipx_direct as a core transport).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…sionConsumer seam

Add the Microsoft "NWLink direct host" transport: SMB framed straight onto IPX
socket 0x0550 (type-4 PEP) with NO NetBIOS layer — the NetBIOS-less sibling of
NBIPX (which rides the NetBIOS session engine on 0x0455). So SMB-over-IPX now
exists BOTH ways: with NetBIOS (NBIPX 0x0455) and without (direct 0x0550).

core/service/smb/directipx.go — *Service.NewDirectIPX(sender) builds the
transport. It is connectionless (each IPX datagram carries one whole SMB message,
no reassembly) and drives the SAME transport-agnostic SMB SessionConsumer seam
(conn.go NewConn/ServeMessage/Close) that NBF/NBIPX use. It keeps one Conn
(smbSession) per remote IPX endpoint plus a server-assigned CID
([MS-CIFS] §2.2.1.6.4) allocated on NEGOTIATE, stamped into the SMB header
SecurityFeatures field of every response with the request's SequenceNumber
mirrored; SMB_COM_ECHO multi-response (N datagrams, incrementing seq) honoured.

It reaches the IPX wire only through a local DirectIPXSender seam (the
core/router/ipx mini-router's Send satisfies it structurally), so SMB never
imports the mini-router — the same acyclicity discipline as the NetBIOS engines
(go list -deps ./core/router/ipx carries no service/smb). The SMB Service now
tracks transports it owns directly as a circuitCloser set, torn down on Stop.

Re-home of legacy service/smb/over_ipx_direct, stripped of the netbios
SessionContext coupling and encoding/binary (uses core/binaryprimitives).

directipx_test.go drives NEGOTIATE→CID-allocation, circuit-shared-across-messages,
ECHO multi-response, response-ingress-drop, non-SMB-drop, and Stop-closes-circuits
over the REAL IPX mini-router with a recording port (compile-asserting *DirectIPX
satisfies ipxrouter.SocketHandler). Compose registration is M8a (mirrors NBF/NBIPX).

gofmt + vet clean, archtest green (uncached), default + -tags all builds pass,
full go test ./... green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the project rule that protocol structs self-serialise/deserialise
(request.Unmarshal(data) over decoding in the function body), rather than
manipulating bytes inline in protocol call sites.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… transports

Break the NetBIOS browser out of the legacy SMB service into a standalone
datagram-layer service (§3-ter), the datagram analogue of the SMB session
command core. One browser, fed by the NetBIOS DatagramConsumer seam, common to
NetBEUI/IPX/NBT — SMB carries no browser logic.

core/protocol/browser — the [MS-BRWS] wire codec as self-serialising DTOs
(CLAUDE.md rule #10): MailslotTransaction (the SMB_COM_TRANSACTION
\MAILSLOT\BROWSE envelope), Announcement (host/local-master), DomainAnnouncement,
Election (+ Compare: criteria→uptime→lower-name ordering), GetBackupList
request/response, AnnouncementRequest, and UnwrapPayload (tolerates the Win9x
2-byte preamble). Reflection-free, core/binaryprimitives-based, round-trip tested.

core/service/browser — the command core: a component.Component that IS the
NetBIOS DatagramConsumer. HandleDatagram unwraps the mailslot, drops self-sourced
loop-backs (the announce/election storm guard), records observed servers (browse
list) + machine-group masters, answers AnnouncementRequest, runs the master-
browser election (lose→potential+silent; win→transmit loop→after 3 uncontested
retransmits become local master + emit a local-master announcement), and answers
GetBackupList only while local master (token echoed, sourced from our <1D> name).
Exposes the read-only BrowseList()/BackupList() query API SMB's IPC$ \PIPE\LANMAN
NetServerEnum2 will consume. Election timers are injectable so the machine is
race-tested without real-time sleeps.

Outbound seam added to core/service/netbios: Service.SendDatagram fans a Datagram
to every transport's datagramEgress; the NBF engine emits a CmdDatagram[Broadcast]
UI frame — the outbound mirror of DatagramConsumer. The browser imports
core/service/netbios only for the two seam types; go list -deps
./core/service/netbios carries no service/browser (acyclic). cs-tinygo
blank-imports both new packages.

NBIPX datagram-egress (NMPI mailslot send) and the SMB-side IPC$ NetServerEnum2
consumer (re-home of legacy command_rap_lanman.go calling BrowseList()) are
follow-ons.

gofmt + vet clean, archtest green (uncached; new core pkgs are reflection/net/
binary-clean), default + -tags all builds pass, full go test ./... green
(browser race-tested).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…\PIPE\LANMAN

Wire the SMB side of the browser query: the RAP NetServerEnum2 ("get server
list") clients send over the IPC$ \PIPE\LANMAN pipe inside an SMB_COM_TRANSACTION.
This is the one place the SMB session layer meets the datagram-layer browser
service (§3-ter) — SMB asks the browser for the list and packs the RAP reply; SMB
holds no browser/election logic.

core/service/smb/lanman.go — the SMB_COM_TRANSACTION dispatch case. A TRANSACTION
on the IPC$ pipe whose byte area names \PIPE\LANMAN + RAP function NetServerEnum2
(0x0068) is answered from the browse list via a BrowseProvider seam
(Available() + ServerEntries() []BrowseServer, SetBrowseProvider). BrowseServer is
a small local type the browser satisfies structurally (browser.Available()/
ServerEntries()), so SMB imports no browser package — the
[]browser.ServerEntry→[]smb.BrowseServer adapter is M8a compose wiring, alongside
SetDatagramConsumer/SetSessionConsumer. A potential browser → ERROR_REQ_NOT_ACCEP;
DOMAIN_ENUM mixed with other bits → ERROR_INVALID_FUNCTION; the reply packs
SERVER_INFO_1 records + comment heap. A TRANSACTION on a non-IPC$ tree, or with no
browser wired, answers STATUS_NOT_SUPPORTED / empty-success rather than dropping.

core/service/browser — gains the typed ServerEntries() []ServerEntry +
Available() accessors the SMB consumer needs (BrowseList() kept as a name-only
convenience over them).

lanman_test.go covers the browse-list reply, the potential-browser + domain-enum
gates, no-provider empty success, and the non-IPC$ refusal.

gofmt + vet clean, archtest green (uncached), default + -tags all builds pass,
full go test ./... green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…PE\LANMAN

Add the share-list RAP call (function 0x0000) over the same IPC$ \PIPE\LANMAN
pipe as NetServerEnum2. Unlike the browse list, NetShareEnum is answered straight
from SMB's own state — every bound disk share plus the virtual IPC$ pipe — with
no browser involved.

core/service/smb/lanman.go — the TRANSACTION dispatch now switches on the RAP
function: NetServerEnum2 → browse list (browser), NetShareEnum → share list.
handleNetShareEnum packs a SHARE_INFO_1 record (Name(13)+Pad(1)+Type(2)+
RemarkOff(4)=20) per share: each disk share as STYPE_DISKTREE with its
Description() as the remark, then IPC$ as STYPE_IPC, with a trailing remark heap.

core/service/smb/share.go — Share gains a Description() accessor over the held
*share.Share, for the NetShareEnum remark.

lanman_test.go — proves both records (PUBLIC + IPC$) with their names/types in the
data block.

So the IPC$ RAP layer now answers both queries a client makes: the inter-server
browse list (NetServerEnum2) and the per-server share list (NetShareEnum).

gofmt + vet clean, archtest green (uncached), default + -tags all builds pass,
full go test ./... green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The browser now broadcasts over IPX, not just NetBEUI. *IPXEngine gains
emitDatagram and registers as a datagramEgress, so Service.SendDatagram fans the
browser's HostAnnounce / election / backup-list traffic to NBF AND NBIPX at once.

The NBIPX egress wraps the browser's SMB mailslot payload in an NMPI MailslotSend
(opcode 0xFC), IPX type-20 broadcast on the NB-IPX datagram socket (0x0553), with
the source/destination NetBIOS names in the NMPI header (a group destination maps
to the workgroup name-type). Like the NBF egress it fans to the IPX broadcast node
— the engine has no name→node binding for an out-of-band send. Re-home of the
legacy service/netbios/over_ipx sendNMPIDatagram, stripped of the router import
(the broadcast node + datagram socket are local consts).

nbipx_test.go proves SendDatagram emits the NMPI MailslotSend with the names +
payload round-tripped on the IPX wire.

The browser is now transport-complete: it observes/announces/elects and serves its
list over both NetBEUI and IPX.

gofmt + vet clean, archtest green (uncached), default + -tags all builds pass,
full go test ./... green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…only browser frames

Review correction: the browser should sit entirely on top of NetBIOS via a shared
mailslot layer, with NO per-protocol and NO mailslot-envelope code. The
per-NetBIOS-transport framing (NBF UI-frame / NBIPX NMPI-MailslotSend / NBT
UDP-138) already lives correctly in core/service/netbios — that part stands. What
was mis-layered: the M7d browser marshals/unmarshals the \MAILSLOT\*
SMB_COM_TRANSACTION envelope itself, coupling it to a shared mailslot framing.

Mailslots are a general second-class NetBIOS datagram-delivery mechanism with
several consumers — \MAILSLOT\BROWSE (browser), \MAILSLOT\LANMAN (RAP datagram
form), \MAILSLOT\MESSNGR (messenger / net send, a flagged future want), room for
more (DirectPlay emulation). So the envelope is its own seam.

New §3-quater: core/protocol/mailslot (the envelope codec, lifted out of
protocol/browser) + a mailslot dispatch layer (Consumer registered by mailslot
name + SendMailslot) that plugs into the NetBIOS DatagramConsumer/SendDatagram
seams. Consumers (browser, future messenger) see/send only their own inner frame.
Layering top-to-bottom: consumer frame → mailslot envelope → netbios.Datagram →
per-transport wire framing. The IPC$ \PIPE\LANMAN RAP calls (session path) stay
where they are (§3-ter) — distinct from the datagram-path mailslot announcements.

§3-ter amended (browser holds neither transport nor mailslot-envelope code);
package layout adds protocol/mailslot + service/mailslot + service/messenger
(future). TODO: M7f (the reshape) + M7g (messenger) rows; M7d note records the
correction. Code reshape is M7f (design-first, per request). No code changed here.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ilslot layer

Reshape (review correction): the browser must hold NO mailslot-envelope code and
NO transport code. The \MAILSLOT\* SMB_COM_TRANSACTION envelope is a SHARED
mailslot framing (browser, LANMAN, future \MAILSLOT\MESSNGR net-send, …), not
browser-protocol — so it becomes its own seam (§3-quater).

core/protocol/mailslot — the envelope codec (self-serialising Write DTO +
NameBrowse/NameLANMAN/NameMessenger consts), lifted verbatim out of
core/protocol/browser. The lift surfaced and fixed a latent bug: the data offset
was a fixed 86, which overran for any mailslot name longer than \MAILSLOT\BROWSE
(e.g. \MAILSLOT\MESSNGR); it now tracks the name length.

core/service/mailslot — the dispatch layer: a Router that IS the NetBIOS
DatagramConsumer (unwraps the envelope, routes the bare body by mailslot name,
case-insensitive, to the registered Consumer) and exposes
SendMailslot(name, src, dest, body, broadcast) (wraps + SendDatagram).

core/service/browser — reworked: now a mailslot.Consumer (HandleMailslot,
registered for \MAILSLOT\BROWSE) sending through a MailslotSink. It holds zero
mailslot-envelope and zero transport code; MailslotTransaction is deleted from
protocol/browser. The per-NetBIOS-transport wire framing (NBF UI-frame / NBIPX
NMPI-MailslotSend) stays in core/service/netbios — that part of M7d/M7d-d stands.

Layering top-to-bottom: browser frame → mailslot envelope → netbios.Datagram →
per-transport wire framing. Each layer owns one concern; nothing reaches around
another. A future \MAILSLOT\MESSNGR messenger (M7g) plugs into the same Router as a
second consumer with no browser/SMB coupling.

go list -deps ./core/service/netbios carries neither service/mailslot nor
service/browser (acyclic). All four packages race-tested green; cs-tinygo
blank-imports both new packages. gofmt + vet clean, archtest green (uncached),
default + -tags all builds pass, full go test ./... green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Second mailslot consumer (§3-quater), proving the seam is multi-consumer:
the browser and the messenger both register on the mailslot router and hold
zero envelope/transport code.

- core/protocol/messenger: the [MS-MSRP] single-block "net send"/WinPopup
  frame codec (Message{From,To,Text}, type 0x01 + three NUL-terminated OEM
  strings). No live capture exists, so per CLAUDE.md rule 6 the layout is
  documented from [MS-MSRP] + the stable WinPopup form; parser tolerates a
  missing trailing NUL.
- core/service/messenger: registers for \MAILSLOT\MESSNGR; on receive it
  decodes, logs at Info, and publishes bus.MessageReceived on the new
  bus.TopicMessage so the web UI can show net-send events. Send half
  (Service.SendMessage) is the core a future cmd/csnetsend (T1) wraps.
- core/bus: TopicMessage + MessageReceived event.
- core/protocol/netbios: NameTypeMessenger (<03>).

cs-tinygo blank-imports both new packages; archtest green; go list -deps
./core/service/netbios carries neither messenger package (acyclic). gofmt/
vet clean, default + -tags all builds pass, full suite green (race-clean).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the authentication/user-store seam the design lacked. Both file
services previously hardcoded guest; now identity is established at
login and filters which shares are enumerable and bindable.

core/auth: reflection-free contract (Authenticator, UserStore) plus a
hand-rolled PBKDF2-HMAC-SHA256 credential codec (salt taken as a param;
no crypto/rand or encoding/hex in core, both pull reflect). AuthSection
carries backend+path only — never secrets.

adapter/auth/local: smbpasswd-style file store (name:salt:hash:flags),
atomic writes at 0600, case-insensitive. Lives in the adapter ring
because salt generation needs crypto/rand. No build tag — always built.

core/share: Permissions gains AllowedUsers (empty = guest/world);
plumbed through fs.ShareSpec and share.Manager.Info.

AFP: FPLogin parses the cleartext user/pass it previously dropped,
validates via SetAuthenticator (nil/empty = guest), filters
FPGetSrvrParms and gates FPOpenVol. SMB: SESSION_SETUP_ANDX parses the
account name, validates cleartext (hashed accepted-as-guest), filters
NetShareEnum/NetServerEnum2 and gates TREE_CONNECT. Restricted shares
report as non-existent, not access-denied, to avoid a presence oracle.

control.Plane gains Users/SetUser/SetUserDisabled/RemoveUser backed by
an optional control.UserAdmin (nil store -> ErrUnavailable), satisfied
by the supervisor — the surface the web UI Users panel will bind to.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ue fix

The TOML/UCI codecs and file/UCI stores were already built (B6/D4/D6);
this slice adds the missing real-section round-trip coverage and fixes
a latent codec bug it surfaced.

The M8a Auth section now round-trips through both codecs, plus an
end-to-end codec -> file.Store -> codec persistence test (the path the
control plane's config-apply drives), proving the store selector a user
writes is what auth.SectionFromModel reads back.

Fix: the UCI tokenizer dropped an empty quoted value (option key ''),
so an option whose string field is unset parsed to too few tokens and
failed the whole Unmarshal. A default config.Model — whose well-known
Logging.Level is "" — could therefore not be reloaded through UCI; only
models that set every string field round-tripped. The tokenizer now
emits an empty token when a quote was opened. TOML was unaffected.

Documented in spec/errata.md "UCI empty-quoted-value tokenizer".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
pgodwin and others added 14 commits August 23, 2026 09:35
…uild

Diagnosed with tinygo installed locally. Each layer was a separate, real bug —
fixed the ones that were genuinely fixable, and traced the remaining WT32-ETH01
blocker to its actual root cause rather than patching around it.

Fixed:
- hardware/esp32/wt32eth01/{emac,wifi}.go declared `package wt32eth01` while
  main.go/cts.go in the same directory are `package main` and call OpenEMAC/
  NewWiFi unqualified — a plain package-name typo that made the directory
  uncompilable as one package.
- scripts/build_wt32eth01.sh used `-target=esp32`, which TinyGo treats as
  inheritable-only (a base other board targets extend, not directly buildable),
  and never passed `-tags wt32eth01`, which every file in that package requires
  (`//go:build esp32 && wt32eth01`) — switched to `-target=esp32-generic
  -tags wt32eth01`.
- hardware/peripherals/sdcard imported tinygo.org/x/drivers/fatfs, which does
  not exist in any released version of that module; the only real TinyGo FAT
  filesystem found (tinygo.org/x/tinyfs/fatfs) is a cgo binding, and cgo is not
  usable on TinyGo's baremetal ESP32/RP2040 targets. Disabled the import in
  both hardware/esp32/wt32eth01/main.go and hardware/pico/main.go with a note
  on why, rather than leave it silently broken.
- hardware/peripherals/w5500 (Pico's wired-Ethernet option) was missing its
  go.mod entry for tinygo.org/x/drivers — added.
- core/fs's diskUsage and core/hostinfo's PrimaryInterface/InterfaceForDevice/
  HardwareAddrForDevice used real syscall.Statfs / net.Interface.Addrs() /
  net.InterfaceByName, none of which TinyGo's baremetal syscall/net implement.
  core/fs already had the right fallback pattern (diskusage_other.go, "0/0
  unknown") for this exact class of gap — TinyGo just wasn't routed into it
  because these targets report GOOS=linux, matching the real-Unix build tag.
  Added `&& !tinygo` / `|| tinygo` to route it correctly, and split
  core/hostinfo/primary.go the same way (new primary_interfaces.go +
  primary_interfaces_tinygo.go) rather than leave the whole package
  uncompilable for embedded targets.

Not fixed — real root cause identified, out of scope for a targeted fix:
hardware/esp32/wt32eth01/{emac,wifi}.go bind directly against ESP-IDF's C API
(`#include <esp_eth.h>`, `<esp_wifi.h>`, `#cgo LDFLAGS: -lesp_eth`), which needs
the full ESP-IDF SDK toolchain present at build time — CI only installs Go +
TinyGo, no ESP-IDF, so this was never going to link there. More broadly, both
hardware/esp32/wt32eth01 and hardware/pico import the FULL desktop compose/
registry + compose/runtime + adapter/control/http stack (pcap-adjacent
golang.org/x/net internals, TOML file config, a web UI) — architecturally much
wider than cmd/cs-tinygo, this project's own deliberately-narrow "TinyGo-safe
core subset" that the passing "TinyGo amd64 gates" CI job actually builds.
Getting a real board target green needs curating a minimal embedded import
surface (closer to cmd/cs-tinygo's), which is a scope/architecture decision,
not a bug fix.

Verified: full `go build`/`go vet`/`gofmt`/`go test` (all tags) unaffected;
scripts/ci/tinygo-gate.sh (the actual passing CI check) still green.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ient shape

The previous version described the pre-refactor runtime topology almost
verbatim (a known gap flagged in PR #20's description) — barely touched since
before the hexagonal rewrite despite the whole runtime changing underneath it.

Rewritten to cover:
- The five rings (core/adapter/compose/client/cmd) and the dependency rule
  that holds them apart, with a mermaid diagram.
- Rationale: why core/ is import-restricted (archtest's actual forbidden
  list), what that buys in practice (testability, one-command-core/N-transports,
  real embedded targets, config/protocol separation), and why compose/ and
  client/ are their own rings rather than living under cmd/ and adapter/.
- A full directory map (core/, adapter/, compose/, client/, cmd/) with a
  one-line role for every subpackage.
- Runtime composition (config -> registry -> cross-wire -> supervisor) and a
  concrete data-flow walkthrough (an AFP read over EtherTalk vs. over DSI),
  both as mermaid diagrams.
- A new client-architecture section: the client/afp.Session interface as the
  client-side mirror of the server's CommandHandler/CommandCircuit split, the
  redial-as-injected-closure reconnect design, and why the fork backend
  differs by scheme — none of this was in the doc before.
- Control-plane/web-UI split (brief; full depth stays in docs/web-ui.md).
- Embedded targets: cmd/cs-tinygo (the real, passing, narrow core subset) vs.
  hardware/{esp32,pico} (the full desktop stack, not yet green) and the
  established !tinygo/tinygo split pattern for OS-API gaps.
- Testing structure overview.
- A "how to expand" section with concrete recipes (new port, new DDP service,
  new session transport, new fs backend, new client scheme, new control
  front-end, new config section), each pointing at a real existing example.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…s embedded fix)

diskusage_other.go's tag gained an `|| tinygo` clause so TinyGo baremetal targets
route to the 0/0 stub regardless of reported GOOS. diskusage_windows.go still had
a bare `windows` tag with no `!tinygo` exclusion, so a GOOS=windows TinyGo build
(scripts/ci/tinygo-gate.sh's windows-amd64 gate) now matched BOTH files and failed
with "diskUsage redeclared in this block" — caught by the actual CI gate right
after the previous commit landed. Same `&& !tinygo` treatment as diskusage_unix.go
already got; verified via `GOOS=windows GOARCH=amd64 tinygo build` locally.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… Script type mismatch

- .github/workflows/{pr-ci,release-main}.yml pinned tinygo-version "0.41.0", which
  cannot assemble a goroot from the Go 1.26 stdlib the runner resolves to ("package
  internal/strconv is not in std") — refactor-harness.yml's TinyGo amd64 gates job
  already carries this exact fix+errata comment; the other two workflows were never
  updated to match. Confirmed via this PR's own "Build Embedded (TinyGo)" job.

- packaging/windows/ClassicStack.iss: ResolveVolumesPlaceholder failed to compile
  ("Type mismatch") because LoadStringFromFile's second parameter is `var S:
  AnsiString`, a by-reference parameter that requires an exact type match, while
  Contents was declared as the default Unicode `string`. Load into a dedicated
  AnsiString and convert, per Inno Setup's Pascal Script rules for
  LoadStringFromFile/SaveStringToFile.

The .iss fix is reasoned from the Pascal Script signatures, not locally compiled —
no Windows/ISCC toolchain available here. Will confirm against the next CI run
rather than claim it's verified.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…-lint)

pr-ci.yml's Quality job had never actually completed a run against this tree
before this PR (always blocked earlier by the race-enabled tests step failing
first), so this lint debt had never surfaced. Ran `golangci-lint run --fix`
(errorlint, govet, misspell all fully auto-fixable) then fixed the fallout:
the errorlint autofix rewrites `err == sentinel` / `err.(type)` to
`errors.Is`/`errors.As` but does not always add the `errors` import, which
broke the build across ~40 files. Iterated `go build`/`vet`/`test -run=^$`
until clean, then goimports to settle import grouping.

Every rewritten comparison is a genuine correctness fix, not just style: a
plain `==`/type-assertion against a sentinel error silently stops matching the
moment that error is wrapped anywhere in its call chain, so these were latent
bugs waiting for the next `fmt.Errorf("...: %w", err)` to be added upstream of
one of them.

Verified: `go build`/`go vet` clean (bare and -tags all), full `go test -tags
all ./...` passes, core/internal/archtest still green (errors is stdlib, nowhere
near the forbidden-import list).

Remaining lint categories (errcheck, gocritic, ineffassign, revive, staticcheck,
unused — 136 findings) are not auto-fixable and are being worked through
separately.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
staticcheck (real fixes):
- adapter/dsi/dsi_test.go: don't pass a nil context to Stop; use context.Background().
- adapter/link/tashtalk/tashtalk.go: the empty writeMu Lock/Unlock is an intentional
  "wait for the mutex to be free" barrier, not a bug — annotated and suppressed
  (SA2001 has no way to know the point is the pairing itself).
- client/afp/afp.go: removed a genuinely no-op nested `if dead != nil {}` branch left
  over from a prior refactor, folding its comment into the surrounding logic instead.
- client/xfer/xfer_test.go: the empty error-ignoring branch in readAll was silently
  swallowing any non-EOF ReadAt error, not just EOF as the comment claimed — now
  actually asserts errors.Is(err, io.EOF) and fails the test otherwise.
- core/service/ncp/namespace_test.go: removed a dead first assignment to `root`
  that was unconditionally overwritten before use.
- cmd/csmount/main.go, cmd/internal/cli/cli.go: two SA4023 "always true" findings
  are artifacts of golangci-lint's build-tags config (just `all`, no `fuse`/`cgo`),
  which only ever analyzes the FUSE-not-compiled-in stub of mountAt (genuinely
  always errors, by design) and relaunchProcess (whose only success path calls
  os.Exit and never returns, which staticcheck doesn't model) — both are correct
  behavior, not bugs; suppressed with comments explaining why.

unused: removed confirmed-dead code (verified via whole-repo grep, not just the
default lint build tags) — adapter/control/finder's serviceAllowed/parentRef,
client/etherdfs's ethHdrLen, client/smb's errIPXNoMAC and a test-only firstWrite
helper, core/service/ncp's appendLE16, core/service/afp's routedControls test
helper, an unused parseCodec.data test field, and three superseded copyDir/
copyFile/copyFork wrappers in client/xfer (the real entry points call their *Ctx
siblings directly; moved the doc comments onto those instead of losing them).
client/fuse's onInit field looked identically unused but is NOT dead — it's set
and called by host.go, which needs the real fuse&&cgo tags to compile, so
golangci-lint's tagless view never sees the use; suppressed instead of deleted.

revive (package-comments, all mechanical): several files had a file-specific doc
comment sitting directly attached to `package X` with no blank line, which Go/
revive read as an attempt at THE package comment and rejected for not starting
with "Package X ..." — detached them (blank line) where a real package doc
already lives elsewhere (core/fs, core/router, core/protocol/smb all have one in
another file). core/buf/buf.go's real "Package buf ..." comment had a //go:build
line wedged between it and `package buf`, breaking the attachment — reordered
(build tag, blank line, doc comment, package). core/service/netboot/netboot.go's
SPDX header and its real package doc were one un-blank-separated block, so revive
saw "SPDX-..." as the start instead of "Package netboot" — separated them.
core/hostinfo had no package comment anywhere in the package — added one to
hostinfo.go (the one file with no OS build tag). adapter/macgarden's real
package-level description lived in fs.go under a plain "This file implements..."
opener — reworded to "Package macgarden ..." since, same as client/fuse above,
its only OTHER package-doc candidate (stub.go) is built under the tags NOT
compiled together with fs.go, so it was never actually the canonical one lint
saw.

Verified: go build/vet clean (bare and -tags all), full go test -tags all ./...
passes.

Remaining: errcheck (73), gocritic (26), ineffassign (5) — being worked through
separately.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
All five were genuine dead writes, not stylistic nitpicks:
- adapter/config/describe/describe.go: `cap := embedCap` was unconditionally
  overwritten by both branches of the very next if/else — embedCap itself is
  still used elsewhere in the function (the non-anonymous-embed field case),
  just not here.
- core/service/afp/catsearch.go, parms_test.go: a final `off += N` past the
  last read of `off` in each function — dead trailing increments.
- core/service/afp/filedir.go: `newStore := srcStore` was unconditionally
  overwritten by both branches of the following if/else; `newStore` itself is
  used further down (Stat/renamePath), just not at that initial value.
- core/service/afp/handlers.go: `out = putPString(...)` — putPString's write
  into b's backing array (via append) is real and needed, but the returned
  slice header was being thrown away one line later by `out = b[:machineOff]`
  anyway; call it for the side effect instead of assigning its result.

Verified: go build/vet clean, full go test -tags all ./... passes, ineffassign
now reports 0.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Resolves the last gocritic categories: unlambda (collapse trivial
closures to direct function references, e.g. reg_localtalk.go's
ltoudp/tashtalk vars and the finder test helpers), appendAssign
(reassign append results to the same variable rather than a fresh
one, notably a real bug fix in smb.AppendNameTrailer which was
discarding the appended destination bytes; the frag-buffer append
sites in the netbios/smb packages are nolint'd since frag is nilled
immediately after and the aliasing is harmless), deprecatedComment
and mapKey (foldresolve.go, fileio.go), and exitAfterDefer in the
three standalone probe commands (csecho/csipxping/csncpinfo) and
cli.go's relaunchProcess path, each given an explicit Close/cleanup
call before os.Exit with a nolint explaining why the skipped defer
is harmless.

Also runs gofmt over two files with pre-existing formatting drift
(ref.go, progress.go) found while verifying this batch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Wraps every flagged deferred Close (files, connections, sessions,
zip readers, response bodies, mDNS/UBus/SQLite handles) as
defer func() { _ = x.Close() }() and prefixes the flagged
fmt.Fprintf/Fprintln calls (CLI/interface-listing output, SSE
event writes, debug trace) with _, _ = , matching this repo's
established house style for intentionally-unchecked errors.

This clears the last golangci-lint category (errcheck, 70
findings); `golangci-lint run --max-same-issues=0
--max-issues-per-linter=0` now reports 0 issues across every
enabled linter (errcheck, errorlint, gocritic, govet, ineffassign,
misspell, revive, staticcheck, unused).

Verified with go build/vet -tags all, gofmt -l, go test -tags all
./... and go test -tags all -race ./... all clean.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
golangci-lint's local darwin runs never see these _linux.go files
(GOOS-gated), so the three unchecked defer f.Close() calls in
diagnostics_linux.go and gateway_linux.go only surfaced once CI ran
the lint step on ubuntu-latest. Same defer func() { _ = f.Close() }()
pattern as the rest of the errcheck cleanup.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Both fix vulnerabilities the Quality job's govulncheck gate flagged
as reachable from our code:

- go 1.25.12 -> 1.25.13: fixes GO-2026-6218 (net/url quadratic
  complexity), GO-2026-6090 (crypto/tls post-handshake message
  limit), GO-2026-6089 (net/http H2C ReadHeaderTimeout),
  GO-2026-5972 (encoding/asn1 recursion depth), and GO-2026-5026
  (net/http punycode label validation) -- all fixed upstream in
  this patch release.
- golang.org/x/net v0.55.0 -> v0.56.0 (pulling x/sys v0.46.0 along
  with it): fixes GO-2026-5942, a dnsmessage.Parser panic on a
  malformed SVCB/HTTPS RR, reachable from client/afp/mdns.go's
  mDNS response parsing.

`go build`/`go vet -tags all` and `go test -tags all ./...` still
clean after the bump; `go mod tidy` was not run since it currently
fails on an unrelated pre-existing issue (tinygo.org/x/drivers
subpackages referenced by hardware/peripherals aren't resolvable
by tidy outside a tinygo build).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
release-main.yml previously also ran on every push to main, auto-
cutting a "dev-<sha>" prerelease each time -- noisy, and not what
a 1.0-RC cycle needs (we want to publish v1.0.0-rc1, -rc2, etc. as
distinct, deliberate releases). Two changes:

- The workflow trigger drops `push: branches: [main]`, keeping only
  `tags: ['v*']` and `workflow_dispatch`.
- compute-release-metadata.sh's non-tag fallback (which synthesized
  the dev prerelease) is replaced with a hard failure: it now only
  ever accepts a ref_type of "tag" matching vMAJOR.MINOR.PATCH or
  vMAJOR.MINOR.PATCH-rc / -rcN. This also fails a workflow_dispatch
  run picked from a branch, so a release genuinely cannot be cut
  without a real tag.
- The regex gains the optional -rc suffix; prerelease is "true" for
  any -rc tag and "false" for a bare vMAJOR.MINOR.PATCH tag, and
  build_version carries the suffix through (e.g. "1.0.0-rc1").

PR CI's per-run build artifacts (Windows installer, etc.) are
unaffected -- those are workflow artifacts uploaded on every PR run,
not GitHub Releases, and don't need a tag.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…eleases

hardware/esp32/wt32eth01/{emac,wifi}.go cgo directly against ESP-IDF's C
headers and component libraries, so TinyGo can't compile them without the
SDK on disk. Adds espressif/install-esp-idf-action (v5.3) to both
pr-ci.yml and release-main.yml's embedded jobs, and wires the resulting
IDF_PATH into CGO_CFLAGS (scripts/build_wt32eth01.sh) so the include
search covers the ESP-IDF components these files touch.

This is a best-effort step, not a full fix, and is documented as such:
ESP-IDF's headers still expect a project-generated sdkconfig.h and the
-lesp_eth/-lesp_wifi/... component libraries only exist after a real
`idf.py build` of a matching component project -- neither exists here.
Both are called out in scripts/build_wt32eth01.sh as the remaining gap
for follow-up work.

Also fixes something more consequential found while looking at this:
"Build WT32-ETH01" ran FIRST in both jobs' step lists, so its failure
was aborting the job before the Pico builds (which build clean) ever
ran -- and in release-main.yml, build-embedded is a hard dependency of
the release job, so no release could ever publish while WT32-ETH01 was
red. Reordered Pico builds first, marked the ESP-IDF install and
WT32-ETH01 build steps continue-on-error, and split release packaging
so a missing wt32eth01.bin only skips that one artifact (with a
build warning) instead of failing the whole job.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
"Build Pico" was masked by "Build WT32-ETH01" always failing first (see
the previous commit) and had never actually been exercised in CI. With
Pico running first, it turned out none of the four variants compiled.
Fixed, in the order hit:

- golang.org/x/net/ipv4 (multicast UDP, via mdns and LToUDP browsing)
  and client/netbios's NBNS lookup both need net.ListenUDP /
  net.Interface.Addrs(), which TinyGo's baremetal targets don't
  implement. Split client/afp/mdns.go, client/link/localtalk.go, and
  client/netbios/nbns.go into !tinygo (real) / tinygo (stub, returns a
  clear "not supported" error) pairs, matching the existing
  core/hostinfo/primary_interfaces*.go precedent. client/browse/tcp.go's
  net.InterfaceByName fallback got the same treatment
  (ipv4_fallback*.go). nbns_unix.go's tag gained "&& !tinygo" since
  TinyGo's baremetal GOOS reports linux, so the bare "unix" tag matched
  it too and pulled in a termios syscall it doesn't implement either.

- adapter/serial (github.com/jacobsa/go-serial) shells out to termios
  ioctls TinyGo doesn't implement. Split into config.go (plain data,
  shared), serial.go (!tinygo, the real Open), serial_tinygo.go (stub).

- hardware/peripherals/lan8720a/lan8720a.go: a real bug, unrelated to
  TinyGo -- id2 (half of the PHY ID read) was read and never checked,
  which is also what made it a compile error (declared and not used).

- hardware/peripherals/w5500/w5500.go: written against a MACRAW raw-
  frame socket API (OpenMACRAW/GetRxSize/per-socket Read/Write/Send)
  that tinygo.org/x/drivers/w5500 v0.35.0 (the actual pinned dependency)
  does not have -- it only exposes the chip's IP-socket offload, not a
  raw-frame passthrough. Replaced with a stub that fails cleanly
  (ErrNotImplemented) instead of not compiling; bridging our
  link.FrameLink onto that API is real follow-up work, not attempted
  here.

- hardware/pico/main.go: `*lan8720a.Device` was never a real type
  (lan8720a.New returns *Driver) -- another compile error masked by
  WT32-ETH01 failing first.

- hardware/pico/ethernet_w5500.go: `&machine.SPI1` -- SPI1 is already
  `*machine.SPI` on this target, so this took the address of a pointer.

- hardware/peripherals/cyw43439/cyw43439.go (Pico W / Pico 2 W):
  tinygo.org/x/drivers/net and .../net/cyw43439 don't exist in any
  released tinygo.org/x/drivers version. Same treatment as w5500 --
  stubbed to fail cleanly, mirroring the sdcard/fatfs gap already
  documented in hardware/pico/main.go.

- scripts/build_pico.sh: TinyGo 0.41.1 has no "pico3" target (RP2350's
  target is "pico2"); fixed both the pico2 and pico2w cases. TinyGo's
  own -target=pico2 supplies a "pico2" build tag, not "pico", so
  hardware/pico's shared files (previously `//go:build pico`) are now
  `//go:build pico || pico2` so they compile under both chips without
  forcing an extra -tags that would collide with TinyGo's own internal
  per-chip machine-package files (confirmed: passing "pico" alongside
  "pico2" causes TinyGo's board_pico.go and board_pico2.go to both
  compile, redeclaring the same symbols).

All four `bash scripts/build_pico.sh {pico,picow,pico2,pico2w}` variants
now build clean via TinyGo 0.41.1, verified locally. Desktop build/vet/
test/lint (go build/vet -tags all, go test -tags all ./..., golangci-lint
--max-same-issues=0 --max-issues-per-linter=0) all still clean too.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@pgodwin
pgodwin marked this pull request as ready for review August 23, 2026 04:15
pgodwin and others added 15 commits August 23, 2026 14:24
Failure observed: "gap between write 1 and 2 = 17.254149ms, want ≥
~20ms" -- a real but rare flake, not a pacer bug. paceLink.Write
schedules each node's next send against an absolute target time
(now + wait + gap, computed once per write), so ordinary scheduler
jitter can only push a measured gap LATER, never earlier, under
time.Sleep's documented "at least the duration" guarantee; confirmed
this by re-deriving the schedule algebraically and by 100+ local runs
(including under synthetic CPU load and -race) that never reproduced
it. The test's own tolerance was just too tight for a loaded/
virtualized CI runner: a flat 2ms against a 20ms target (10%) is
easily exceeded by ordinary timer/scheduling jitter.

Widened both the per-pair gap check and the aggregate elapsed check
to a proportional 25% tolerance (gap/4 = 5ms here) instead of a flat
2ms / zero tolerance, so the test still meaningfully catches "pacing
isn't happening at all" (near-zero gaps) without flaking on jitter
within a normal range.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Runtime.Start attaches and seeds each [Router].members port synchronously
right after StartAll returns, but a real EtherTalk/LToUDP/TashTalk port's
node-address claim (AARP/LLAP) finishes in a background goroutine and Start
never waits for it. When the claim lands after Attach already ran with
NetworkMin()==0, router.Attach's own nonzero guard skips installing the
directly-connected route and seedZone's zero-range guard skips the ZIT too
— and nothing ever retried either install.

The port still announces its claimed range correctly over RTMP and answers
same-network traffic fine (Inbound's same-network fast path needs no
routing-table entry), but any service reply that must round-trip through
router.Reply->Route (ZIP's ATP zone queries, AFP's ASP session reads) does
RoutingTable.GetByNetwork and gets a silent, permanent nil — the reply is
dropped with no error, forever. This reproduced as: Chooser showing only
the AFP server's own zone via GetLocalZones (expected) but never all zones
via GetZoneList, and AFP connections stalling on ASP GetStatus with zero
replies.

Poll briefly (bounded, cancelled on Stop) for a late claim after Attach and
re-run the same route/zone install once it lands; both installs are
idempotent so this is a no-op on the fast path where the claim already
beat Attach.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
handleBrRq resolved a zone=* request to the rx port's single zone
(routeZone) to pick routing targets, but buildCommonPayload was still
called with the original unresolved `zone` — so the re-broadcast LkUp
still carried a literal "*" in its tuple. Real NBP responders on other
member networks echo that back verbatim, so their replies never match
a zone-scoped Chooser/Finder query, which is why Finder only listed
servers on the querier's own network segment (multiple AFP servers
being invisible in the Chooser despite csclient's NBP discovery
finding them all).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
dhcp_relay=true always sources client addresses via real DHCP relay
(adapter/macipgw/macipgw.go, core/service/macip/macip.go assigner()),
regardless of `mode`. Combined with mode='nat' it silently bypassed
the 192.168.100.0/24 static pool, handing out addresses from the relayed
DHCP server instead. Per server.toml.example, dhcp_relay is meant to
pair only with bridge mode.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
nat mode + dhcp_relay=true previously silently relayed real DHCP onto
the IP-side network instead of using the NAT static pool, handing MacIP
clients addresses outside the configured 192.168.100.0/24 range with no
indication anything was wrong.

Enforce the invariant at the actual point of use (Egress.New), so it
holds regardless of how the Config was assembled: when both flags are
set, log a warning and clear DHCPRelay before it's consulted anywhere
else in New (natOnly, the DHCP client, the BPF filter). Covered by
TestNewNATModeForcesDHCPRelayOff.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
handleOpenAndX handed out a FID over os.OpenFile(dir) without checking
IsDir first, unlike OPEN/CREATE. The open itself succeeded (attrs
correctly reported Directory), so a directory-copy client only found
out on the follow-up READ, which failed with the generic
statusUnsuccessful (ERRSRV/ERRerror) — a code CORE-dialect clients
can't act on, so the whole copy aborted (seen client-side as Windows
"System error 1026" against an IPX SMB share).

Reject with STATUS_FILE_IS_A_DIRECTORY at open time instead, matching
handleOpen/handleCreate/handleNTCreateAndX.
…ports

router.Inbound() unconditionally backfilled a zero source network from
the rx port. That's correct for a short-header LocalTalk-style port
(a zero network there just means "this segment"), but on an extended
port (EtherTalk, LToUDP) a zero source network means the sender is
still in AARP startup range with no claimed address at all — exactly
the case ClassicStack's own probe clients (client/link.NewOpener,
used by both csclient and the web UI's AFP discovery) intentionally
produce rather than running a full AARP claim. Backfilling it there
manufactured a network.node nothing owns and erased the signal
Reply() needs to broadcast instead of unicast, so ZIP/NBP/etc. replies
silently vanished into an unresolvable AARP target.

NBP had the same bug independently: handlePacket defaulted a zero
NBP-tuple network to from.Network() unconditionally, and replyMatches
always unicast via Route() rather than ever using Reply()'s broadcast
path, so even after the router fix NBP still fabricated an address.

Net effect: an unnumbered client's NBP/ZIP queries over EtherTalk/pcap
got no replies at all (confirmed via packet capture — ClassicStack's
router never answered a GetZoneList or BrRq from such a client, while
the same queries over LToUDP worked only because LToUDP unicast is a
multicast-to-everyone no-op on addressing).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…s contents

resolveSearchPath special-cased a non-wildcard last path element that named
a directory by listing that directory's own children, instead of matching
the name against its parent like every other exact-name lookup. [MS-CIFS]
§2.2.6.2 describes FIND_FIRST2 as a search "within a directory or for a
directory" — a bare "\DRIVER" asks whether an entry named DRIVER exists,
answered with that one entry (Directory attrs set), confirmed against a
real Windows 98 server in spec/captures/nwlink-win98.pcap frames 182-183.

A directory-copy client relies on exactly this to tell files from
directories without opening them first. Getting the child listing instead
meant it never saw the entry it asked about, then failed trying to open the
directory directly ("Cannot find the specified path") once OPEN_ANDX
correctly started rejecting directories.
ReservedSet.unescape restored every "0xNN" store token to its raw rune
unconditionally, regardless of which wire the name was headed for. Control
characters are always-reserved (every backend escapes them on the way in,
independent of ReservedPOSIX/ReservedNTFS), so a classic Mac "Icon\r"
custom-icon marker — its name is literally "Icon" plus a raw CR byte —
round-trips through the store as "Icon0x0D" and then, on the way back out,
got the raw CR restored on EVERY wire, AFP and SMB alike.

That's correct for AFP's Mac clients (WireMacRoman/WireUTF8): a raw CR in a
filename is normal on HFS and they handle it natively. It's wrong for
SMB/NCP's DOS and Windows clients (WireANSI/WireUTF16): Win32 filenames can
never contain a control character under any encoding. A real capture showed
Explorer refusing to copy the file ("The filename you specified is invalid
or too long"), and NT 3.51 File Manager crashing just listing the share.

unescape now takes the destination WireEncoding and leaves a token for a
windowsIllegal rune (control chars, plus the NTFS/FAT reserved punctuation)
as literal "0xNN" text when dst is WireANSI/WireUTF16 — which happens to
already be a stable, round-trippable name, since it's exactly what's on
disk when the backend needed to escape the character for storage too.
SMB clients are always DOS/Windows redirectors, but a share's storage
escaping previously defaulted (with every other protocol) to
ReservedPOSIX — only escaping what the POSIX store itself can't hold. A
Mac-originated name containing an NTFS/FAT-reserved character (';?*<>:"|\'
— all legal on HFS) would sit raw in storage and flow straight to an SMB
client unescaped, a byte Windows could never have created locally.

Add "windows-safe" (NewWindowsSafeFilenameCodec): identical to "identity"
but with ReservedNTFS in place of ReservedPOSIX, so those characters are
escaped in storage the moment a name is written, not just filtered when
read back. ShareSection.fsSpec now defaults an unset FilenameCodec to
"windows-safe" instead of falling through to fs.withDefaults' generic
"identity". Complements, not replaces, the prior Encode-time DOS-wire
unescape guard: that guard is what stops an already-escaped control
character (always-reserved under either set, e.g. a classic Mac "Icon\r"
marker's raw CR) from being restored onto the wire regardless of which
codec a share is on; defaulting SMB to windows-safe additionally escapes
the wider NTFS punctuation set at write time.
…ar state

- adapter/link/framing/aarp: trim Ethernet zero-padding using the 802.3
  length field before ddp.Decode, which rejects anything past the DDP
  header's declared length. Short DDP payloads (ATP TReq, ZIP/ASP
  GetZoneList/GetNetInfo/GetStatus) are always padded on a real NIC and
  were silently dropped as ErrBadLength, while longer packets (NBP, most
  AEP) happened to clear the padding and decoded fine — this is why
  ZIP/ASP looked dead while NBP/AEP worked. Mirrors framing.go's existing
  plain-framer trim.
- compose/supervisor + cmd/internal/cli: a component whose Stop doesn't
  select on ctx could hang StopAll past its deadline, and a second
  Ctrl-C/SIGTERM during that hang was silently dropped (NotifyContext's
  handler goroutine only reads one signal). stopWithDeadline abandons a
  component that misses its deadline instead of blocking the rest of
  teardown; a second interrupt now forces immediate exit.
- adapter/control/finder/local.go + go-finder-host.ts: LocalVolumes now
  returns [] instead of nil (GET /finder/local feeds an array spread in
  the web UI). The web UI's sidebar also now tracks [Client] enablement
  live via the state SSE topic, hiding a scheme's group when its service
  is disabled instead of only reflecting it after a reload.

Excludes server.toml (local test-rig device paths/zone, not a code
change) and the runtime-overwritten *.pcap capture files.
Builds the Win32 (native MSVC 1.2) and Win16 (MSVC 1.5 via otvdm) SMB
test clients on windows-latest, and the macOS AFP test client via the
official Retro68 Docker image on ubuntu-latest, publishing each disk
image (SMBE2E1.img x2, AFPE2E.dsk) as a workflow artifact.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Retro68's default "multiversal" interfaces don't implement pre-System-7
APIs like AppleTalk.h yet, which the AFP e2e client needs. Vendor
MPW-GM.img.bin (Apple's real Universal Interfaces, MacBinary DiskCopy
image) under tools/end-to-end/tools/mpw/ alongside the pinned MSVC
kits, and point the Retro68 container at it via INTERFACES=universal +
INTERFACESFILE.

Source: https://ftp.zx.net.nz/pub/micro/macintosh/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc/MPW-GM_Images/MPW-GM.img.bin

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
NewWindowsSafeFilenameCodec (SMB's new default) reused ReservedNTFS, which
escapes '*' and '?' along with the genuinely-always-illegal Win32
punctuation. Those two are also FIND_FIRST2/SMB_COM_SEARCH wildcard
metacharacters on the wire, and a search pattern is decoded through the
same per-element codec.Decode as any other path text — resolveSearchPath's
wildcard/pattern split (trans2.go) runs on the string Decode already
produced. So every "*" pattern decoded to the inert token "0x2A" before the
split ever saw a wildcard, and resolveSearchPath treated it as an exact-name
lookup for a file literally called "0x2A" — no share has one, so every
FIND_FIRST2 came back status-success with zero entries. SMB clients saw a
share with no files at all.

Add ReservedSMBWire (ReservedNTFS minus '*'/'?') and use it for
windows-safe instead. ReservedNTFS itself is untouched — that set is about
what an actual NTFS disk can hold, not about parsing a request, so it still
escapes both.

Regression tests at both layers: TestWindowsSafeCodecLeavesWildcardsAlone
(codec-level) and TestTrans2_FindFirst2WildcardWorksOnWindowsSafeCodec
(end-to-end through the real share-build path, not the synthetic
"identity" fixture every other trans2 test uses — which is exactly why
this one slipped past the test suite the first time).
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