Skip to content

fix(scripts): protect latency CSV from cache path collisions - #368

Closed
skyc1e wants to merge 1 commit into
circlefin:mainfrom
skyc1e:fix/protect-latency-report-csv
Closed

skyc1e wants to merge 1 commit into
circlefin:mainfrom
skyc1e:fix/protect-latency-report-csv

Conversation

@skyc1e

@skyc1e skyc1e commented Sep 7, 2026

Copy link
Copy Markdown

Passing the same file to --csv and --db with --rebuild-db deletes the source before reading it. With a valid header-only CSV, the command even exits successfully after replacing the input with a SQLite database.

Reject matching file identities before opening the cache or rebuilding it, including relative paths, symlinks, and hardlinks. The CLI now reports --csv and --db must refer to different files, exits with status 1, and leaves the source unchanged. Normal reporting with a separate cache is preserved.

Validation:

  • cd scripts && python -m unittest test_tx_latency_report -q: 54 tests, successful with one symlink subtest skipped because Windows requires additional privileges. The hardlink case passes.
  • Added seven regression/success tests; the rejection cases fail against the original script.
  • Confirmed the real CLI changes from exit 0 with overwritten input to exit 1 with identical source bytes, using a temporary CSV.
  • git diff --check passes. Tested with Python 3.12.14; Rust/node integration tests were not run for this Python-only change.

@ZhiyuCircle

Copy link
Copy Markdown
Contributor

Hi @skyc1e,

Thank you for your interest in contributing to Arc Node, and apologies for the delay in getting back to this PR.

We're closing out the pull request backlog that predates our current contribution policy. This PR is being closed because it does not reference a GitHub issue. All PRs must reference an existing issue using the format Closes: #XXX, and the author must be assigned to that issue before the PR is opened.

This is not a judgement on the change itself. If you'd still like to land it:

  1. Open an issue describing the problem, or find the existing one
  2. Comment on the issue requesting assignment, and wait for maintainer approval
  3. Open a fresh PR once you have been assigned

Please see CONTRIBUTING.md for details. Thanks again for taking the time to contribute.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants