quonfig 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. checksums.yaml +7 -0
  2. data/.claude/rules/constitution.md +81 -0
  3. data/.claude/rules/git-safety.md +11 -0
  4. data/.claude/rules/issue-tracking.md +13 -0
  5. data/.claude/rules/testing-workflow.md +28 -0
  6. data/.envrc.sample +3 -0
  7. data/.github/CODEOWNERS +2 -0
  8. data/.github/pull_request_template.md +8 -0
  9. data/.github/workflows/push_gem.yml +49 -0
  10. data/.github/workflows/ruby.yml +60 -0
  11. data/.github/workflows/test.yaml +40 -0
  12. data/.rubocop.yml +13 -0
  13. data/.tool-versions +1 -0
  14. data/CHANGELOG.md +301 -0
  15. data/CLAUDE.md +29 -0
  16. data/CODEOWNERS +1 -0
  17. data/Gemfile +26 -0
  18. data/Gemfile.lock +177 -0
  19. data/LICENSE.txt +20 -0
  20. data/README.md +213 -0
  21. data/Rakefile +64 -0
  22. data/VERSION +1 -0
  23. data/dev/allocation_stats +60 -0
  24. data/dev/benchmark +40 -0
  25. data/dev/console +12 -0
  26. data/dev/script_setup.rb +18 -0
  27. data/lib/quonfig/bound_client.rb +71 -0
  28. data/lib/quonfig/caching_http_connection.rb +95 -0
  29. data/lib/quonfig/client.rb +221 -0
  30. data/lib/quonfig/config_envelope.rb +5 -0
  31. data/lib/quonfig/config_loader.rb +103 -0
  32. data/lib/quonfig/config_store.rb +42 -0
  33. data/lib/quonfig/context.rb +101 -0
  34. data/lib/quonfig/datadir.rb +101 -0
  35. data/lib/quonfig/duration.rb +58 -0
  36. data/lib/quonfig/encryption.rb +74 -0
  37. data/lib/quonfig/error.rb +6 -0
  38. data/lib/quonfig/errors/env_var_parse_error.rb +11 -0
  39. data/lib/quonfig/errors/initialization_timeout_error.rb +12 -0
  40. data/lib/quonfig/errors/invalid_sdk_key_error.rb +19 -0
  41. data/lib/quonfig/errors/missing_default_error.rb +13 -0
  42. data/lib/quonfig/errors/missing_env_var_error.rb +11 -0
  43. data/lib/quonfig/errors/type_mismatch_error.rb +11 -0
  44. data/lib/quonfig/errors/uninitialized_error.rb +13 -0
  45. data/lib/quonfig/evaluation.rb +64 -0
  46. data/lib/quonfig/evaluator.rb +464 -0
  47. data/lib/quonfig/exponential_backoff.rb +21 -0
  48. data/lib/quonfig/fixed_size_hash.rb +14 -0
  49. data/lib/quonfig/http_connection.rb +46 -0
  50. data/lib/quonfig/internal_logger.rb +173 -0
  51. data/lib/quonfig/murmer3.rb +50 -0
  52. data/lib/quonfig/options.rb +194 -0
  53. data/lib/quonfig/periodic_sync.rb +74 -0
  54. data/lib/quonfig/quonfig.rb +58 -0
  55. data/lib/quonfig/rate_limit_cache.rb +41 -0
  56. data/lib/quonfig/reason.rb +39 -0
  57. data/lib/quonfig/resolver.rb +42 -0
  58. data/lib/quonfig/semantic_logger_filter.rb +90 -0
  59. data/lib/quonfig/semver.rb +132 -0
  60. data/lib/quonfig/sse_config_client.rb +135 -0
  61. data/lib/quonfig/time_helpers.rb +7 -0
  62. data/lib/quonfig/types.rb +56 -0
  63. data/lib/quonfig/weighted_value_resolver.rb +49 -0
  64. data/lib/quonfig.rb +57 -0
  65. data/quonfig.gemspec +149 -0
  66. data/scripts/generate_integration_tests.rb +362 -0
  67. data/test/fixtures/datafile.json +87 -0
  68. data/test/integration/test_context_precedence.rb +194 -0
  69. data/test/integration/test_datadir_environment.rb +76 -0
  70. data/test/integration/test_enabled.rb +784 -0
  71. data/test/integration/test_enabled_with_contexts.rb +94 -0
  72. data/test/integration/test_get.rb +224 -0
  73. data/test/integration/test_get_feature_flag.rb +34 -0
  74. data/test/integration/test_get_or_raise.rb +86 -0
  75. data/test/integration/test_get_weighted_values.rb +29 -0
  76. data/test/integration/test_helpers.rb +139 -0
  77. data/test/integration/test_helpers_test.rb +73 -0
  78. data/test/integration/test_post.rb +34 -0
  79. data/test/integration/test_telemetry.rb +114 -0
  80. data/test/support/common_helpers.rb +106 -0
  81. data/test/support/mock_base_client.rb +27 -0
  82. data/test/support/mock_config_loader.rb +1 -0
  83. data/test/test_bound_client.rb +109 -0
  84. data/test/test_caching_http_connection.rb +218 -0
  85. data/test/test_client.rb +255 -0
  86. data/test/test_config_loader.rb +70 -0
  87. data/test/test_context.rb +136 -0
  88. data/test/test_datadir.rb +199 -0
  89. data/test/test_duration.rb +37 -0
  90. data/test/test_encryption.rb +16 -0
  91. data/test/test_evaluator.rb +285 -0
  92. data/test/test_exponential_backoff.rb +44 -0
  93. data/test/test_fixed_size_hash.rb +119 -0
  94. data/test/test_helper.rb +17 -0
  95. data/test/test_http_connection.rb +79 -0
  96. data/test/test_internal_logger.rb +34 -0
  97. data/test/test_options.rb +167 -0
  98. data/test/test_rate_limit_cache.rb +44 -0
  99. data/test/test_reason.rb +79 -0
  100. data/test/test_rename.rb +65 -0
  101. data/test/test_resolver.rb +144 -0
  102. data/test/test_semantic_logger_filter.rb +123 -0
  103. data/test/test_semver.rb +108 -0
  104. data/test/test_sse_config_client.rb +297 -0
  105. data/test/test_typed_getters.rb +131 -0
  106. data/test/test_types.rb +141 -0
  107. data/test/test_weighted_value_resolver.rb +84 -0
  108. metadata +311 -0
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # AUTO-GENERATED from integration-test-data/tests/eval/datadir_environment.yaml.
4
+ # Regenerate with `bundle exec ruby scripts/generate_integration_tests.rb`.
5
+ # Do NOT edit by hand — changes will be overwritten.
6
+
7
+ require 'test_helper'
8
+ require 'integration/test_helpers'
9
+
10
+ class TestDatadirEnvironment < Minitest::Test
11
+ def setup
12
+ @store = IntegrationTestHelpers.build_store("datadir_environment")
13
+ end
14
+
15
+ # datadir with environment option gets environment-specific value
16
+ def test_datadir_with_environment_option_gets_environment_specific_value
17
+ begin
18
+ client = Quonfig::Client.new(datadir: IntegrationTestHelpers.data_dir, environment: "Production")
19
+ assert_equal "test4", client.get("james.test.key")
20
+ rescue Exception => e
21
+ skip("datadir Client.new not yet wired: #{e.class}: #{e.message}")
22
+ end
23
+ end
24
+
25
+ # datadir with QUONFIG_ENVIRONMENT env var gets environment-specific value
26
+ def test_datadir_with_quonfig_environment_env_var_gets_environment_specific_value
27
+ begin
28
+ IntegrationTestHelpers.with_env({"QUONFIG_ENVIRONMENT" => "Production"}) do
29
+ client = Quonfig::Client.new(datadir: IntegrationTestHelpers.data_dir)
30
+ assert_equal "test4", client.get("james.test.key")
31
+ end
32
+ rescue Exception => e
33
+ skip("datadir Client.new not yet wired: #{e.class}: #{e.message}")
34
+ end
35
+ end
36
+
37
+ # environment option supersedes QUONFIG_ENVIRONMENT env var
38
+ def test_environment_option_supersedes_quonfig_environment_env_var
39
+ begin
40
+ IntegrationTestHelpers.with_env({"QUONFIG_ENVIRONMENT" => "nonexistent"}) do
41
+ client = Quonfig::Client.new(datadir: IntegrationTestHelpers.data_dir, environment: "Production")
42
+ assert_equal "test4", client.get("james.test.key")
43
+ end
44
+ rescue Exception => e
45
+ skip("datadir Client.new not yet wired: #{e.class}: #{e.message}")
46
+ end
47
+ end
48
+
49
+ # config without environment override returns default value
50
+ def test_config_without_environment_override_returns_default_value
51
+ begin
52
+ client = Quonfig::Client.new(datadir: IntegrationTestHelpers.data_dir, environment: "Production")
53
+ assert_equal "hello from no env row", client.get("config.with.only.default.env.row")
54
+ rescue Exception => e
55
+ skip("datadir Client.new not yet wired: #{e.class}: #{e.message}")
56
+ end
57
+ end
58
+
59
+ # datadir without environment fails to init
60
+ def test_datadir_without_environment_fails_to_init
61
+ begin
62
+ skip("init raise-case (missing_environment) — no Quonfig::Errors mapping yet")
63
+ rescue Exception => e
64
+ skip("datadir Client.new not yet wired: #{e.class}: #{e.message}")
65
+ end
66
+ end
67
+
68
+ # datadir with invalid environment fails to init
69
+ def test_datadir_with_invalid_environment_fails_to_init
70
+ begin
71
+ skip("init raise-case (invalid_environment) — no Quonfig::Errors mapping yet")
72
+ rescue Exception => e
73
+ skip("datadir Client.new not yet wired: #{e.class}: #{e.message}")
74
+ end
75
+ end
76
+ end