Skip to content

Add Context7 configuration#188

Merged
alxgsv merged 3 commits intomainfrom
add-context7-configuration
May 1, 2026
Merged

Add Context7 configuration#188
alxgsv merged 3 commits intomainfrom
add-context7-configuration

Conversation

@alxgsv
Copy link
Copy Markdown
Contributor

@alxgsv alxgsv commented Apr 30, 2026

Summary

  • Add a root context7.json for Context7 indexing and library ownership verification.
  • Configure included source/example folders, documentation exclusions, usage rules, and previous version tags.
  • Update file-opening examples and fixture generation to use block-form File.open for RuboCop compliance.
  • Replace a spec-only CGI.parse query comparison with URI.decode_www_form for CI compatibility.

Validation

  • ruby -rjson -e 'JSON.parse(File.read("context7.json")); puts "context7.json ok"'\n- bundle exec rubocop\n- bundle exec rake

Summary by CodeRabbit

  • Documentation

    • Updated upload code examples with improved file handling patterns demonstrating proper resource management.
  • Tests

    • Enhanced pagination test to validate query parameters with more robust comparison logic.
  • Chores

    • Added new project configuration for the Uploadcare Ruby SDK with schema definitions, metadata, and usage guidelines.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 89d8f007-a26b-43c8-8eba-b47535c646f1

📥 Commits

Reviewing files that changed from the base of the PR and between c39b82c and cedea5b.

📒 Files selected for processing (1)
  • spec/uploadcare/entity/decorator/paginator_spec.rb

Disabled knowledge base sources:

  • Jira integration is disabled

You can enable these sources in your CodeRabbit configuration.


Walkthrough

Adds a new context7.json configuration manifest and updates example and test files to use block-scoped File.open for file handling; also adjusts a paginator spec's URL-query comparison to use URI.decode_www_form and sorting.

Changes

Cohort / File(s) Summary
Context manifest
context7.json
Adds a new Context7 configuration file with schema URL, project metadata (public key, main branch), included folders, extensive exclude patterns, five rule statements, and previousVersions.
Upload examples
api_examples/upload_api/post_base.rb, api_examples/upload_api/post_multipart_complete.rb, api_examples/upload_api/post_multipart_start.rb, api_examples/upload_api/put_presigned_url_x.rb
Replaced out-of-block file-handle usage with block-scoped `File.open {
Test fixture
spec/support/generate_file_fixtures.rb
generate_big_file now uses block-scoped File.open for reading kitten.jpeg and writing big.jpeg, preserving write logic while ensuring proper file lifecycle management.
Specs
spec/uploadcare/entity/decorator/paginator_spec.rb
previous_page test changed to compare decoded and sorted query parameter pairs via URI.decode_www_form(...).sort instead of previous parsing approach.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • vipulnsward
  • rsedykh
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add Context7 configuration' accurately and specifically describes the main change—introducing a new context7.json configuration file to the repository.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-context7-configuration

Review rate limit: 3/5 reviews remaining, refill in 20 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@alxgsv alxgsv requested a review from rsedykh April 30, 2026 12:02
@alxgsv alxgsv marked this pull request as ready for review April 30, 2026 12:02
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (3)
context7.json (3)

55-68: 💤 Low value

(Optional) Re-check previousVersions ordering/limits vs schema.

The previousVersions entries look correctly shaped ([{ "tag": ... }, ...]) (Lines 55-68). As a safety check, please confirm the schema doesn’t require any ordering (e.g., most-recent-first) or a max entry count, beyond what your “shape” validator currently checks.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@context7.json` around lines 55 - 68, Confirm whether the JSON schema for the
previousVersions array imposes an ordering or max-size constraint; if it does,
update the validator that checks previousVersions (the "shape" validator for
previousVersions / tag entries) to enforce the required ordering (e.g.,
most-recent-first) and a maximum entry count, and add unit tests to validate
both ordering and length; if the schema has no such constraints, add a short
comment in the validator saying ordering/limits are intentionally not enforced.
Ensure you reference the previousVersions array and its tag objects when
implementing or commenting this change.

12-30: ⚡ Quick win

Verify excludeFolders wildcard/glob semantics (*archive*, *deprecated*, etc.).

Schema/shape validation may pass, but Context7’s interpretation of excludeFolders entries containing * is the key risk: if it expects exact folder names or path-style patterns, these substring globs might not work as intended (leading to either over-exclusion or under-exclusion in indexing).

