Tmp dirs & cross-device issues #6

Closed
opened 2026-05-27 12:40:36 +00:00 by erik · 3 comments
Owner

If we're using something like mktemp for the dir to write tmp files, then there could be cross-device penalties to pay. Consider using a tmp dir inside the dropbear managed directory.

If we're using something like `mktemp` for the dir to write tmp files, then there could be cross-device penalties to pay. Consider using a tmp dir inside the dropbear managed directory.
Member

Brief — Developer

Phase: simple. Run fjx dev prompt simple for the cycle protocol.

<!-- pm:brief:dev --> # Brief — Developer **Phase:** simple. Run `fjx dev prompt simple` for the cycle protocol.
Member

Ledger for: agent-pm

Status: closed @ 2026-06-27T00:06:23.998Z
Briefs:

Activity

  1. i6/closed : applied

(PM manages this ledger; agent section unused)

<!-- agent-pm:ledger --> ## Ledger for: agent-pm Status: closed @ 2026-06-27T00:06:23.998Z Briefs: - [dev](#issuecomment-2311) ### Activity 1. i6/closed : applied --- _(PM manages this ledger; agent section unused)_
Member

Ledger for: agent-dev

Status: review @ 2026-06-26T23:48:10.019Z
Refs: #18


Investigation

Issue asks: avoid mktemp/system temp for staged writes (cross-device rename penalty); stage temp files inside the dropbear-managed directory instead.

Audited every non-test atomic-rename temp-file writer:

  • internal/blobio/tempdir.goNewRunTempDir stages under <root>/.dropbear/restore-tmp/run-*; downloads rename to <root>/<path> (same filesystem). Used by upload-side downloads and internal/restore/run.go.
  • internal/blobio/download.goos.CreateTemp(tempDir, "blob-*") → rename to finalPath, both under the same root.
  • internal/config/writer.go — temp sibling in the destination dir → rename to root.toml.
  • internal/statusapi/runtime.goos.CreateTemp(filepath.Dir(path), …) → rename in place.
  • internal/daemoninstall/install.goos.CreateTemp(filepath.Dir(path), …) → rename in place.

No code path uses os.TempDir() / system mktemp for staged writes. The issue's recommendation is already fully implemented; there is no code change to make.

Deliverable

Recorded the invariant as a decision record so the concern doesn't recur. Docs-only change.

  • e5ea8af — add wiki/decisions/temp-staging-in-managed-dir.md (invariant + call sites) and cross-link from dropbear-dir-per-root.md.

just validate skipped per the brief (docs-only, no code changed).

<!-- agent-dev:ledger --> ## Ledger for: agent-dev Status: review @ 2026-06-26T23:48:10.019Z Refs: #18 --- ## Investigation Issue asks: avoid `mktemp`/system temp for staged writes (cross-device rename penalty); stage temp files inside the dropbear-managed directory instead. Audited every non-test atomic-rename temp-file writer: - `internal/blobio/tempdir.go` — `NewRunTempDir` stages under `<root>/.dropbear/restore-tmp/run-*`; downloads rename to `<root>/<path>` (same filesystem). Used by upload-side downloads and `internal/restore/run.go`. - `internal/blobio/download.go` — `os.CreateTemp(tempDir, "blob-*")` → rename to `finalPath`, both under the same root. - `internal/config/writer.go` — temp sibling in the destination `dir` → rename to `root.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 code path uses `os.TempDir()` / system `mktemp` for staged writes. The issue's recommendation is **already fully implemented**; there is no code change to make. ## Deliverable Recorded the invariant as a decision record so the concern doesn't recur. Docs-only change. - `e5ea8af` — add `wiki/decisions/temp-staging-in-managed-dir.md` (invariant + call sites) and cross-link from `dropbear-dir-per-root.md`. `just validate` skipped per the brief (docs-only, no code changed).
agent-dev removed their assignment 2026-06-26 23:48:19 +00:00
Sign in to join this conversation.
No description provided.