fix(context7): bring rules within the schema's 255-char limit - #14
Merged
Conversation
Claiming the library unlocks the admin panel, usage metrics, and higher refresh limits. The claim flow verifies by fetching context7.json from the default branch, so url and public_key have to live there alongside the existing parsing config — the claim modal's 'read config from context7.json' option keeps this file authoritative rather than moving config to the web UI.
Claiming the library failed with "context7.json format is incorrect". Validating against https://context7.com/schema/context7.json showed 5 of the 10 rules exceeded the 255-character per-rule limit (longest 488). The parser tolerates oversized values — the repo indexed fine — so nothing surfaced this until the claim flow, which validates strictly and rejects the whole file. Split the long rules into shorter ones rather than truncating, so no guidance is lost; 14 rules now, well under the 50-rule cap. Adds tests for the schema's limits and the allowed key set, since the failure mode is silent everywhere except claiming.
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.
Claiming the library failed with:
The message points at unknown fields, but that was not it — every top-level key was already allowed. Validating against the published schema found the real cause:
rulesitems are capped at 255 characters, and 5 of the 10 rules exceeded it (longest 488).The parser tolerates oversized values — the repo indexed without complaint — so this stayed invisible until the claim flow, which validates strictly and rejects the whole file.
Fix
Split the over-long rules into shorter ones instead of truncating, so no guidance is lost. 10 → 14 rules, longest now 241 chars, still far under the 50-rule cap.
Added tests covering the schema's limits (per-rule length, rule count, description/title length) and the allowed key set. Verified they fail against the previous file, so they genuinely cover this.
Test plan
jsonschema→ passespytest sonilo-cli→ 31 passed (2 new)context7.json(5 over-long rules)