feat(LAB-4574): remove notification methods from the SDK - #2063
Draft
RuellePaul wants to merge 1 commit into
Draft
feat(LAB-4574): remove notification methods from the SDK#2063RuellePaul wants to merge 1 commit into
RuellePaul wants to merge 1 commit into
Conversation
The SDK exposed four notification methods that no customer workflow needs: `notifications` and `count_notifications` (documented, list/count a user's notifications) and `create_notification` / `update_properties_in_notification` (undocumented, Kili-admin only). All four are removed. This is a breaking change to the public client and lands in 26.3.0 with no deprecation window, taken knowingly: the backend team confirmed `createNotification` has no caller outside this repo, and the domain API (`kili.client_domain.Kili`) never exposed notifications. `notifications` was not dead code — `BaseBatchImporter.verify_batch_imported` polled it to confirm asynchronous imports (video, tiled and geospatial imagery). That poll now reads through `kili_api_gateway.list_notifications` directly, matching the three other direct gateway calls in the same file. It requests only `status` instead of six fields and disables the progress bar that was redrawn on every retry. The SDK still issues the `notifications` and `countNotifications` GraphQL queries for that poll, so neither may be retired backend-side. It no longer issues `createNotification` or `updatePropertiesInNotification`. Merge order: this repo ships before the backend deletes `createNotification`.
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.
Purpose: Remove all four notification methods from the SDK's public surface. Clean break in 26.3.0 — no deprecation window.
Paired MR:
kili!14393 — must merge AFTER this PR (see merge order below).Plan document: https://linear.app/kili-technology/document/lab-4574-aakd-i-dont-see-notifications-methods-on-the-sdk-e5786e4e3ed4
The ticket assumes all four operations are SDK-only cruft "not attached to any meaningful use case". A trace across the monorepo and every sibling service repo shows otherwise:
notificationscountNotificationsupdatePropertiesInNotificationexportandimportservices via raw GraphQL, not SDK callscreateNotificationRemoving a Python wrapper never breaks the backend, so all four wrappers go here regardless. But only
createNotificationcorresponds to a backend field disappearing — which is why merge order matters.What this removes
Deleted:
entrypoints/mutations/notification/(whole package),presentation/client/notification.py,use_cases/notification/,tests/integration/presentation/test_notification.py,docs/sdk/notification.md.Modified:
client.py(both base classes dropped),services/asset_import/base.py(rewired), the gateway'scount_notificationmethod,NotificationFiltertrimmed toid,core/enums.py(NotificationStatusremoved),mkdocs.ymlnav entry.The docs page and nav entry are what actually satisfy the ticket title, which is about discoverability.
THE
count_notificationQUESTION — verified, not assumed, and the answer splits in twocount_notificationhad no caller once the public methods went → deleted.GQL_COUNT_NOTIFICATIONSis required and kept —execute_query_from_paginated_callinvokesget_number_of_elements_to_queryunconditionally whenever a count query exists.Proven by running the poll against a real
KiliAPIGatewaywith only the transport faked, recording every operation sent:Both fire per poll attempt. Guessing either way would have been wrong.
GraphQL operations this SDK still issues — for the backend's deletion decision
STILL ISSUED (must NOT be retired):
notifications(where: {id}, selectingstatusonly) ·countNotifications(where: {id}, once per poll attempt)NO LONGER ISSUED:
createNotification·updatePropertiesInNotification· thehasBeenSeenanduserfields ofNotificationWhereThis PR ships BEFORE the backend deletes
createNotification. If the backend field goes first, any SDK version still calling it gets a client-side GraphQL validation error instead of today'saccessDenied. Both are failures so nothing working regresses, but SDK-first keeps the window clean.Post-review fixes (agent self-review)
verify_batch_imported— the existing tests patch the method out or mock the notification call wholesale, so a wrong filter, field set or options would still have passed. With no deprecation window that gap was unacceptable → addedtest_verify_batch_imported.py, which drives the real gateway and asserts the exact operations and variables.fields=("status","id")→ caught;NotificationFilter(id=None)→ caught;first=None→ not caught, and correctly so, because with a single-id lookup the count is 1 so pagination clamps the page size either way and the wire payload is identical.first=1is explicitness, not behaviour. Coverage is not claimed where it does not exist.IndexErrorsemantics preserved exactly —notifications(...)[0]on a materialised list becomeslist(gen)[0]; an empty result raises identically, andIndexErroris not in the retry predicate in either version.Verification
Baseline captured from a pristine tree before the first edit, compared as normalised sets:
origin/main)src/kilisrc/kilimkdocs build --strictCollected-test set diff is exactly the deliberate deletion plus the 3 new tests — nothing silently vanished. Runtime surface confirmed by
hasattrchecks: all four methods absent,NotificationId/NotificationFilterstill importable, gatewaylist_notificationspresent.The coverage gate (
--cov-fail-under=75) already fails on pristineorigin/mainat 74.83% — verified by stashing the work, running CI's exact scope on the untouched tree, then confirming the restored diff was byte-identical to a backup patch. This change moves it to 74.86%, still under the gate. The coverage job will be red here, and it was already red on main.It is meaningful for
createNotification— no first-party caller exists in any repo, so any production hit is a real external caller and a genuine blocker.It is NOT answerable for
notifications/countNotifications, and whoever runs it must be briefed or they will read the dashboard backwards. Three confounds stack: the bell polls both; this SDK's own import verification pollsnotificationsfrom insideappend_many_to_dataset; and thekili-client-method-nameheader comes from a singleton dict mutated on every decorated call, so the internal poll overwrites it. A non-zero count there is not evidence against removal — and both operations are staying regardless.🤖 Planned and implemented by Claude Code.