ax(mining): replace implementation-describing comment with call-site example on saveUnlocked
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

AX Principle 2: comments show HOW to call, not WHAT the body does.
The old comment restated the lock/defer mechanics; the new comment
shows the caller context (Save and Update) so an agent knows when
saveUnlocked is the right call.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 17:54:37 +01:00
parent f766f06c18
commit ba72f3e408
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -83,7 +83,7 @@ func (r *FileRepository[T]) Save(data T) error {
return r.saveUnlocked(data)
}
// r.mutex.Lock(); defer r.mutex.Unlock(); return r.saveUnlocked(data)
// return r.saveUnlocked(data) // called by Save and Update while mutex is held
func (r *FileRepository[T]) saveUnlocked(data T) error {
dir := filepath.Dir(r.path)
if err := os.MkdirAll(dir, 0755); err != nil {