Highlights
Wave-2 review-and-fix cycle. Addresses all 4 HIGH and 14 MEDIUM findings from the wave-2 review pass, plus 4 post-validation follow-ups. Focus areas: cross-process state durability, refresh-token race hardening, and privacy.
Cross-process state
internal/filelockpackage: cross-process advisory flock helper (sidecar<path>.lockinode pattern). SurvivesO_APPENDrename-safety semantics.- Every append-only JSONL store (audit, idempotency, approval, schedule, httprecord cassette) now holds a sidecar flock and
fsyncs writes + parent directory before close. internal/idempotency.Store.Acquire(ctx, key)exposes per-key serialisation;FileStoreuses a SHA256-hashed lockfile so callers can span Lookup→Record under one lock.internal/schedule: state transitions serialised across processes (M6 follow-up).
Refresh-token hardening
maybeRefreshSessionnow takes the refresh flock before re-reading the session, refreshing, and persisting. Concurrent callers re-read the freshly stored token instead of double-spending a rotated refresh-token (M13).- Hard-fails on lock acquire error or
SaveSessionerror rather than returning a half-persisted refresh result (M3, M4). - New
GOLINK_REFRESH_LOCK_PATHenv var to override the sidecar lock path.
Privacy
internal/privacy: redacts inlineBearer <token>strings in audit previews and HTTP record/replay cassettes (M11).internal/approval: payloads persist verbatim —approval rundispatches them literally; access control via file mode0o600(H1).
Correctness
internal/plan:Argscanonicalised throughjson.Numberso SHA256 plan hashes are stable across encoder/decoder round-trips (M8).internal/api:Retry-Afterheader honored on 429/503 retries (H2); percent-encoded URN keys decoded inSocialMetadata(M10).internal/httprecord: URL canonicalisation (sorted query params, default port stripped) for record/replay matching (M6).cmd/execute: honorssettings.RequireApprovalfrom env/config (M3);--notespersistent flag registered (H1).cmd/batch: idempotency marshal/record errors logged instead of dropped (L2); progress sidecar fsync'd to survive kernel crash (M8).
Install
# Go
go install github.com/mudrii/golink@v26.05.13
# Homebrew (tap is this repo)
brew tap mudrii/golink https://github.com/mudrii/golink
brew install mudrii/golink/golinkRequires Go 1.26.3+. make ci clean: vet + golangci-lint (0 issues) + test + race + govulncheck.