Repository navigation
fix(sdk): portable $defs/semver end-anchor (#1766) - #1767
Merged
Merged
Conversation
JSON Schema pattern is ECMA-262; Python re.search treated `$` as allowing a trailing newline. Use `(?![\s\S])` so `"1.0.0\n"` is rejected by jsonschema as well as ajv. Refs: #1766
Strix Security ReviewNo security issues found. Updated for Reviewed by Strix |
Greptile SummaryThe PR makes the SDK contract’s semver end anchor consistent across Python
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness, compatibility, or security issue identified. The schema’s five semver references inherit the corrected pattern, and the current Python validation targets support the new assertion while the regression test covers the behavior being fixed.
|
| Filename | Overview |
|---|---|
| docs/sdk/PLUGIN_CONTRACT.schema.json | Tightens the shared semver definition with an end-of-input assertion supported by the repository’s current validators. |
| tests/test_plugin_sdk_contract.py | Adds focused regression coverage demonstrating that valid versions pass while trailing newline and space inputs fail. |
Reviews (1): Last reviewed commit: "fix(sdk): portable $defs/semver end-anch..." | Re-trigger Greptile
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
$defs/semverindocs/sdk/PLUGIN_CONTRACT.schema.json(ADR-0086) with ECMA-262: replace final$with(?![\s\S])so Pythonjsonschema(re.search) and JSajvreject the same strings.test_semver_rejects_trailing_newline_on_python_jsonschemaintests/test_plugin_sdk_contract.py(validator Python)."1.0.0"and"1.2.3-alpha.1"remain valid;"1.0.0\n"and"1.0.0 "raiseValidationError.$pattern the new test failed (DID NOT RAISE ValidationError). After the anchor change it passed.$scan:grep -o '"pattern": *"[^"]*\$"' docs/sdk/PLUGIN_CONTRACT.schema.jsonmatched only$defs/semver. No other patterns in this file needed the same fix.Closes #1766
Test plan
./scripts/quick-test.sh --path tests/test_plugin_sdk_contract.py --keyword trailing_newlinefailed on old$(negative proof)./scripts/check-all.shOK on this branch