Skip to content

Conversation

@nebooz
Copy link

@nebooz nebooz commented Feb 12, 2026

Summary

  • The grepWarningsAndErrors regex in build-utils.ts matched any line containing error: or warning:, producing false positives when xcodebuild echoes Swift source lines during compilation (e.g. var authError: Error?, private(set) var error: WalletError?)
  • Tightened both regexes to only match real xcodebuild diagnostic formats:
    • Standalone: error: msg, warning: msg, fatal error: msg
    • File-located: /path/File.swift:42:10: error: msg
    • Tool-prefixed: ld: warning: msg, clang: error: msg

Motivation

When building a Swift project containing variables or properties with names like authError, loadError, lastError, or type annotations like var error: WalletError?, the build output would incorrectly flag these echoed source lines as errors or warnings. This cluttered the build results with spurious diagnostics.

Changes

src/utils/build-utils.ts — 2-line regex change + 3-line comment:

-        if (/warning:/i.test(content)) return { type: 'warning', content };
-        if (/error:/i.test(content)) return { type: 'error', content };
+        if (/(?:^(?:\w+:\s+)?|:\d+:\s+)warning:\s/i.test(content)) return { type: 'warning', content };
+        if (/(?:^(?:\w+:\s+)?|:\d+:\s+)(?:fatal )?error:\s/i.test(content)) return { type: 'error', content };

The pattern handles three diagnostic formats:

  • ^ — standalone at line start (error: build failed, fatal error: too many errors)
  • ^\w+:\s+ — tool-prefixed (ld: warning: ..., clang: error: ...)
  • :\d+:\s+ — file-located (/path/File.swift:42:10: error: ...)

The error regex also includes (?:fatal )? to match clang's fatal error: diagnostic level.

src/utils/__tests__/build-utils-suppress-warnings.test.ts — 2 new tests:

  • False positive prevention: var authError: Error?, var error: WalletError?, fatalError("crash"), etc.
  • Diagnostic format regression: standalone, file-located, tool-prefixed, and fatal error: variants

Test plan

  • All 19 tests pass (4 suppress-warnings + 15 build-utils)
  • Source lines like var authError: Error? are NOT flagged
  • fatalError("crash") is NOT flagged
  • All 8 diagnostic format variants matched:
    • error: build failed, warning: deprecated API (standalone)
    • /path:42:10: error: ..., /path:15:5: warning: ... (file-located)
    • ld: warning: directory not found, clang: error: linker command failed (tool-prefixed)
    • fatal error: too many errors, /path:1:9: fatal error: 'Header.h' not found (fatal error)
  • ESLint clean on changed files

🤖 Generated with Claude Code

@nebooz nebooz force-pushed the fix/false-positive-error-grep branch from 59c6d86 to ecf49be Compare February 12, 2026 01:17
@nebooz nebooz force-pushed the fix/false-positive-error-grep branch from ecf49be to bd4dfad Compare February 12, 2026 01:33
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@nebooz nebooz force-pushed the fix/false-positive-error-grep branch from bd4dfad to 3f4a4dd Compare February 12, 2026 02:03
…code

The `grepWarningsAndErrors` regex matched any line containing `error:` or
`warning:`, which produced false positives when xcodebuild echoes Swift
source lines during compilation (e.g. `var authError: Error?`,
`private(set) var error: WalletError?`).

Tighten the regex to require `error:`/`warning:` at the start of the line
or after a file:line:col location prefix (`:<digits>: `), matching only
real xcodebuild diagnostic output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nebooz nebooz force-pushed the fix/false-positive-error-grep branch from 3f4a4dd to 2dceacb Compare February 13, 2026 00:48
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