Skip to content

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

Open
abueide wants to merge 2 commits intotapi/types-and-errorsfrom
tapi/config-and-settings
Open

feat(core): add config validation, defaults, and httpConfig extraction#1157
abueide wants to merge 2 commits intotapi/types-and-errorsfrom
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 3 times, most recently from 6d30565 to 50cad97 Compare March 12, 2026 16:48
abueide and others added 2 commits March 12, 2026 12:38
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>
@abueide abueide force-pushed the tapi/config-and-settings branch from 50cad97 to 04bb992 Compare March 12, 2026 17:38
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