Skip to content

refactor: decompose four WS-D god-files by role (arp, users, snmp, engine)#1709

Merged
krisarmstrong merged 4 commits into
mainfrom
refactor/wsd-bundle-godfiles
Jun 17, 2026
Merged

refactor: decompose four WS-D god-files by role (arp, users, snmp, engine)#1709
krisarmstrong merged 4 commits into
mainfrom
refactor/wsd-bundle-godfiles

Conversation

@krisarmstrong

Copy link
Copy Markdown
Collaborator

Summary

Bundled WS-D god-file decomposition — four independent pure-move splits, one
commit each, each file relocated by role with no behavior change:

Original (LOC) Split into
internal/discovery/enumerate/arp.go (750) arp.go (scanner type + config/result accessors) · arpscan.go (subnet scan / ping sweep) · arpenrich.go (ARP-table read + enrichment)
internal/database/users.go (731) users.go (user CRUD) · users_auth.go (login/lockout/token-version) · users_sso.go (SSO upsert/lookup) — follows the existing users_*.go convention
internal/discovery/snmp_collector.go (688) snmp_collector.go (types + collect orchestration/dispatch) · snmpcollectors.go (per-area low-level collectors)
internal/discovery/engine.go (678) engine.go (types, config, setters, lifecycle) · scan.go (scan orchestration/phases)

Bundled into one PR (rather than four) to avoid the required-up-to-date
branch-protection merge cascade. Every split file is now under the 600-line
size gate.

Linked Issue

Related to #187

Type of Change

  • Chore / refactor / dependency update

Risk

  • Low

Testing Evidence

Each of the four splits independently verified pure-move (declaration sets +
code-line multisets identical to the original), then the combined bundle
gated from a clean worktree off origin/main:

per-file pure-move proofs (×4):   ✅ DECL + CODE IDENTICAL
gofmt -l:                         clean
go build ./internal/discovery/... ./internal/database/...:  OK
go vet (same):                    OK
golangci-lint (same):             0 issues
go test -race ./internal/discovery/ ./internal/discovery/enumerate/:  ok
go test -race -timeout=20m ./internal/database/:  ok 842s (pre-existing slow suite; >10min default, within CI 20m)
check-filename-policy.sh:         ✓
file-size gate:                   all touched/new files <600

Security and Release Checklist

  • No secrets, tokens, credentials, or customer data are included.
  • Mutating routes, auth surfaces, permission checks, and output encoding were reviewed if touched. (none — pure file splits within existing packages)
  • Dependencies are pinned and justified if changed. (none changed)
  • Documentation, screenshots, or operator notes were updated if behavior changed. (no behavior change)

Kris Armstrong added 4 commits June 17, 2026 08:41
Split internal/discovery/enumerate/arp.go (750 LOC) into role-based files
in the same package — pure move: scanner type + config/accessors stay in
arp.go; subnet scanning + ARP-table reading/enrichment move out.

All files under the 600-line size-gate threshold. Declaration sets and
code-line multisets verified identical to the original.

Related to #187
Split internal/database/users.go (731 LOC) into role-based files in the
same package (following the existing users_*.go convention) — pure move:
core user CRUD stays in users.go; login/lockout/token-version moves to
users_auth.go; SSO upsert/lookup moves to users_sso.go.

All files under the 600-line size-gate threshold. Declaration sets and
code-line multisets verified identical to the original.

Related to #187
…S-D)

Split internal/discovery/snmp_collector.go (688 LOC) into role-based files
in the same package — pure move: types + collector orchestration/dispatch
stay in snmp_collector.go; the per-area low-level collect* implementations
move out.

All files under the 600-line size-gate threshold. Declaration sets and
code-line multisets verified identical to the original.

Related to #187
Split internal/discovery/engine.go (678 LOC) into role-based files in the
same package — pure move: engine types, config, constructors, collector
setters, and lifecycle stay in engine.go; the scan orchestration/phases
move out.

All files under the 600-line size-gate threshold. Declaration sets and
code-line multisets verified identical to the original.

Related to #187
@github-actions

Copy link
Copy Markdown

📋 License Compliance Report

✅ All dependencies pass license compliance checks

Go Dependencies

  • Unknown: 118 package(s)
  • MIT: 30 package(s)
  • BSD-3-Clause: 17 package(s)
  • Apache-2.0: 12 package(s)
  • BSD-2-Clause: 2 package(s)

npm Dependencies

See full report in workflow artifacts

Allowed Licenses: MIT, Apache-2.0, BSD-*, ISC, CC0-1.0, MPL-2.0
Forbidden: GPL, AGPL, SSPL (strong copyleft)

@krisarmstrong krisarmstrong merged commit cb8e937 into main Jun 17, 2026
27 checks passed
@krisarmstrong krisarmstrong deleted the refactor/wsd-bundle-godfiles branch June 17, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant