Add sdk and sdkVersion columns to audit logs#130
Conversation
Greptile SummaryThis PR adds two optional ClickHouse columns (
Confidence Score: 5/5The change is additive and backward-compatible — both columns are optional, existing call sites are unaffected, and the schema additions follow established conventions throughout the adapter. All three issues raised in the previous review pass have been resolved: the CHANGELOG now correctly distinguishes new-table creation from existing-table migration, the getters return No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "Address review: nullable sdk getters, LE..." | Re-trigger Greptile |
Summary
Adds two new optional columns to the ClickHouse audit logs table (Linear CLO-4553, audit half):
sdk— SDK name (e.g.web,flutter,console,cli). Low-cardinality, stored asLowCardinality(Nullable(String)), with a bloom-filter index_key_sdk.sdkVersion— SDK version (e.g.14.0.0). High-cardinality, stored as plainNullable(String)(no index, not added toLOW_CARDINALITY_COLUMNS).Both columns are optional (
required = false), socreateBatch()never throws when a caller omits them.Changes
src/Audit/Adapter/ClickHouse.phpgetAttributes(): appendsdkandsdkVersionattribute blocks afterhostname.LOW_CARDINALITY_COLUMNS: addsdkonly.getIndexes(): add_key_sdkbloom-filter index onsdk.src/Audit/Log.php: addgetSdk()andgetSdkVersion()string getters (empty-string fallback).tests/Audit/Adapter/ClickHouseTest.php: assertsdk/sdkVersionattributes and_key_sdkindex.CHANGELOG.md: new2.7.0section.getColumnDefinition()is unchanged — it derives the column type generically fromrequired+LOW_CARDINALITY_COLUMNSmembership, yieldingsdk LowCardinality(Nullable(String))andsdkVersion Nullable(String).Testing
composer lint(pint): passphpstan --level max: no errorsLoggetters).ClickHouseTestsuite requires a live ClickHouse server (itssetUp()connects), so those cases were not run in CI here.