Skip to content

fix(ci): make the full test scheme honestly green - #6

Merged
kochj23 merged 1 commit into
mainfrom
fix/ci-green
Aug 18, 2026
Merged

fix(ci): make the full test scheme honestly green#6
kochj23 merged 1 commit into
mainfrom
fix/ci-green

Conversation

@kochj23

@kochj23 kochj23 commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

The new CI (.github/workflows/build.yml, xcodebuild test on the full MLX Code scheme) failed on pre-existing tests. This makes the scheme honestly green: 522 tests, 0 failures, 0 skips. Each failure was diagnosed and fixed on the correct side.

Real source bugs fixed

  • SecurityUtils.validateFilePath — ineffective length guard (security-relevant). The > 4096-byte check ran on the symlink-resolved path, but resolvingSymlinksInPath silently truncates to PATH_MAX (~1024 bytes), so an over-long path slipped through. Now validates the raw input length before resolution. (testExcessivelyLongPathRejected)
  • SecurityUtils.sanitizeHTML — order-dependent escaping. Entities were escaped by iterating an unordered Dictionary, so & was sometimes escaped after </>, double-escaping &lt; into &amp;lt;. Now an ordered array escapes & first. Fixes the intermittently-failing HTML-escape assertions. (testHTMLSanitization, testSanitizeHTMLEscapesScriptTags, testSanitizeHTMLEscapesQuotes)
  • ToolRegistry.parseToolCallJSON — JSON true became "1". JSONSerialization returns booleans as NSNumber, which matched the as? Int branch. Now detects CFBooleanGetTypeID first, yielding "true"/"false". (testValidJSONWithBooleanArg)
  • GitIntegrationTool registered under the wrong name. It registered as "git", but SystemPrompts and ToolTier advertise "git_integration", so model-emitted git tool calls never resolved. Renamed to "git_integration". (testToolRegistryDevToolsPresent)

Stale/insufficient tests corrected (code was right)

  • AppSettingsTests — default temperature expectation 0.70.2; the lowering was intentional (commit b0b95ac).
  • ContextManagerTests.testOptimizeContextIncludesSummary — fixture produced only ~16k tokens, under the 32k compaction budget, so no summary was ever emitted. Enlarged the fixture so compaction actually triggers.
  • MLXServiceTests — the test-local PythonResponse.type is now optional; the daemon's model-load success message omits type, which the test itself marks as "should decode". (No live daemon is involved — these are pure decode tests, so no XCTSkip was needed.)

Tests made hermetic

  • SecurityScanTests scanned a hardcoded /Volumes/Data/... path (present on the author's machine, absent on CI where it silently skipped). They now locate source via #filePath and match secret/unsafe-function keywords on whole words, eliminating false positives (listTargets(gets(, maxTokenstoken, credentialScanOnPushcredential). The one intentional non-secret — NovaAPIServer's local anti-CSRF random UUID — is annotated // nosec.

Verification

xcodebuild test -scheme "MLX Code" -destination 'platform=macOS'** TEST SUCCEEDED **, 522 tests, 0 failures, 0 skips.

🤖 Generated with Claude Code

Diagnose and fix all pre-existing failures from the new xcodebuild CI on
the "MLX Code" scheme (14 local failures / 11 on the GitHub runner). Fixes
split between real source bugs and stale/insufficient tests.

Source bugs fixed:
- SecurityUtils.validateFilePath: the >4096-byte length check ran on the
  symlink-resolved path, but resolvingSymlinksInPath silently truncates to
  PATH_MAX (~1024), so an over-long path passed validation. Now validate the
  raw input length before resolution. (Security-relevant.)
- SecurityUtils.sanitizeHTML: escaped entities from an unordered Dictionary,
  so "&" was sometimes escaped after "<"/">", double-escaping into "&amp;lt;".
  Now uses an ordered array with "&" first. (Fixes intermittent XSS-escape
  corruption.)
- ToolRegistry.parseToolCallJSON: JSON booleans (NSNumber-backed) matched the
  `as? Int` branch and stringified `true` -> "1". Now detect CFBoolean first.
- GitIntegrationTool registered as "git" while SystemPrompts and ToolTier
  advertise "git_integration", so the LLM's tool calls never resolved. Renamed
  to "git_integration".

Tests corrected (expectations were stale, code is right):
- AppSettingsTests temperature default 0.7 -> 0.2 (intentional in b0b95ac).
- ContextManagerTests.testOptimizeContextIncludesSummary generated too few
  tokens (~16k) to cross the 32k compaction budget; enlarged the fixture.
- MLXServiceTests PythonResponse.type made optional — the daemon's load-success
  message omits "type", which the test itself asserts should decode.

Tests made hermetic (were scanning a hardcoded /Volumes/Data path):
- SecurityScanTests now locate source via #filePath and match secret/unsafe-fn
  keywords on whole words, eliminating false positives (listTargets->gets(,
  maxTokens->token, credentialScanOnPush->credential). The one intentional
  non-secret (NovaAPIServer local anti-CSRF UUID) is annotated `// nosec`.

Result: 522 tests, 0 failures, 0 skips.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QrPsErCe9kBuRRPyDSA5cF
@kochj23
kochj23 merged commit ed9ea03 into main Aug 18, 2026
1 check passed
@kochj23
kochj23 deleted the fix/ci-green branch August 18, 2026 22:27
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