FileSystem.scratchDir is stable rather than fresh, so callers needing a clean staging area cannot use it #551

Open
opened 2026-09-13 09:07:10 +00:00 by mph · 4 comments
Owner

FileSystem.scratchDir (core/.../CommandEnv.scala:120-137) is a keyed, owner-only, symlink-refusing directory that the kanon plugin does not use, because it is stable rather than fresh. A keyed-and-cleared variant would let a caller's staging area take its ownership and symlink guarantees.


Type: feature
Filed from: /home/mph/ops/kanon-DEVDOCS-246 on branch DEVDOCS-246

FileSystem.scratchDir (core/.../CommandEnv.scala:120-137) is a keyed, owner-only, symlink-refusing directory that the kanon plugin does not use, because it is stable rather than fresh. A keyed-and-cleared variant would let a caller's staging area take its ownership and symlink guarantees. --- **Type:** feature **Filed from:** `/home/mph/ops/kanon-DEVDOCS-246` on branch `DEVDOCS-246`
Member

Intake: needs-human
Workflow: waterfall
Reason: G1 — a CLARIFY marker stands: the benefit the issue names does not hold (the staging area already has the ownership guarantee), so the choice between (a) key on issue id, (b) close the issue, (c) key plus lock is yours
Analysis: project-management/issues/IW-551/analysis.md on branch IW-551

Intake: needs-human Workflow: waterfall Reason: G1 — a CLARIFY marker stands: the benefit the issue names does not hold (the staging area already has the ownership guarantee), so the choice between (a) key on issue id, (b) close the issue, (c) key plus lock is yours Analysis: project-management/issues/IW-551/analysis.md on branch IW-551
Member

Intake: needs-input
Workflow: waterfall
Reason: G1 (1 CLARIFY marker)
Analysis: project-management/issues/IW-551/analysis.md on branch IW-551

  1. [G1] The issue says a keyed-and-cleared scratchDir "would let a caller's staging area take its ownership and symlink guarantees". The analysis found this does not hold for kanon's staging area: os.temp.dir(prefix) already creates the directory rwx------ under an unguessable SecureRandom name, and the symlink guard is needed only for a guessable path. What is left is a stable, inspectable path with bounded growth — one directory per key instead of /tmp/transcript-analyze-* directories that stay after a run (deleteOnExit cannot remove a non-empty directory, and a run leaves seven files in it). That benefit needs a stable key, and a stable key lets two concurrent analyses of one issue clear each other's directory. What should IW-551 build? Options: a) key on the issue id: a stable path and bounded growth; concurrent runs on one issue clobber each other, loudly (the analysis-result.json guard fires); the analysis is buildable as it is, 3-4 h b) do not build it: key on issue id + session id is os.temp.dir with extra steps, so keep kanon's StagingArea and close IW-551 with this reason c) key on the issue id and add a lock: no clobbering, but stale-lock recovery and a timeout policy make it a larger issue that needs a new estimate Recommended: a)

Answer in a comment on this issue; intake reads it on its next iteration.

Intake: needs-input Workflow: waterfall Reason: G1 (1 CLARIFY marker) Analysis: project-management/issues/IW-551/analysis.md on branch IW-551 1. [G1] The issue says a keyed-and-cleared `scratchDir` "would let a caller's staging area take its ownership and symlink guarantees". The analysis found this does not hold for kanon's staging area: `os.temp.dir(prefix)` already creates the directory `rwx------` under an unguessable `SecureRandom` name, and the symlink guard is needed only for a guessable path. What is left is a stable, inspectable path with bounded growth — one directory per key instead of `/tmp/transcript-analyze-*` directories that stay after a run (`deleteOnExit` cannot remove a non-empty directory, and a run leaves seven files in it). That benefit needs a stable key, and a stable key lets two concurrent analyses of one issue clear each other's directory. What should IW-551 build? Options: a) key on the issue id: a stable path and bounded growth; concurrent runs on one issue clobber each other, loudly (the `analysis-result.json` guard fires); the analysis is buildable as it is, 3-4 h b) do not build it: key on issue id + session id is `os.temp.dir` with extra steps, so keep kanon's `StagingArea` and close IW-551 with this reason c) key on the issue id and add a lock: no clobbering, but stale-lock recovery and a timeout policy make it a larger issue that needs a new estimate Recommended: a) Answer in a comment on this issue; intake reads it on its next iteration.
Author
Owner

1: a

1: a
Member

Intake: needs-human
Workflow: waterfall
Reason: the task brief returned no Phases line — wf-create-tasks stops because the issue folder has no issue.md; the answer "1: a" is applied and the re-review found 0 blocking findings (see the first note under Review Notes: a concurrent clobber in kanon is silent, not loud)
Analysis: project-management/issues/IW-551/analysis.md on branch IW-551

Intake: needs-human Workflow: waterfall Reason: the task brief returned no Phases line — wf-create-tasks stops because the issue folder has no issue.md; the answer "1: a" is applied and the re-review found 0 blocking findings (see the first note under Review Notes: a concurrent clobber in kanon is silent, not loud) Analysis: project-management/issues/IW-551/analysis.md on branch IW-551
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
iterative-works/iw-cli#551
No description provided.