fix(api): avoid forced extrinsics index for broad/malformed time filters#2028
Merged
JSONbored merged 4 commits intoJun 26, 2026
Merged
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2028 +/- ##
=======================================
Coverage 93.26% 93.27%
=======================================
Files 48 48
Lines 7755 7759 +4
Branches 2839 2840 +1
=======================================
+ Hits 7233 7237 +4
Misses 92 92
Partials 430 430
🚀 New features to boost your workflow:
|
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.
Motivation
idx_extrinsics_observed_orderwheneverfrom/towere present made broad or malformed time filters (malformed values were coerced to0) cause D1/SQLite to scan-and-sort large retained windows beforeLIMIT, creating an unauthenticated query-amplification/availability risk.clampIntpreviously returned a default for non-finite inputs, which turned malformed bounds into a broad window start at epoch0.Description
parseTimeBoundthat treats missing, empty, or non-finitefrom/tovalues asnullinworkers/request-handlers/entities.mjs.idx_extrinsics_observed_orderhint when bothfromMsandtoMsare present and the window is narrow (toMs - fromMs <= DAY_MS), leaving broad/malformed filters planner-selected.tests/request-handlers-entities.test.mjsto verify broad standalone time filters do not force the timestamp index and malformed time filters are ignored.Testing
npm test -- --run tests/request-handlers-entities.test.mjsand all tests passed (128 passed).npx prettier --check(and applied fixes), then rannpm run lintandnpm run build, all of which succeeded.npm run validate:apiand the fullnpm run validateafter the build and both completed successfully.Codex Task