Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1169

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176
10BC0 [2.x] Add backward compatibility for callback API changes by GLinnik21 · Pull Request #684 · kstenerud/KSCrash · GitHub
Nothing Special   »   [go: up one dir, main page]

Skip to content

Conversation

GLinnik21
Copy link
Collaborator
@GLinnik21 GLinnik21 commented Aug 17, 2025

Summary

This PR fixes the breaking changes from PR #676 by adding backward compatibility for the crash reporting callback APIs.

Background

PR #676 broke existing code by changing the callback signatures to include a policy parameter. Users upgrading would suddenly get compilation errors.

What I Changed

Brought back the original callbacks

  • Restored the old KSReportWriteCallback and KSReportWrittenCallback signatures
  • Added new versions with "WithPolicy" suffix for the enhanced functionality
  • Old code compiles and runs exactly like before

Added deprecation warnings

  • Marked all the legacy APIs as deprecated since v2.4.0
  • Added clear messages pointing to the replacement APIs

Made migration smooth

  • Built adapter functions that convert old callbacks to work with the new system
  • New callbacks take priority when both are set
  • Everything works internally regardless of which callback type you use

How to Migrate

Current code (still works, just shows warnings):

config.crashNotifyCallback = myCallback;
installation.>

Updated code:

config.crashNotifyCallbackWithPolicy = myPolicyAwareCallback;
installation.>

@GLinnik21 GLinnik21 changed the title Add backward compatibility for callback API changes from PR #676 Add backward compatibility for callback API changes Aug 17, 2025
@GLinnik21 GLinnik21 marked this pull request as draft August 17, 2025 21:46
* Swift/Objective-C methods!!!
*/
@property(atomic, readwrite, assign, nullable) KSReportWriteCallback onCrash;
@property(atomic, readwrite, assign, nullable) KSReportWriteCallback onCrash
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We had a type mismatch. The typedef KSReportWriteCallback was declared outside NS_ASSUME_NONNULL_BEGIN, making the writer parameter nullable. But in KSCrashConfiguration, the same callback was declared as void (^crashNotifyCallback)(const struct KSCrashReportWriter *writer) inside NS_ASSUME_NONNULL_BEGIN, making the writer parameter non-null by default. We have to restore that API as it blows up the compilation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We have to restore that as well, as nonNullable writer breaks the API as well

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually it's not good that a type from the underlying module that we consider "private API" is used in public API.

@GLinnik21 GLinnik21 marked this pull request as ready for review August 18, 2025 00:05
Copilot

This comment was marked as outdated.

@naftaly naftaly requested a review from Copilot August 18, 2025 00:19
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds backward compatibility for callback API changes introduced in PR #676 by restoring the original callback signatures while maintaining the enhanced functionality with new policy-aware callbacks.

  • Introduces new callback types with "WithPolicy" suffix that include policy parameter for async-safety awareness
  • Maintains legacy callbacks with deprecation warnings to prevent compilation breaks
  • Implements adapter functions to bridge old callbacks to the new system

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Tests/KSCrashRecordingTests/KSCrashConfiguration_Tests.m Updates test references to use new "WithPolicy" callback properties
Sources/KSCrashRecordingCore/include/KSCrashExceptionHandlingPolicy.h Adds CoreFoundation import and Swift naming for policy struct
Sources/KSCrashRecording/include/KSCrashReportWriterCallbacks.h New header defining policy-aware callback types
Sources/KSCrashRecording/include/KSCrashReportWriter.h Removes nullability annotations and adds deprecated legacy callback types
Sources/KSCrashRecording/include/KSCrashConfiguration.h Adds deprecated legacy callback properties alongside new policy-aware ones
Sources/KSCrashRecording/include/KSCrashCConfiguration.h Adds deprecated legacy callback fields in C configuration struct
Sources/KSCrashRecording/KSCrashReportC.h Updates function signature to use policy-aware callback
Sources/KSCrashRecording/KSCrashReportC.c Updates internal callback type to use policy-aware version
Sources/KSCrashRecording/KSCrashConfiguration.m Implements bridge logic for converting legacy callbacks to new system
Sources/KSCrashRecording/KSCrashC.c Implements adapter functions and callback selection logic for backward compatibility
Sources/KSCrashInstallations/include/KSCrashInstallation.h Adds deprecated legacy callback property alongside new policy-aware one
Sources/KSCrashInstallations/KSCrashInstallation.m Implements backward compatibility handling in installation callback logic
Samples/Common/Sources/LibraryBridge/InstallBridge.swift Updates sample code to use new policy-aware callback properties

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@kstenerud
Copy link
Owner

Hmm maybe we need a user-facing policy struct? We'd have to remember to keep it in sync with the internal one, though...

@GLinnik21 GLinnik21 changed the title Add backward compatibility for callback API changes [2.x] Add backward compatibility for callback API changes Aug 18, 2025
@GLinnik21
Copy link
Collaborator Author

Hmm maybe we need a user-facing policy struct? We'd have to remember to keep it in sync with the internal one, though...

Let’s do it in another PR. In this I just want to get project back on track

@GLinnik21 GLinnik21 force-pushed the gleb/saving-private-2.x branch from 2b4dc12 to 17605d7 Compare August 19, 2025 23:16
@GLinnik21
Copy link
Collaborator Author

I think I’ll set up this tool https://github.com/Adyen/adyen-swift-public-api-diff before the release, since I’m not fully confident that nothing got broken after multiple API changes across different PRs. It also comes with a convenient CI action. Hopefully it will work with our API as well. For now, I believe checking the Swift API should be enough, as it’s the most sensitive to all the nullability issues.

@GLinnik21 GLinnik21 merged commit 155fac6 into master Aug 23, 2025
27 checks passed
@GLinnik21 GLinnik21 deleted the gleb/saving-private-2.x branch August 23, 2025 09:33
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

0