chore: remove dead code and fix stale naming (#76, #77)#80
Merged
Conversation
Remove dead code identified in the codebase audit and fix stale naming/comments across all packages. Dead code removed (issue #76): - control: UpdateFunc/WithUpdateHandler/onUpdate (never invoked), entryMetadata.Tags (populated but never read), RelayData.RecordID (never populated), NetworkConfig.ListenPort/DefaultRelays (never read), DNSConfig.Domains (never populated in production) - engine: Engine.dwnClient/.converter/.sys/.dialer/.autoKeyDelivery (stored but never read after construction), DWNControl.hostinfo/ .netinfo/.endpoints (written, never read), loadAndPush loginFinished parameter (never used in function body) - dwn: ProtocolAPI subsystem (~240 lines, entirely self-referential), ReadData/byteReader (never called), ErrJSONRPC/ErrRecordsWriteWS (never referenced), 10 unused JSON-RPC error codes, InterfaceRecordsSubscribe (never dispatched), dataConsumed field (write-only), DeriveKeyDeliveryEncryption/WriteEncryption (test-only) - mesh: ServiceIP (never referenced), RegisterNodeParams.DiscoKey (never written or read), NodeRegistration.MeshIP (echoes caller data), 4 unused FetchContextKeyParams fields, "peer remove" stub in command combiner (no handler) Stale naming fixed (issue #77): - Replaced all "dexnet" references with "meshnet" in control/types.go - Updated "member" → "node" in comments across packages - Consolidated protocol URI to single protocols.MeshProtocolURI constant (removed control.ProtocolMesh and mesh.protocolMesh, replaced 7 hardcoded literals in cmd/meshd/main.go) - Removed duplicate mesh.PublicEndpoint type (use control.PublicEndpoint) - Condensed 38-line design journal comment in keydelivery.go to 4 lines All tests pass with -race.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes 651 lines of dead code and fixes stale naming/comments across the entire codebase, based on findings from the audit (issues #76 and #77).
Dead code removed (#76)
internal/control/
UpdateFunc/WithUpdateHandler/onUpdate— callback stored but never invokedentryMetadata.Tags— populated but never readRelayData.RecordID— never populated or readNetworkConfig.ListenPort/DefaultRelays— never readDNSConfig.Domains— never populated in productioninternal/engine/
Engine.dwnClient,.converter,.sys,.dialer,.autoKeyDelivery— stored but never read after constructionDWNControl.hostinfo,.netinfo,.endpoints— written, never readloadAndPushloginFinishedparameter — never used in function bodyinternal/dwn/
ProtocolAPIsubsystem (~240 lines) — entirely self-referential, never calledReadData()/byteReader— never calledErrJSONRPC/ErrRecordsWriteWS— never referencedInterfaceRecordsSubscribe— never dispatcheddataConsumedfield — write-onlyDeriveKeyDeliveryEncryption/DeriveKeyDeliveryWriteEncryption— test-only, no production callersinternal/mesh/
ServiceIP— exported but never referencedRegisterNodeParams.DiscoKey— never written or read (disco key exchanged via endpoint records)NodeRegistration.MeshIP— echoes caller's own data, never readFetchContextKeyParamsfields"peer remove"in command combiner — no handler existsStale naming fixed (#77)
control/types.go(9 occurrences)protocols.MeshProtocolURIconstant — removedcontrol.ProtocolMeshandmesh.protocolMesh, replaced 7 hardcoded literals incmd/meshd/main.gomesh.PublicEndpointtype — usecontrol.PublicEndpointeverywherekeydelivery.goto 4 linesVerification
go build ./...— zero errorsgo vet ./...— zero warningsgo test ./... -count=1 -race— all tests pass, no data racesCloses #76, closes #77