summaryrefslogtreecommitdiff
path: root/internal/askcli/task_selector.go
AgeCommit message (Collapse)Author
2026-05-26build: bump minimum Go version to 1.24.0Paul Buetow
Updates go.mod from 1.21.0 to 1.24.0 because tests use testing.T.Chdir, which requires Go 1.24. Also fixes pre-existing fmt.Errorf non-constant format strings in task_selector.go that the printf vet analyzer flags when running go test with the newer minimum version.
2026-05-04askcli: serialize task alias cache writes to fix concurrent rename racePaul Buetow
Two concurrent 'ask' invocations could race on the alias cache file: both wrote the JSON to a shared '<path>.tmp' filename and then both called os.Rename, so the loser failed with: replace task alias cache: rename .../task-aliases-v2.json.tmp .../task-aliases-v2.json: no such file or directory The shared tempfile also enabled lost updates because each process loaded the file independently before saving its own version on top. Fix: - Take an exclusive flock on a sentinel file (task-aliases-v2.json.lock) in the cache directory around the full load/modify/save cycle in both ensureTaskAliases and resolveTaskSelectorFromCache, using the existing internal/filelock package. - Switch save() to os.CreateTemp so each writer gets a unique tempfile name; the loser's tempfile is removed cleanly on rename failure. - Refactor resolveTaskSelectorFromCache by extracting finalizeResolvedTaskSelector to keep functions under 50 lines. Adds TestEnsureTaskAliases_ConcurrentCallsDoNotRaceOnTempFile, which reproduces the original error reliably on the unfixed code and now passes with -race. Amp-Thread-ID: https://ampcode.com/threads/T-019df49f-52a5-75b1-98d5-371a163ef100 Co-authored-by: Amp <amp@ampcode.com>
2026-03-27release: v0.27.2v0.27.2Paul Buetow
2026-03-27docs: document askcli exportsPaul Buetow
2026-03-27Move selector helpers into task selectorPaul Buetow
2026-03-27task 3a4c0f14-16ad-487f-af7c-bd99ee6464e6: use pointer Dispatcher receiversPaul Buetow
2026-03-26askcli: resolve aliases for selector task 0b9480fe-ec1b-4c0e-a8b0-88f1f08b56d3Paul Buetow