refactor(plugins): move SSL classifiers into PluginKit and drop the test mirror#1744
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Each plugin's
classifySSLError(maps a driver's raw TLS error string to anSSLHandshakeError) was duplicated by hand inTableProTests/PluginTestSources/PluginSSLClassifiers.swift, because registry-only plugin code is not compiled into theTableProTeststarget. The real function and its mirror had to be kept byte-identical or the tests would pass while the shipped logic differed. The mirror had already drifted (FreeTDS returned a different type in the mirror than in the plugin, and Cassandra's real classifier was not mirrored at all).This applies the same pattern as #1740 (
OracleChannelFatalCode) to all eight plugin SSL/TLS classifiers.Change
Extracted the pure classification logic into shared public types and pointed each plugin at it:
LibPQSSLClassifier,MariaDBSSLClassifier(holdssslOnlyErrorCodes+classifySSLError(code:message:)),MongoDBSSLClassifier,RedisSSLClassifier,OracleSSLClassifier,ClickHouseSSLClassifier,CassandraClientKeyClassifier. Tested inPluginSSLClassifierTestsviaimport TableProPluginKit.MSSQLTLSClassifier. MSSQL's classifier returnsMSSQLTLSFailureKind(which lives in that module, not in PluginKit), so it lives with the enum and is tested by the package's ownTableProMSSQLCoreTests.classifySSLError(rc:message:)stays in the plugin (it depends on the CCassErrortype); only its pure client-key logic moved.Deleted the 191-line mirror
PluginSSLClassifiers.swiftand retargeted the tests at the real public types. Logic moved verbatim, so behavior is unchanged.Adding new public types to PluginKit is additive ABI: no
currentPluginKitVersionbump.Verification
PluginSSLClassifierTests(7 plugin suites): all pass.TableProMSSQLCoreTestsMSSQL TLS suite: 6/6 pass.