fix(config): reject non-finite read consistency intervals - #979
Draft
mamamiii wants to merge 1 commit into
Draft
Conversation
parseNonNegativeInt now accepts an optional fieldPath parameter. When provided, invalid inputs throw with a field-qualified error message instead of silently returning undefined (which would default to 0). - undefined (missing): returned as undefined → caller's ?? 0 applies (unchanged) - Valid finite non-negative integer: returned as-is - Non-finite (Infinity, -Infinity): thrown with field path - Non-integer (0.5, NaN): thrown with field path - Negative (-1): thrown with field path - Invalid type (string/boolean/null/object/array): thrown with field path - String coercion: only env-var reference strings accepted when fieldPath is set; plain numeric strings rejected Backward compatible: callers without fieldPath keep old silent-undefined behavior. The readConsistencyIntervalSeconds caller passes the full config field path: plugins.entries.memory-lancedb-pro.config.storageMaintenance.readConsistencyIntervalSeconds Fixes the configuration-validation fail-open edge case where JSON5 Infinity/+Infinity/1e9999 values silently selected per-read strong consistency. Related to CortexReach#920.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Related to #920.
This follow-up preserves the cross-process freshness behavior introduced by
#920 while closing a configuration-validation fail-open path for
storageMaintenance.readConsistencyIntervalSeconds.
When JSON5 non-finite values such as Infinity, +Infinity, 1e9999, or
+1e9999 reached the plugin parser, they could previously become
undefined and then silently default to 0, selecting per-read strong
consistency.
Changes
plugin boundary with the full configuration field path.
Validation
All validation used isolated artificial fixtures only.
cleanup without restart, reopen, or checkoutLatest.
reaching lancedb.connect().
No production data, private configuration, credentials, or endpoints were
used.
Scope
This PR does not change OpenClaw host settings, global AJV options, LanceDB,
the default interval of 0, or any production deployment configuration.