Skip to content

SBS log gathering: per feature consent, one queued batch, device ID change and stopped gather tail - #319

Merged
arifBurakDemiray merged 1 commit into
sdk-behavior-settingsfrom
p7-log-gathering-fixes
Oct 22, 2026
Merged

arifBurakDemiray merged 1 commit into
sdk-behavior-settingsfrom
p7-log-gathering-fixes

Conversation

@arifBurakDemiray

Copy link
Copy Markdown
Member

Closes the open log gathering items from the #275 review, following the reference SDK's log module. Base: sdk-behavior-settings.

What changes

Area Before After
Consent Any one consent released every held line, so a feature without consent leaked (session coordinates) A line needs the consent of the feature its bracket names; a line of no feature needs the events and user profiles consents, of those the app enabled; removing a consent drops the held lines of that feature
Request queue Batches piled up while offline or with networking: false One batch waits in the queue at a time, checked against the stored request itself, so a batch the queue drops unsent no longer holds delivery back; a sent batch resumes only a delivery it held back
Device ID change without merge Held lines went out under the new ID and the gather kept running Held lines, and the tail of a stopped gather, are queued under the old ID and the gather stops; a settings answer requested before the change does not arm it again, while a change with merge keeps the gather
Gather stopped by the server Its last held lines were dropped They go out once, under its gather ID
Networking A request stored while a send was finishing could wait for the next check, and a failing drain lost the check The drain or recheck decision is taken under the recheck lock, and a failing drain still rechecks

Also in here:

Tests

  • New: LogTests (one batch at a time, a dropped batch, a removed consent, device ID change, stopped gather tail), SdkLogGatheringTests (per feature consent end to end, a feature not enabled, a merge after a held answer), DefaultNetworkingRecheckTests (a failing drain still rechecks).
  • Each new test fails with its fix reverted.
  • Full suite: 727 of 727 on JDK 8.

Review notes

  • Log.LogBatchQueue now returns the storage ID of the queued request and answers whether it is still stored; ModuleRequests.pushSdkLogs returns that ID.
  • The device ID flush runs on the calling thread, which holds the Countly.instance() lock, and waits for each batch's store (bounded by the existing 10 s cap).

🤖 Generated with Claude Code

… time

- A gathered line needs the consent of the feature its bracket names. A line
  of no feature needs the events and user profiles consents the app enabled,
  and removing a consent drops the held lines of that feature.
- One sdk_logs request waits in the queue at a time, checked against the
  stored request, and a sent batch resumes only a delivery it held back.
- A device ID change without merge queues the held lines and the tail of a
  stopped gather under the old ID and stops the gather. An answer requested
  before that change no longer arms it, while a change with merge keeps it.
- A gather the server stops uploads its last lines once, under its ID.
- The networking decides between a drain and a recheck under one lock, and a
  failing drain still rechecks.
- SessionImpl logs event, location and view data after the feature check.
- The test RSA key is 2048 bits (CodeQL).
@arifBurakDemiray
arifBurakDemiray marked this pull request as ready for review October 22, 2026 15:57
@arifBurakDemiray
arifBurakDemiray merged commit 7e50a43 into sdk-behavior-settings Oct 22, 2026
4 of 5 checks passed
@arifBurakDemiray
arifBurakDemiray deleted the p7-log-gathering-fixes branch October 22, 2026 15:57
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.

1 participant