Skip to content

fix: write case source-check reports atomically - #665

Merged
LunaStev merged 2 commits into
wavefnd:masterfrom
hizlidepoo:oss/l2/640-atomic-case-source-report
Sep 16, 2026
Merged

LunaStev merged 2 commits into
wavefnd:masterfrom
hizlidepoo:oss/l2/640-atomic-case-source-report

Conversation

@hizlidepoo

Copy link
Copy Markdown
Contributor

Fixes #640.

Summary

  • write each source-check report checkpoint to a unique temporary file in the report directory
  • atomically replace the destination only after the complete JSON has been written
  • clean up temporary files after write or replace failures
  • use the same atomic path for manifest-load failure reports
  • add focused success, write-failure, and replace-failure regression coverage

Verification

  • PYTHONPATH=. python3 tools/test_check_case_sources.py: PASS — 7 tests
  • python3 -m py_compile tools/check_case_sources.py tools/test_check_case_sources.py: PASS
  • git diff --check: PASS

Exact upstream base: 451cc7a47a1220d44ebe292f2c64ec84e55dc3e3.
Exact head: 33f1cf7dd78ecbca1e4a0bc88c8c3d724fcdbb11.

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

Copy link
Copy Markdown

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: 33f1cf7dd7

ℹ️ 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 tools/check_case_sources.py Outdated
fd, temp_name = tempfile.mkstemp(prefix=f".{report.name}.", suffix=".tmp", dir=report.parent)
temp_path = Path(temp_name)
try:
with os.fdopen(fd, "w", encoding="utf-8") as stream:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Close the descriptor when fdopen rejects it

When os.fdopen raises—as the new write-failure test explicitly forces—ownership of fd has not transferred, so the raw descriptor remains open. On Windows, that open handle prevents the finally block from unlinking the temporary file, causing a PermissionError that masks the expected "write failed" exception and fails the Windows AMD64 and ARM64 unittest steps in .github/workflows/rust.yml. Close fd on the fdopen failure path before attempting cleanup.

Useful? React with 👍 / 👎.

@LunaStev
LunaStev merged commit 1b14230 into wavefnd:master Sep 16, 2026
22 of 26 checks passed

@LunaStev LunaStev left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM thanks

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.

Write case source-check reports atomically

2 participants