Skip to content

Mission-critical audit: fix stale tests and safety gaps#31

Open
christopherkarani wants to merge 2 commits intomainfrom
codex/framework-audit-20260226
Open

Mission-critical audit: fix stale tests and safety gaps#31
christopherkarani wants to merge 2 commits intomainfrom
codex/framework-audit-20260226

Conversation

@christopherkarani
Copy link
Owner

Summary

This PR executes the framework audit remediation pass and fixes the highest-impact correctness/testing issues found during verification.

What was fixed

  1. Test suite wiring correctness (P0 for CI reliability)
  • Updated DiffusionModelDownloaderTests compile guard to match production availability:
    • CONDUIT_TRAIT_MLX && canImport(MLX) && (canImport(Hub) || canImport(HuggingFace))
  • This prevents the default traitless test target from compiling symbols that are intentionally unavailable.
  1. Deterministic JSON correctness for non-finite numbers
  • Added regression tests in GeneratedContentTests for:
    • finite numbers serializing as numeric JSON
    • non-finite numbers (NaN) serializing as null
  • Updated GeneratedContent.toJSONValue() to map non-finite Double values to NSNull instead of hitting JSON serialization failures and silently falling back to {}.
  1. Strict concurrency / Sendable warning fix
  • GenerationSchema internal EncodingError.invalidValue now uses String instead of Any, removing the non-Sendable associated-value warning source under strict concurrency.
  1. Deprecated API removal
  • Replaced deprecated String(cString:) usage in DeviceCapabilities with explicit null-terminated UTF-8 byte decoding.
  1. Stale registry/provider expectation fixes in tests
  • Updated XCTest expectations to reflect current provider/model surface area (including Kimi + MiniMax additions):
    • ModelIdentifierTests counts and cloud-provider assumptions
    • ProtocolCompilationTests ProviderType.allCases count and case coverage
  1. Documentation alignment
  • Updated ModelRegistry comments to match current model catalog composition and cloud-provider description.

Verification

  • swift build
  • swift test --filter GeneratedContentTests
  • swift test --filter ModelIdentifierTests
  • swift test --filter ProtocolCompilationTests
  • swift test
    • XCTest: 570 tests, 0 failures
    • Swift Testing: 354 tests, 0 failures

Notes

  • This PR intentionally does not include planning docs under tasks/ per repo rule.

- Gate DiffusionModelDownloader tests behind MLX trait + module conditions to match production availability

- Add GeneratedContent regression tests and map non-finite numeric values to JSON null instead of silently falling back to {}

- Remove strict-concurrency warning source in GenerationSchema by making EncodingError.invalidValue strongly typed

- Replace deprecated DeviceCapabilities C-string conversion with safe UTF-8 byte decoding

- Update ModelIdentifier/ProtocolCompilation XCTest expectations for current provider/model surface (Kimi + MiniMax additions)

- Refresh ModelRegistry docs to match actual catalog composition

Verification:

- swift build

- swift test --filter GeneratedContentTests

- swift test --filter ModelIdentifierTests

- swift test --filter ProtocolCompilationTests

- swift test (570 XCTest + 354 Swift Testing tests, all passing)
@christopherkarani
Copy link
Owner Author

@claude review

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