Skip to content

fix: unit tests failing on the macOS test gate (autocomplete, password command, MCP)#1587

Merged
datlechin merged 3 commits into
mainfrom
fix/macos-test-gate-failures
Jun 5, 2026
Merged

fix: unit tests failing on the macOS test gate (autocomplete, password command, MCP)#1587
datlechin merged 3 commits into
mainfrom
fix/macos-test-gate-failures

Conversation

@datlechin
Copy link
Copy Markdown
Member

The macOS test gate had four failing assertions across three suites. None of them are in code the open Snowflake PR (#1580) touches, so they were already red on main and turned the gate red on every PR. Each fix is in source, not the tests.

Fixes

fix(editor): quoted schema in qualified table references
The table-reference regex matched an optional quote, then [\w.]+, then an optional quote. For FROM "sales".orders the opening quote was consumed first, the character class stopped at the closing quote, and .orders was dropped, so the analyzer recorded a table named sales. The capture now matches optionally-quoted dotted segments and strips quotes per segment for both the table and the schema.
Fixes SQLContextAnalyzerTests.testSchemaSegmentQuotingStripped.

fix(connections): full output of a fast password command
resolveCommand read stdout through a readabilityHandler and stopped at waitUntilExit. For a small, fast command the only chunk could arrive after the handler was removed, so the password came back empty (.emptyPassword). It now drains the remaining stdout and stderr after the process exits, the same pattern used elsewhere in the app.
Fixes PasswordSourceResolverTests.commandPreservesSpaces.

fix(mcp): cancellation and progress before the connection lookup
ToolConnectionMetadata.resolve ran before the cancellation check and the first progress emit, so a request that was already cancelled returned invalidParams and no progress notification fired. The early cancellation check and the initial progress emit now run before the connection is resolved.
Fixes ExecuteQueryToolTests.cancellationPropagates and progressEmittedWhenTokenPresent.

Verification

xcodebuild test on the three suites: ** TEST SUCCEEDED **, 322 cases, 0 failures, 0 recorded issues. swiftlint lint --strict on the changed files: clean.

The autocomplete fix folds into the unreleased #1581 entry, so it has no separate changelog line; the other two are added under Fixed.

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: d0248fc7d3

ℹ️ 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 on lines +133 to +135
let remainingStdout = stdoutPipe.fileHandleForReading.readDataToEndOfFile()
if !remainingStdout.isEmpty { stdoutCollector.append(remainingStdout) }
let remainingStderr = stderrPipe.fileHandleForReading.readDataToEndOfFile()
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 Avoid blocking on inherited pipes after command exit

When a password command starts a background child that inherits stdout or stderr (for example printf secret; sleep 999 &), waitUntilExit() returns for the shell and the timeout task is cancelled, but these readDataToEndOfFile() calls wait for EOF from every remaining pipe writer. In that scenario the resolver hangs indefinitely instead of returning the captured password or timing out, so command-based passwords can block connection attempts.

Useful? React with 👍 / 👎.

@datlechin datlechin merged commit 08bef0b into main Jun 5, 2026
4 checks passed
@datlechin datlechin deleted the fix/macos-test-gate-failures branch June 5, 2026 05:41
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.

1 participant