Skip to content

fix: report numeric timestamps for file data source errors - #543

Draft
Kayvan-Zahiri wants to merge 1 commit into
launchdarkly:mainfrom
Kayvan-Zahiri:codex/file-source-error-timestamps
Draft

Kayvan-Zahiri wants to merge 1 commit into
launchdarkly:mainfrom
Kayvan-Zahiri:codex/file-source-error-timestamps

Conversation

@Kayvan-Zahiri

Copy link
Copy Markdown

Problem

Files.new_data_source() passes the time.time function, rather than its return value, to DataSourceErrorInfo when reading a file or initializing the feature store fails. Through LDClient.data_source_status_provider.status.error.time, applications therefore receive a callable where the documented API promises a Unix timestamp. Formatting, comparing or serializing that timestamp fails.

Change

Call time.time() in both error paths. Add three public-client regressions using an actual missing file, malformed file and a feature store that raises on initialization. Each verifies the error kind and a numeric timestamp within the operation's time window. All three fail on the original implementation and pass with the fix.

This is the synchronous legacy Files integration; there is no async sibling for this class. The FDv2 file source has separate error construction and is unchanged.

Validation

  • File-source suites:31 passed.
  • Full prescribed non-database suite on Python3.12:1773 passed,367 skipped,16 warnings. No hosted SDK credentials supplied.
  • Official v2.41.0 contract harness:sync4741 ran/19 skipped;async4738 ran/20 skipped;both passed.
  • Mypy231 source files,isort,pycodestyle and diff whitespace checks pass.
  • Wheel and sdist build successfully.

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