Skip to content

Replace NamedTempFile::persist with more explicit file creation method #61

Description

@coderabbitai

The current implementation in tests/steps/process_steps.rs (line 70) uses NamedTempFile::persist() which overwrites existing files without explicit control.

Current code:

file.persist(&manifest_path)
    .expect("Failed to persist manifest file");

Suggested alternatives:

  • Use fs::write for explicit file writing
  • Use NamedTempFile::persist_noclobber to avoid accidental overwrites

This change would provide more explicit control over file creation behavior and prevent unintended file overwrites.

Backlinks:

Requested by: @leynos

Rescope (2026-08-12)

The originally cited file tests/steps/process_steps.rs no longer exists. The sole remaining NamedTempFile::persist call is test_support/src/manifest.rs:103, which already treats ErrorKind::AlreadyExists as success rather than clobbering, so the original overwrite hazard is substantially mitigated. Remaining scope: adopt explicit no-clobber semantics at that call site, which is what PR #545 delivers. This issue closes with #545.

Metadata

Metadata

Assignees

Labels

lowBacklog work, hygiene, or technical debt planned opportunistically, without a strict deadline.refactorBehaviour-preserving restructuring that improves code health.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions