Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confirm Rate Limiting Works Properly, Small Improvements to Crawler Verification Script #537

Closed
wants to merge 16 commits into from

Conversation

thostetler
Copy link
Member

No description provided.

- Correctly initialize cache entries and handle TTL expiration logic.
- Ensure accurate request counts and timestamps through clear conditional checks.
Enhanced user data management by introducing better token refresh mechanisms and updated local storage checks. Refactored to handle more use cases, including direct bootstraps and failing over to retries.
- Updated config SSR_API_TIMEOUT to 30000 for consistency.
- Improved test coverage for user data and refresh logic scenarios.
- Split session validation into clear, separate checks for improved readability and maintainability.
- Enhance logging with additional context, including request path and session details.
- Re-enable `botCheck` middleware to identify bots during session initialization.
Refactor `getServerSideProps` to utilize React Query's prefetching for multiple pages.

* Implement `dehydrate` and `prefetchQuery` for server-side data fetching.
* Replace `withDetailsPage` HOC with direct async function.
* Handle API errors and logging within GSSP.
Changed the log level to be dynamically set based on the LOG_LEVEL environment variable, defaulting to 'info'. Also included the process ID (PID) in the logger's base information for better traceability.

- Adjusted log level configuration
- Added PID to logger base information
- **Tests:** Temporarily skip all pager-related tests in `pager.spec.ts`.
- **Config:** Enhance Chromium launch options for better GPU utilization and remove redundant `storybook` web server configuration in `playwright.config.ts`.
* Refactor inputs to use `defaultValue` instead of `value` to prevent uncontrolled to controlled component warnings.
* Add resolver mock handlers and corresponding response data for improved testing capabilities.
* Skip 'UI' test in `AuthorAffiliations.test.tsx` and remove console log from `api.test.ts`.Update input handling and add resolver mocks and Fixup Tests
* Added logging of request headers to enhance debugging.
* Updated the rate limiting response to return a JSON error message with a 429 status code instead of redirecting.
The Google Tag Manager ID has been changed from an environment variable to a hardcoded value.
- Removed redundant comments explaining default values for TTL and request count in rate limit settings.
- The code is now cleaner and adheres to DRY principles.
Refactor `isBot` API handlers to improve type definitions, logging, and documentation. Added extensive comments for clarity, cache PTR records, and updated Google bot DNS domains. Enhanced bot detection middleware to handle bot classification and session updates better.

- Improved type safety and added detailed JSDocs.
- Cached PTR records for performance enhancement.
- Updated middleware to handle bot detection and session management more robustly.
Copy link

codecov bot commented Oct 3, 2024

Codecov Report

Attention: Patch coverage is 81.17647% with 48 lines in your changes missing coverage. Please review.

Project coverage is 46.3%. Comparing base (9b719a4) to head (b9a206e).
Report is 74 commits behind head on master.

Files with missing lines Patch % Lines
src/api/api.ts 94.3% 7 Missing and 1 partial ⚠️
src/api/search/search.ts 80.0% 6 Missing ⚠️
src/api/vault/vault.ts 53.9% 6 Missing ⚠️
src/components/AbstractSideNav/AbstractSideNav.tsx 14.3% 6 Missing ⚠️
src/api/author-affiliation/author-affiliation.ts 28.6% 5 Missing ⚠️
src/api/orcid/orcid.ts 50.0% 5 Missing ⚠️
src/api/biblib/libraries.ts 73.4% 4 Missing ⚠️
src/api/vis/vis.ts 50.0% 4 Missing ⚠️
src/api/graphics/graphics.ts 50.0% 1 Missing ⚠️
src/api/metrics/metrics.ts 50.0% 1 Missing ⚠️
... and 2 more
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #537     +/-   ##
========================================
- Coverage    46.8%   46.3%   -0.5%     
========================================
  Files         427     427             
  Lines       45492   46135    +643     
  Branches      628     631      +3     
========================================
+ Hits        21289   21345     +56     
- Misses      24191   24780    +589     
+ Partials       12      10      -2     
Files with missing lines Coverage Δ
src/api/export/export.ts 88.9% <100.0%> (+34.4%) ⬆️
src/api/resolver/resolver.ts 89.2% <100.0%> (+0.4%) ⬆️
src/auth-utils.ts 63.2% <100.0%> (+17.5%) ⬆️
src/components/BibstemPicker/BibstemPicker.tsx 65.4% <100.0%> (ø)
...omponents/__stories__/CitationExporter.stories.tsx 100.0% <ø> (ø)
src/config.ts 100.0% <100.0%> (ø)
src/logger.ts 63.9% <100.0%> (+5.6%) ⬆️
src/mocks/handlers.ts 100.0% <100.0%> (ø)
src/pages/paper-form.tsx 74.0% <100.0%> (+0.4%) ⬆️
src/test-utils.tsx 87.2% <100.0%> (-0.5%) ⬇️
... and 12 more

... and 21 files with indirect coverage changes

@thostetler thostetler marked this pull request as draft October 3, 2024 04:56
@thostetler thostetler closed this Nov 15, 2024
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