Skip to content

refactor(memory): name the domain memory, not mem - #568

Closed
retr0h wants to merge 1 commit into
mainfrom
refactor/mem-becomes-memory
Closed

retr0h wants to merge 1 commit into
mainfrom
refactor/mem-becomes-memory

Conversation

@retr0h

@retr0h retr0h commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

First of the renames from #566, following the rule merged as osapi-io/specs#242. Chosen first because it is the abbreviation case, with no tool name involved.

The URL segment, the SDK service and the generated types all say memory. The provider directory and its package said mem, so the domain carried two names and the cross-layer search that checks a domain reaches every layer missed one of them.

Not mechanical, because gopsutil is also called mem

19 + 2  import github.com/osapi-io/osapi/internal/provider/node/mem
 2 + 2  import github.com/shirou/gopsutil/v4/mem

Two files import both. They already alias gopsutil as sysMem, so a bare mem. always meant ours and nothing was ambiguous. Our package is renamed; gopsutil's references are untouched.

I did get this wrong once mid-change, rewriting mem.VirtualMemoryStat to memory.VirtualMemoryStat inside darwin.go and debian.go where it was gopsutil's. The build caught it.

What moved, and what deliberately did not

Renamed: the directory, the package declaration including package mem_test, the import paths including node/mem/mocks, and the identifiers memProvider and memMocks.

Kept: memFs is the in-memory filesystem used across the test suite. MemBytes and MemPercent belong to the process domain, where they are a process's resident memory. memInfo is a local holding a gopsutil value. None of them is this domain.

The CLI's MEM column header stays too; an abbreviation in a table of fixed-width columns is doing a different job.

Three stale doc comments turned up

internal/provider/node/host/debian.go   // Debian implements the Mem interface for Debian.
internal/provider/node/disk/debian.go   // Debian implements the Mem interface for Debian.
internal/provider/node/load/debian.go   // Debian implements the Mem interface for Debian.

Copied from this package and never corrected. They name their own interface now. That is the rename earning its keep: three providers claimed to implement an interface they have nothing to do with, and nothing would have found it.

Checks

go build ./internal/... ./cmd/... clean. internal/provider/node/memory and internal/agent/... pass.

Next

node/apt to node/package, then scheduled/cron to schedule and container/docker to container. Those two are restructures rather than renames, since the concept becomes the directory and the tool becomes an implementation file inside it, the way ntp already holds chrony.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FuKUsHFG1EqZXamffh9M2c

The URL segment, the SDK service and the generated types all say memory.
The provider directory and its package said mem, so the domain carried two
names and the search that checks a domain reaches every layer missed one of
them.

The rename is not mechanical, because gopsutil's package is also called mem
and two of our files import both. Our package is renamed and gopsutil's
references are left alone; the two files that import both already alias
gopsutil as sysMem, so nothing is ambiguous.

Identifiers, package declarations, test package names and mock imports go
with it. memFs, MemBytes, MemPercent and memInfo stay: the first is the
in-memory filesystem used in tests, the next two belong to the process
domain, and the last holds a gopsutil value.

Three stale doc comments turned up on the way. host, disk and load each
said their Debian implementation "implements the Mem interface", copied
from this package and never corrected. They name their own interface now.

Refs #566

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FuKUsHFG1EqZXamffh9M2c
@retr0h

retr0h commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator Author

Closing unmerged.

@retr0h retr0h closed this Oct 1, 2026
@retr0h
retr0h deleted the refactor/mem-becomes-memory branch October 1, 2026 19:32
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