Document temp-staging-in-managed-dir invariant (#6) #18
No reviewers
Labels
No labels
agent
blocked
agent
new
agent
review
agent
working
complexity
high
complexity
low
priority
high
priority
low
priority
medium
risk
high
risk
low
risk
medium
type
bug
type
chore
type
feature
type
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
tfks/dropbear!18
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "chore/tmp-dirs-managed-staging"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs: #6
What
Issue #6 raised that if staged writes use
mktemp/os.TempDir(), atomic renames into the synced tree could hit cross-device penalties, and suggested staging temp files inside the dropbear-managed directory instead.Audit finding: the codebase already does this everywhere. No code change is needed; this PR captures the invariant as a decision record so the concern doesn't recur.
Audit
Every non-test atomic-rename temp writer stages on the same filesystem as its destination:
internal/blobio/tempdir.go—NewRunTempDirstages synced content under<root>/.dropbear/restore-tmp/run-*; downloads rename to<root>/<path>. Used byinternal/upload/run.go(downloads/conflict copies) andinternal/restore/run.go.internal/blobio/download.go—os.CreateTemp(tempDir, "blob-*")→ rename tofinalPath, both under the same root.internal/config/writer.go— temp sibling in the destinationdir→ rename toroot.toml.internal/statusapi/runtime.go—os.CreateTemp(filepath.Dir(path), …)→ rename in place.internal/daemoninstall/install.go—os.CreateTemp(filepath.Dir(path), …)→ rename in place.No path uses the system temp dir for staged writes.
Change
wiki/decisions/temp-staging-in-managed-dir.mddocumenting the same-filesystem staging invariant and its call sites.wiki/decisions/dropbear-dir-per-root.md(the per-root.dropbear/placement is what makes same-filesystem staging structural).Docs-only —
just validateskipped (no code changed).