Create an epitaph directory only when something is kept in it #125

Merged
branderson merged 1 commits from epitaph-empty-dirs into development 2026-08-13 08:43:25 -07:00
Collaborator

Summary generated by LLM agent

dejima-epitaph save made one directory per slug before it knew whether that slug had anything to keep. A workspace's slugs include one per live worktree, and worktrees have transcripts - what they mostly do not have is a compaction summary in any of them. The store therefore read as one entry per worktree with nothing in any of them, which is what the operator hit on the first real run.

What changed

  • The directory is created by the first write into it, in the Python that writes the file, rather than up front in the shell loop.
  • An rmdir per slug clears the empty directories earlier runs already left behind. It cannot touch a slug that kept anything, so it is a cleanup and not a risk.
  • bin/dejima-slug-lib.sh's header still named bin/dejima-audit as the second caller sharing the definition. The cross-project finding that used workspace_slugs was removed in #115, so bin/dejima-epitaph is what shares it now.

Testing

New test in config.bats: a workspace with a live worktree whose transcript carries no summary, plus an empty directory staged as though an earlier run had left it. It asserts no directory survives for that slug and that the workspace's own epitaph is still kept.

Run against the unfixed script first, where it fails on exactly the reported symptom (empty directory left for -tmp-tmp-...-wt), then against the fix. The five existing epitaph tests still pass. Full suite green apart from runtime.bats, which needs a Docker daemon the sandbox does not have and which CI runs in its own job.

**Summary generated by LLM agent** `dejima-epitaph save` made one directory per slug before it knew whether that slug had anything to keep. A workspace's slugs include one per live worktree, and worktrees have transcripts - what they mostly do not have is a compaction summary in any of them. The store therefore read as one entry per worktree with nothing in any of them, which is what the operator hit on the first real run. ## What changed - The directory is created by the first write into it, in the Python that writes the file, rather than up front in the shell loop. - An `rmdir` per slug clears the empty directories earlier runs already left behind. It cannot touch a slug that kept anything, so it is a cleanup and not a risk. - `bin/dejima-slug-lib.sh`'s header still named `bin/dejima-audit` as the second caller sharing the definition. The cross-project finding that used `workspace_slugs` was removed in #115, so `bin/dejima-epitaph` is what shares it now. ## Testing New test in `config.bats`: a workspace with a live worktree whose transcript carries no summary, plus an empty directory staged as though an earlier run had left it. It asserts no directory survives for that slug and that the workspace's own epitaph is still kept. Run against the unfixed script first, where it fails on exactly the reported symptom (`empty directory left for -tmp-tmp-...-wt`), then against the fix. The five existing epitaph tests still pass. Full suite green apart from `runtime.bats`, which needs a Docker daemon the sandbox does not have and which CI runs in its own job.
dejima-agent added 1 commit 2026-08-12 19:50:52 -07:00
Create an epitaph directory only when something is kept in it
tests / runner-env (confined) (pull_request_target) Successful in 34s
tests / confined (proxy) (pull_request_target) Successful in 1m10s
tests / confined (static) (pull_request_target) Successful in 2m28s
tests / confined (providers) (pull_request_target) Successful in 3m12s
tests / confined (remote) (pull_request_target) Successful in 3m35s
tests / privileged (pull_request_target) Successful in 4m8s
tests / runner-env (privileged) (pull_request_target) Successful in 30s
tests / confined (project) (pull_request_target) Successful in 4m40s
tests / confined (config) (pull_request_target) Successful in 5m52s
tests / confined (audit) (pull_request_target) Successful in 6m41s
38045f87c8
A workspace's slugs include one per live worktree, and worktrees have
transcripts. What they mostly do not have is a compaction summary in any
of them, so a directory made per slug up front left the store reading as
one entry per worktree with nothing in any of them.

The directory is now made by the first write into it. An `rmdir` per
slug clears the empty ones earlier runs left behind; it cannot touch a
slug that kept anything.

Also corrects dejima-slug-lib.sh's header, which still named
bin/dejima-audit as the second caller. The cross-project finding that
used workspace_slugs was removed in #115; bin/dejima-epitaph is what
shares the definition now.
branderson approved these changes 2026-08-13 08:43:19 -07:00
branderson merged commit 0ac60b7a59 into development 2026-08-13 08:43:25 -07:00
Sign in to join this conversation.