Repository navigation
Fix flaky Windows test: lost log file entries when something logs after deactivation - #2339
Open
louis-johnston-db wants to merge 1 commit into
Open
louis-johnston-db wants to merge 1 commit into
louis-johnston-db wants to merge 1 commit into
Conversation
…er deactivation JsonFileSink.write now skips entries once its stream has ended. A write after end() raised ERR_STREAM_WRITE_AFTER_END, and the fs.WriteStream's autoDestroy then dropped every entry still buffered. Unity Gateway's auto sign-in logs a warning after deactivation, so on Windows, where the file opens and requests run slower, the line the test waits for was lost. Same fix as attempt 1, reshaped so the diff no longer ends on a whitespace-only context line, which the controller's copy of the patch had trimmed (the corrupt patch at line 44). <!-- vscode-factory:item=winflake:8da8201393.3 --> Co-authored-by: Isaac <no-reply@databricks.com>
louis-johnston-db
temporarily deployed
to
test-trigger-is
November 22, 2026 17:58 — with
GitHub Actions
Inactive
louis-johnston-db
temporarily deployed
to
test-trigger-is
November 22, 2026 17:58 — with
GitHub Actions
Inactive
louis-johnston-db
temporarily deployed
to
test-trigger-is
November 22, 2026 17:59 — with
GitHub Actions
Inactive
This branch was previously deployed
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.
Changes
JsonFileSink.write(src/platform/log.ts) skips an entry once the stream has ended (writableEnded). A write afterend()makes Node destroy the stream, which drops the entries it hasn't flushed yet. Something can log after deactivation: Unity Gateway's auto sign-in logs a warning when deactivation stops the profile load. When the log file was slow to open, the end of the log was lost. That is what madeextension.test.ts > activate > writes the profile's token nowheretime out waiting for the log line on Windows. Users lost the end of their log file the same way.src/platform/log.test.ts: an entry still buffered when the sink is disposed reaches the file even when something logs after dispose.This is a production change: the race is in the product (late writes after deactivation), not in the test.
Production change: The race is in the product: JsonFileSink wrote to its stream after dispose() had ended it, and Node then destroyed the stream and dropped the entries it hadn't flushed yet. Anything that logs after deactivation (here, Unity Gateway's auto sign-in failing because the profile load was stopped) cost users the end of their log file. The guard skips only entries logged after the sink ended, which could never have been written.
Tests
yarn vitest run src/platform/log.test.ts src/extension.test.tsinpackages/databricks-vscode: passes.log.test.tstest fails without the guard (the buffered entry is lost) and passes with it.writes the profile's token nowherefailed before the fix and passes with it.yarn oxfmtandyarn oxlint --deny-warningson the changed files: clean.Evidence (the factory's checks):
test-windowsruns on release/3.x and its pull requests, with Linuxtestpassing in the same runs; last seen 2026-11-17. Runs: 44049025596.src/extension.repro.test.ts): failed 24 of 30 runs without the fix, 0 of 30 with it.yarn workspace databricks test: 3118 passed, 0 failed.yarn check: passed.This pull request and its description were written by Isaac.