Skip to content

fix: skip orphan .find-replace-* temp files during walks#97

Open
leno23 wants to merge 2 commits into
dolph:mainfrom
leno23:fix/skip-stale-temp-files-issue-21-v2
Open

fix: skip orphan .find-replace-* temp files during walks#97
leno23 wants to merge 2 commits into
dolph:mainfrom
leno23:fix/skip-stale-temp-files-issue-21-v2

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 31, 2026

Summary

  • Skip .find-replace-* entries during directory walks and in HandleFile
  • Prevents stale temp files from crashed runs being rewritten on the next invocation

Notes

Test plan

  • go test -run SkipStale ./...

Fixes #21

Made with Cursor

leno23 added 2 commits May 30, 2026 13:19
Create temp files with the .find-replace-* prefix via os.CreateTemp so
names are unpredictable and not vulnerable to symlink planting attacks.

Fixes dolph#3
Ignore stale temp files left by crashed runs so a subsequent traversal
does not rewrite or rename them. Requires the .find-replace-* temp
prefix from the safe tempfile change.

Fixes dolph#21
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 489e0101bb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread find_replace.go
Comment on lines +127 to +128
if strings.HasPrefix(file.Name(), ".find-replace-") {
continue
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve traversal of matching user directories

This skips every entry whose name starts with .find-replace- before checking whether it is a stale temp file or a directory. The temp files introduced here are created with os.CreateTemp, so orphaned entries from this tool are regular files; a real directory such as .find-replace-config/ will now be omitted entirely and none of its contents or child names will be processed, even though the CLI only documents skipping .git/ and binary files.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stale .find-replace-* temp files from crashed runs are not skipped on re-run

1 participant