Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Implement get_value_details #96

Merged
merged 9 commits into from
Aug 12, 2023
Merged

Conversation

randycoulman
Copy link
Collaborator

Describe the purpose of your pull request

Implements the new get_value_details function.

Also, fixed a bug where, if a LocalFileDataSource file was missing, we'd return {:error, :not_found} for the entire config. Now, it returns the fetched config with no overrides instead, which matches the behavior of (at least) the Ruby SDK.

Related issues (only if applicable)

Provide links to issues relating to this pull request

Requirement checklist (only if applicable)

  • I have covered the applied changes with automated tests.
  • I have executed the full automated test set against my changes.
  • I have validated my changes against all supported platform versions.
  • I have read and accepted the contribution agreement.

@randycoulman randycoulman requested a review from a team as a code owner August 6, 2023 05:20
@codecov
Copy link

codecov bot commented Aug 6, 2023

Codecov Report

Patch coverage: 94.64% and project coverage change: +0.41% 🎉

Comparison is base (bccf106) 94.39% compared to head (a455845) 94.81%.

❗ Current head a455845 differs from pull request most recent head 3a4f4c4. Consider uploading reports for the commit 3a4f4c4 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #96      +/-   ##
==========================================
+ Coverage   94.39%   94.81%   +0.41%     
==========================================
  Files          24       28       +4     
  Lines         607      636      +29     
==========================================
+ Hits          573      603      +30     
+ Misses         34       33       -1     
Files Changed Coverage Δ
lib/config_cat/config_entry.ex 100.00% <ø> (ø)
lib/config_cat/constants.ex 57.14% <ø> (+18.25%) ⬆️
lib/config_cat/in_memory_cache.ex 100.00% <ø> (ø)
lib/config_cat/override_data_source.ex 100.00% <ø> (ø)
test/support/client_case.ex 100.00% <ø> (ø)
lib/config_cat.ex 74.07% <25.00%> (-8.54%) ⬇️
lib/config_cat/config.ex 87.50% <87.50%> (ø)
lib/config_cat/local_file_data_source.ex 84.84% <87.50%> (-1.82%) ⬇️
lib/config_cat/client.ex 93.67% <96.55%> (+1.17%) ⬆️
lib/config_cat/cache_policy/auto.ex 100.00% <100.00%> (ø)
... and 11 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

There were leftover warnings from previous PRs.
Running `mix test --trace` showed several tests that were leaking log output.
Implement new `get_value_details` function. The `EvaluationDetails` struct is fully supported except for the `fetch_time` field, which will come in a follow-up commit.
Simplify OverrideDataSource implementations to return only the flags/settings from the config, and to return an empty map if the settings can't be found/loaded.

This fixes a bug: if an override file couldn't be found, we would act as if we had no config at all, but we should still be falling back to the fetched config instead.
Had to do some significant refactoring to get the fetch time out of the cache and to the client where it was needed.
Extracts duplication around handling of fetch times in both ms and as DateTimes.
Extract helpers for extracting the top-level parts of a Config map, and for constructing new configs (for testing).
@randycoulman randycoulman force-pushed the randy/get-value-details branch from 894ba56 to 3a4f4c4 Compare August 12, 2023 08:24
@randycoulman randycoulman merged commit 72af06b into main Aug 12, 2023
@randycoulman randycoulman deleted the randy/get-value-details branch August 12, 2023 17:37
@kp-cat kp-cat mentioned this pull request Sep 20, 2023
4 tasks
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.

2 participants