Skip to content

Modernize Swift assertion behavior and optional helper APIs - #25

Open
jjamminjim wants to merge 16 commits into
alignops:masterfrom
jjamminjim:codex/dbc-modernization-pass
Open

Modernize Swift assertion behavior and optional helper APIs#25
jjamminjim wants to merge 16 commits into
alignops:masterfrom
jjamminjim:codex/dbc-modernization-pass

Conversation

@jjamminjim

Copy link
Copy Markdown
Contributor

Summary

This PR modernizes the Swift-side debugging and assertion utilities while preserving the package vocabulary and the existing Objective-C bridge surface.

What Changed

  • made inform and informIf active in all build configurations and added a swappable DBCLogger protocol with DBCDebugPrintLogger as the default implementation
  • updated check, ensure, and related failure helpers so release builds log through inform, while debug builds retain the existing assertion behavior and fallback logging when intensity suppresses a debug assertion
  • simplified the default Swift Assertions closures to delegate directly to Swift assertion primitives instead of raising NSException first
  • introduced DBCOptionalError for the throwing Optional helpers, improved Objective-C NSError bridging metadata, and tightened error/log formatting
  • centralized mutable Swift configuration behind locked storage to remove obvious data races without changing the public API shape
  • refreshed README/API docs, contributor guidance, and regression coverage across Swift, Objective-C, and bridged test targets

Behavior Notes

  • default Swift assertion failures are now reported as Swift runtime traps/preconditions unless consumers override Assertions.*
  • performIfDBCIntensity, inform, and informIf now honor intensity in all builds rather than compiling out in release
  • check and ensure still surface failures through inform when debug assertions are suppressed by intensity

Testing

  • swift test
  • swift test -c release
  • targeted regression runs during review, including:
    • swift test --filter SwiftDBCTests
    • swift test --filter SwiftDBCBridgedTests
    • swift test --filter RequiredOptionalTests
    • swift test -c release --filter SwiftDBCTests
    • swift test -c release --filter RequiredOptionalTests

Notes

  • RequiredOptionalTests.swift still emits existing XCTest warnings about #fileID vs #filePath; that warning predates the PR finalization and was left out of scope for this change set.

@jjamminjim

Copy link
Copy Markdown
Contributor Author

@pjvea : Hope this finds you well. Let me know if you have any questions.

@pjvea pjvea left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great work! :)

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.

2 participants