Skip to content

Harden unsafe unwraps, validate temporal bounds, and refresh README#47

Open
christopherkarani wants to merge 1 commit intomainfrom
codex/conduct-comprehensive-swift-framework-audit-5a4ke9
Open

Harden unsafe unwraps, validate temporal bounds, and refresh README#47
christopherkarani wants to merge 1 commit intomainfrom
codex/conduct-comprehensive-swift-framework-audit-5a4ke9

Conversation

@christopherkarani
Copy link
Owner

Motivation

  • Remove risky force-unwraps and fragile runtime paths that can crash in edge conditions (GPU pipeline setup, generated CoreML wrapper, and temporal validation).
  • Improve developer onboarding and first-run experience by surfacing a compact, actionable README quick-start.

Description

  • Replaced a force-unwrapped raw pointer copy in MetalVectorEngine.search with a guarded withUnsafeBytes unwrap and removed a forced pipeline unwrap by selecting the active pipeline with explicit optional binding in Sources/WaxVectorSearch/MetalVectorEngine.swift.
  • Replaced guard ... toMs! > ... style checks with safe if let validations for valid.toMs and system.toMs in Sources/WaxTextSearch/FTS5SearchEngine.swift to avoid force-unwrapping temporal bounds.
  • Hardened generated CoreML wrapper Sources/WaxVectorSearchMiniLM/CoreML/all-MiniLM-L6-v2.swift by guarding the model output lookup and bundle URL lookup and emitting clear fatalError messages instead of force-unwrapping optional values.
  • Rewrote and trimmed the top-level README.md to present a one-line purpose, a visible quick-start example, SPM install snippet, clear capability list, and when-to-use guidance for production onboarding.

Testing

  • Attempted swift test --filter WaxCoreTests --filter WaxIntegrationTests/READMEExamplesTests, but the invocation failed early due to an existing package manifest issue: error: 'wax': invalid custom path 'Tests/WaxTests' for target 'waxTests' (this is a pre-existing project config problem and blocked running the full test suite).
  • Per-file static safety checks were performed (grep/inspection) on the modified files to confirm the removed force-unwrap patterns; those checks passed for the updated files.
  • Changes were committed locally: the patch includes edits to MetalVectorEngine.swift, FTS5SearchEngine.swift, all-MiniLM-L6-v2.swift, and README.md.

Codex Task

@christopherkarani
Copy link
Owner Author

@codex review and fix
@claude review and fix

@chatgpt-codex-connector
Copy link

To use Codex here, create an environment for this repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant