Skip to content

feat(core): add config validation, defaults, and httpConfig extraction#1157

Open
abueide wants to merge 3 commits intomasterfrom
tapi/config-and-settings
Open

feat(core): add config validation, defaults, and httpConfig extraction#1157
abueide wants to merge 3 commits intomasterfrom
tapi/config-and-settings

Conversation

@abueide
Copy link
Contributor

@abueide abueide commented Mar 10, 2026

Summary

  • Add validateRateLimitConfig() and validateBackoffConfig() utilities that clamp config values to safe ranges with logger warnings
  • Add defaultHttpConfig and new config defaults (retryStrategy, autoFlushOnRetryReady) to constants
  • Add httpConfig field to SegmentClient with getHttpConfig() accessor and CDN extraction/merge logic in fetchSettings()
  • Deep-merge statusCodeOverrides so server-sent partial overrides extend defaults rather than replacing them
  • Add cross-config relational validation: maxTotalBackoffDuration >= 2x max(maxBackoffInterval, rateLimitConfig.maxRetryInterval)
  • Add test suites for config validation (15 tests) and httpConfig extraction (37 tests)

PR 2 of 5 in the TAPI backoff/retry stack. Depends on #1156.

Test plan

  • All 52 config validation and fetchSettings tests pass
  • Server sending partial statusCodeOverrides: { '501': 'drop' } preserves default overrides for 408, 410, 429, 460, 505
  • validateBackoffConfig cross-checks against rateLimitConfig.maxRetryInterval

🤖 Generated with Claude Code

@abueide abueide force-pushed the tapi/types-and-errors branch from d6f2a89 to 915c8e3 Compare March 12, 2026 14:56
@abueide abueide force-pushed the tapi/config-and-settings branch 3 times, most recently from 7a0b957 to f631f9f Compare March 12, 2026 15:24
@abueide abueide force-pushed the tapi/types-and-errors branch from eedad38 to 36997ac Compare March 12, 2026 16:11
@abueide abueide force-pushed the tapi/config-and-settings branch 5 times, most recently from 04bb992 to 658e649 Compare March 18, 2026 21:14
@abueide abueide force-pushed the tapi/types-and-errors branch 2 times, most recently from 1a577e8 to c451d38 Compare March 18, 2026 22:12
@abueide abueide force-pushed the tapi/config-and-settings branch 3 times, most recently from 3a16620 to f3e71c3 Compare March 19, 2026 16:02
@abueide abueide force-pushed the tapi/types-and-errors branch from b1cd5f5 to ff837e7 Compare March 19, 2026 16:15
@abueide abueide force-pushed the tapi/config-and-settings branch from f3e71c3 to 55221f4 Compare March 19, 2026 16:15
@abueide abueide force-pushed the tapi/types-and-errors branch from ff837e7 to a3ac0e5 Compare March 19, 2026 16:57
@abueide abueide force-pushed the tapi/config-and-settings branch 2 times, most recently from 09d48d7 to a6127cc Compare March 19, 2026 17:56
Base automatically changed from tapi/types-and-errors to master March 19, 2026 18:17
@abueide abueide force-pushed the tapi/config-and-settings branch from a6127cc to f76fd78 Compare March 19, 2026 18:21
abueide and others added 3 commits March 19, 2026 13:28
Add config validation utilities (validateRateLimitConfig,
validateBackoffConfig), default HTTP config constants, and httpConfig
extraction/merging logic in SegmentClient.fetchSettings().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Deep-merge statusCodeOverrides so server-sent partial overrides don't
replace defaults. Add rateLimitConfig parameter to validateBackoffConfig
for the cross-config relational constraint:
maxTotalBackoffDuration >= 2x max(maxBackoffInterval, maxRetryInterval).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… validation

Remove autoFlushOnRetryReady from defaultConfig (redundant with TimerFlushPolicy).
Validate integrations field from CDN response before storing — falls back to
defaultSettings when CDN returns null, array, or non-object integrations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@abueide abueide force-pushed the tapi/config-and-settings branch from f76fd78 to e1fb9cd Compare March 19, 2026 18:30
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