From 6a0dfa9f2c94dcecf93edfcff9974bb7f73efb36 Mon Sep 17 00:00:00 2001 From: clawbot <35+clawbot@noreply.example.org> Date: Tue, 6 Oct 2026 01:59:55 +0200 Subject: [PATCH] Run make try against a temporary directory (closes #12) `make try` ran against a fixed directory on one person's machine. It failed for anyone else, and where that directory existed it rewrote the checksum attributes and modification times of real files. It now writes three small files into a new directory from `mktemp -d`, runs the same sequence of commands on it, and removes it with an EXIT trap. All steps run in one shell, so the trap also removes the directory when a step fails. `TODO.md`: the `try` sentence leaves Next Step and is recorded under Completed Steps. Model: opus-5-5 --- Makefile | 29 ++++++++++++++++++----------- TODO.md | 7 ++++--- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 22d77ab..43d5d65 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,5 @@ .PHONY: default bootstrap setup test lint fmt fmt-check check docker hooks build clean try -TESTDIR := $(HOME)/Documents/_SYSADMIN/cyberdyne - # The version `make build` stamps into the binary: the git tag or short # commit, -dirty with uncommitted changes. `make build VERSION=x` stamps x, # which is how the Dockerfile passes its version in. @@ -45,13 +43,22 @@ build: clean clean: @rm -f attrsum +# Runs the binary on three small files in a new temporary directory, which +# the trap removes when the recipe ends, also when a step fails. The check +# after clear is expected to fail, so its exit status is ignored. try: build - ./attrsum sum add -v $(TESTDIR) - ./attrsum check -v $(TESTDIR) - ./attrsum clear -v $(TESTDIR) - -./attrsum check -v $(TESTDIR) - ./attrsum sum add -v $(TESTDIR) - ./attrsum check -v $(TESTDIR) - touch $(TESTDIR)/* - ./attrsum sum update -v $(TESTDIR) - ./attrsum check -v $(TESTDIR) + @set -ex; \ + dir=$$(mktemp -d); \ + trap 'rm -rf "$$dir"' EXIT; \ + echo one >"$$dir/a"; \ + echo two >"$$dir/b"; \ + echo three >"$$dir/c"; \ + ./attrsum sum add -v "$$dir"; \ + ./attrsum check -v "$$dir"; \ + ./attrsum clear -v "$$dir"; \ + ./attrsum check -v "$$dir" || true; \ + ./attrsum sum add -v "$$dir"; \ + ./attrsum check -v "$$dir"; \ + touch "$$dir"/*; \ + ./attrsum sum update -v "$$dir"; \ + ./attrsum check -v "$$dir" diff --git a/TODO.md b/TODO.md index 4a231e5..f07fc05 100644 --- a/TODO.md +++ b/TODO.md @@ -20,12 +20,13 @@ have landed since the tag. Policy scaffold commit: add LICENSE, REPO_POLICIES.md, .editorconfig, .golangci.yml, and a comprehensive .gitignore (currently only the attrsum binary), and extend the Makefile (only test/build/clean/try -today) with lint, fmt, fmt-check, check, and hooks targets. Fix the try -target to use a temp fixture instead of the hardcoded -$(HOME)/Documents/_SYSADMIN/cyberdyne path. +today) with lint, fmt, fmt-check, check, and hooks targets. # Completed Steps +* 2026-10-05: `make try` runs on three small files in a temporary + directory that it removes afterwards, also when a step fails, + instead of on a fixed directory on one person's machine * 2026-10-02: `attrsum --version` reports the git tag or short commit, stamped by `make build` and by a plain `docker build .` of a clone; `.dockerignore` sends `.git` without `.git/config` and keeps a