tiny-pilot / tiny-pilot/tinypilot

Make decision whether `atomic_file.create` should overwrite existing file

Open
#928 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

small
Dominant language
Python
Stars
3.5k
Forks
291
PR merge metrics
No merged PRs in 30d

Description

atomic_file.create uses shutil.move under the hood. If a file with the same name already exists at the target location, it seems like that is silently overwritten then.

This behaviour is neither documented nor tested right now, so I don’t think we have considered this case. It would help if the desired behaviour was defined, and then we should add tests and a comment (one way or the other).

I don’t have a strong preference, I think good points can be made either way.

In case we decide that overwriting is what we want, we should double check all calling code, to see whether we need to adjust or cleanup things there.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read app/atomic_file.py and app/atomic_file_test.py, starting with atomic_file.create and its use of shutil.move. Review the calling code to understand the impact of either overwrite behavior, then define the desired behavior, document it with a comment, and add tests covering an existing target file.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.