If you have a validation command for Context7 indexing (or a way to “dry run” the matcher), please run it and confirm that these patterns match the intended directories in this repo.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@context7.json` around lines 12 - 30, The excludeFolders array entries like
"*archive*", "*archived*", "*deprecated*" may be interpreted differently (exact
names vs glob/substring) by Context7; verify and fix by confirming the matcher
semantics used by Context7: run its indexing dry-run or validation command (or
unit test) to see which repo paths are excluded and ensure patterns behave as
intended; if Context7 expects globs, keep/normalize these entries, but if it
expects exact names or path-globs, replace substring patterns with proper glob
expressions (e.g., "**/*archive*/**" or explicit folder names) or update the
matcher implementation to use a glob library (the code that reads excludeFolders
/ the matcher function in Context7) so the patterns match intended directories.

6-54: ⚡ Quick win

Confirm public_key is safe-to-commit + add guardrails against accidental secret leakage.

This file includes public_key (Line 6) but no secret_key. Given the manifest contains credential-related values, it’d be good to confirm (and/or enforce) that Context7 only requires public_key here and that CI/schema validation explicitly forbids any secret_key/private key fields (to prevent accidental future additions).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@context7.json` around lines 6 - 54, The manifest currently includes a
"public_key" but could accidentally accept private keys; update validation and
CI to forbid any secret/private key fields and ensure only public keys are
allowed: add a schema rule that requires presence (or optional presence) of
"public_key" and disallows properties like "secret_key", "private_key", "secret"
(e.g., via JSON Schema "additionalProperties": false or an explicit "properties"
whitelist for the manifest parser that references "public_key"), add a
CI/validation step that scans manifest files for prohibited keys
("secret_key"/"private_key"/"secret") and fails the build if found, and document
in project guidelines that only "public_key" may appear in Context7 manifests to
prevent future secret leakage.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@context7.json`:
- Around line 55-68: Confirm whether the JSON schema for the previousVersions
array imposes an ordering or max-size constraint; if it does, update the
validator that checks previousVersions (the "shape" validator for
previousVersions / tag entries) to enforce the required ordering (e.g.,
most-recent-first) and a maximum entry count, and add unit tests to validate
both ordering and length; if the schema has no such constraints, add a short
comment in the validator saying ordering/limits are intentionally not enforced.
Ensure you reference the previousVersions array and its tag objects when
implementing or commenting this change.
- Around line 12-30: The excludeFolders array entries like "*archive*",
"*archived*", "*deprecated*" may be interpreted differently (exact names vs
glob/substring) by Context7; verify and fix by confirming the matcher semantics
used by Context7: run its indexing dry-run or validation command (or unit test)
to see which repo paths are excluded and ensure patterns behave as intended; if
Context7 expects globs, keep/normalize these entries, but if it expects exact
names or path-globs, replace substring patterns with proper glob expressions
(e.g., "**/*archive*/**" or explicit folder names) or update the matcher
implementation to use a glob library (the code that reads excludeFolders / the
matcher function in Context7) so the patterns match intended directories.
- Around line 6-54: The manifest currently includes a "public_key" but could
accidentally accept private keys; update validation and CI to forbid any
secret/private key fields and ensure only public keys are allowed: add a schema
rule that requires presence (or optional presence) of "public_key" and disallows
properties like "secret_key", "private_key", "secret" (e.g., via JSON Schema
"additionalProperties": false or an explicit "properties" whitelist for the
manifest parser that references "public_key"), add a CI/validation step that
scans manifest files for prohibited keys ("secret_key"/"private_key"/"secret")
and fails the build if found, and document in project guidelines that only
"public_key" may appear in Context7 manifests to prevent future secret leakage.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 144489d7-08f1-4cd4-85eb-6587c41ebe09

📥 Commits

Reviewing files that changed from the base of the PR and between ca841a7 and 23379b5.

📒 Files selected for processing (1)
  • context7.json

@alxgsv alxgsv requested review from vipulnsward and removed request for rsedykh April 30, 2026 12:06
@rsedykh rsedykh self-requested a review April 30, 2026 12:45
@alxgsv alxgsv marked this pull request as draft May 1, 2026 07:22
@alxgsv alxgsv marked this pull request as ready for review May 1, 2026 07:25
@alxgsv alxgsv merged commit 840f920 into main May 1, 2026
13 of 14 checks passed
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.

2 participants