Skip to content

Fix timezone issue for ingestion - #668

Open
Aasav Badera (aasavbadera) wants to merge 4 commits into
masterfrom
aasavbadera/timezone-issue
Open

Aasav Badera (aasavbadera) wants to merge 4 commits into
masterfrom
aasavbadera/timezone-issue

Conversation

@aasavbadera

@aasavbadera Aasav Badera (aasavbadera) commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Added

Deterministic mocked-clock tests for resource and authorization-context cache reuse before, at, and after the one-hour refresh boundary, including UTC clock arguments, service-fetch counts, and reuse of refreshed values. Ingestion-message regression tests cover exact legacy UTC timestamp strings with and without fractional seconds and verify explicit UTC clock arguments.

Changed

Same-repository replacement for #647, using aasavbadera/timezone-issue into master, so authenticated Kusto E2E tests are eligible to run in the trusted Azure pipeline instead of being excluded for a fork. Preserves FlorianBracq's original commit and the subsequent resource-cache fix.

Fixed

Replace deprecated datetime.utcnow() calls with datetime.now(tz=timezone.utc). Cache assignments and comparisons are consistently timezone-aware, avoiding the TypeError on repeated resource lookups. Addresses the remaining authorization-cache reuse and expiry review feedback in #647.

Preserve the existing SourceMessageCreationTime wire format: a timezone-less UTC ISO timestamp, without an added +00:00 suffix. Timezone metadata is omitted only at serialization; internal resource and authorization caches remain UTC-aware.

Compatibility: Public SDK signatures, result types, Python support, dependencies, and customer-row formatting are unchanged. Integrations depending on private cache timestamp fields or patching only utcnow() may still need adjustments.

Validation: 25 targeted tests passed on Python 3.12 with deprecation warnings treated as errors; repository-wide Ruff formatting/lint and basedpyright passed; both SDK source distributions and wheels built successfully.

Authenticated Azure build 192713292 passed for exact head 11c99171ee579603e5e29e114dbadb4ed399c781. Each Python 3.9-3.13 job passed 297 unit tests (26 unit tests skipped) and 31 E2E tests with no E2E skips. The authenticated test tasks executed successfully; fork-only credential-free tasks were skipped.

FlorianBracq and others added 3 commits November 20, 2026 13:47
Keep resource cache writes and comparisons in aware UTC. Cover successive resource lookups and cache-expiry boundaries, verify UTC ingestion message serialization, and format the PR changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6f4a536a-7f7a-4d39-b60e-96db0cb49c1c
Verify authorization-context reuse and refresh before, at, and after the one-hour boundary, including reuse of the refreshed context and service-fetch counts. Check timezone-aware UTC arguments for every authorization and resource-cache clock call.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6f4a536a-7f7a-4d39-b60e-96db0cb49c1c

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Authenticated Kusto end-to-end validation is still pending in the Azure pipeline, leaving service acceptance of the queued-ingestion timestamp’s new UTC-offset format unverified.

No open issues 🎉

What changed in this PR

Fixes UTC handling in the Python SDK’s queued-ingestion path, replacing deprecated clock calls and keeping cache timestamps and expiry comparisons timezone-aware. This same-repository replacement for #647 makes authenticated Kusto end-to-end tests eligible for the trusted Azure pipeline.

Changes:

  • Use timezone-aware UTC timestamps for ingestion messages and cache refresh logic.
  • Add deterministic tests for cache reuse and expiry before, at, and after the one-hour boundary.
  • Verify serialized ingestion timestamps have a zero UTC offset.
File Description
azure-kusto-ingest/​tests/​test_kusto_ingest_client.py Tests resource and authorization-cache refresh boundaries, fetch counts, and UTC clock arguments.
azure-kusto-ingest/​tests/​test_ingestion_blob_info.py Checks that serialized message timestamps use UTC.
azure-kusto-ingest/​azure/​kusto/​ingest/​ingestion_blob_info.py Generates timezone-aware UTC message timestamps.
azure-kusto-ingest/​azure/​kusto/​ingest/​_resource_manager.py Uses timezone-aware UTC for both caches’ update timestamps and expiry comparisons.

Review effort: Max

Generate timestamps in explicit UTC while retaining the timezone-less ingestion-message representation. Add frozen-clock regressions for optional fractional seconds and UTC generation; leave cache timestamps aware.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6f4a536a-7f7a-4d39-b60e-96db0cb49c1c

This branch has not been deployed

No deployments
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.

3 participants