Repository navigation
[PR] fix(diagnostics): preserve colliding incident dumps - #7400
Merged
ranxianglei merged 1 commit intoNov 20, 2026
Merged
ranxianglei merged 1 commit into
ranxianglei merged 1 commit into
Conversation
Create incident files exclusively so repeated same-millisecond failures, sanitized session-name collisions, and existing files cannot lose earlier evidence. Keep the historical filename when available; on EEXIST use a bounded session hint and a UUID suffix, again with exclusive creation. Use the same writer for main and preflight-summary failures. Other I/O errors retain the existing fail-soft warning/null behavior. The plaintext banner, byte limits and protected GC prefixes are unchanged. Seven regression failures on the unchanged base become passing, alongside the write-error control and existing dump/GC coverage (30 tests total). Typecheck, build, unused-export and import-graph gates pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7399
Problem
Main-path and preflight-summary incident files use only
Date.now(), the sanitized session ID and status as their name. An ordinarywriteFileSyncthen overwrites the earlier incident when those values collide. This loses evidence even thougherr-*andsummary-err-*files are explicitly protected from retention GC.Changes
Both incident writers share exclusive file creation. The historical filename is retained when available; only
EEXISTselects a fresh UUID-suffixed path, with the descriptive session portion bounded so the suffix fits. The fallback is also exclusive: an already-existing file is never replaced.Other I/O failures keep the existing warning/null behavior. The plaintext warning, UTF-8 byte caps, payload formatting, GC prefixes and default-off option are unchanged. No config field, environment variable or dependency is added. This is a file-ownership fix, not a claim of fsync-backed or whole-file atomic persistence.
Validation
On unchanged production, the new suite has 7 failing behavior regressions and 1 passing error control. The fix passes 30/30 targeted tests:
The regressions use actual files and public writers: repeated main bodies and summary exchanges, pre-existing incidents, sanitized session-name collisions, a 32-write same-timestamp burst, and a 200-character session ID. A controlled non-collision write error proves it returns without repeated attempts. Existing byte-cap/banner/GC tests remain unchanged.
Tested base:
1e357bf2d6632bfbd2a74ffb70ecee1af1ec7cc3; Node.js 24.22.3, Linux x86_64. Full regression remains the remote CI lanes on the pushed PR head.Duplicate boundary
All-author/all-state searches and the latest 100 actual open PRs found no equivalent repair. #1994 distinguished main and summary prefixes, #4299 fixed the final byte cap, and #4483 added the plaintext warning. This change preserves those behaviors while preventing same-kind incidents from replacing one another.