-
Notifications
You must be signed in to change notification settings - Fork 15
feat(#2095): add verified/unchecked variable fields to review findings schema #446
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
base: main
Are you sure you want to change the base?
Changes from all commits
6911781
9e7abdf
784dbb6
caa5b07
44807be
da5e2a7
2153f85
f2c6a9d
466db30
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,168 @@ | ||
| #!/usr/bin/env bash | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [medium] missing-test New test file is not registered in the Makefile's script-test target. All other test scripts are listed there and run by the script-test.yml CI workflow. This file will not execute in CI. Suggested fix: Add $(call run-timed,bash schemas/review-result-label-actions-test.sh) to the script-test target in the Makefile. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [low] naming-convention Test file placed in schemas/ directory, which contains only .schema.json files. Convention places test scripts in scripts/. Suggested fix: Move to scripts/review-result-label-actions-test.sh. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [low] naming-convention Test script placed in schemas/ directory which on the base branch contains only .schema.json files. All existing test scripts reside in scripts/, hack/, eval/scripts/, or .github/scripts/. The test also uses a different validation pattern (Draft202012Validator) than the established harness validator. Suggested fix: Move to scripts/review-result-label-actions-test.sh and adapt to use the established validation pattern. |
||
| # Tests for label_actions support in review-result.schema.json | ||
| set -euo pipefail | ||
|
|
||
| SCHEMA="$(cd "$(dirname "$0")" && pwd)/review-result.schema.json" | ||
| FAILURES=0 | ||
|
|
||
| fail() { | ||
| echo "FAIL: $1" | ||
| FAILURES=$((FAILURES + 1)) | ||
| } | ||
|
|
||
| validate() { | ||
| local desc="$1" | ||
| local json="$2" | ||
| local expect_pass="$3" | ||
|
|
||
| if echo "${json}" | python3 -c " | ||
| import sys, json | ||
| from jsonschema import validate, ValidationError, Draft202012Validator | ||
| schema = json.load(open('${SCHEMA}')) | ||
| instance = json.load(sys.stdin) | ||
| Draft202012Validator(schema).validate(instance) | ||
| sys.exit(0) | ||
| " 2>/dev/null; then | ||
| if [ "${expect_pass}" = "true" ]; then | ||
| echo "PASS: ${desc}" | ||
| else | ||
| fail "${desc} (expected rejection but schema accepted it)" | ||
| fi | ||
| else | ||
| if [ "${expect_pass}" = "false" ]; then | ||
| echo "PASS: ${desc}" | ||
| else | ||
| fail "${desc} (expected acceptance but schema rejected it)" | ||
| fi | ||
| fi | ||
| } | ||
|
|
||
| # 1. approve without label_actions (baseline) | ||
| validate "approve-without-label-actions" '{ | ||
| "action": "approve", | ||
| "pr_number": 42, | ||
| "repo": "org/repo", | ||
| "head_sha": "abcdef0123456789abcdef0123456789abcdef01", | ||
| "body": "Looks good to me." | ||
| }' true | ||
|
|
||
| # 2. approve with valid label_actions | ||
| validate "approve-with-label-actions" '{ | ||
| "action": "approve", | ||
| "pr_number": 42, | ||
| "repo": "org/repo", | ||
| "head_sha": "abcdef0123456789abcdef0123456789abcdef01", | ||
| "body": "Looks good to me.", | ||
| "label_actions": { | ||
| "reason": "Approved PR, adding reviewed label", | ||
| "actions": [ | ||
| { "action": "add", "label": "reviewed" } | ||
| ] | ||
| } | ||
| }' true | ||
|
|
||
| # 3. request-changes with label_actions | ||
| validate "request-changes-with-label-actions" '{ | ||
| "action": "request-changes", | ||
| "pr_number": 42, | ||
| "repo": "org/repo", | ||
| "head_sha": "abcdef0123456789abcdef0123456789abcdef01", | ||
| "body": "Please fix the issues.", | ||
| "findings": [ | ||
| { | ||
| "severity": "high", | ||
| "category": "security", | ||
| "file": "main.go", | ||
| "description": "SQL injection vulnerability", | ||
| "verified_variables": [], | ||
| "unchecked_variables": [] | ||
| } | ||
| ], | ||
| "label_actions": { | ||
| "reason": "Security issue found, flagging for review", | ||
| "actions": [ | ||
| { "action": "add", "label": "security" }, | ||
| { "action": "remove", "label": "needs-review" } | ||
| ] | ||
| } | ||
| }' true | ||
|
|
||
| # 4. failure with label_actions | ||
| validate "failure-with-label-actions" '{ | ||
| "action": "failure", | ||
| "pr_number": 42, | ||
| "repo": "org/repo", | ||
| "reason": "tool-failure", | ||
| "label_actions": { | ||
| "reason": "Tool failure, marking for manual review", | ||
| "actions": [ | ||
| { "action": "add", "label": "needs-manual-review" } | ||
| ] | ||
| } | ||
| }' true | ||
|
|
||
| # 5. label_actions missing reason — should fail | ||
| validate "label-actions-missing-reason" '{ | ||
| "action": "approve", | ||
| "pr_number": 42, | ||
| "repo": "org/repo", | ||
| "head_sha": "abcdef0123456789abcdef0123456789abcdef01", | ||
| "body": "LGTM", | ||
| "label_actions": { | ||
| "actions": [ | ||
| { "action": "add", "label": "reviewed" } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [low] pattern-inconsistency Uses python3/jsonschema for schema validation while the established pattern (validate-output-schema-test.sh) delegates to validate-output-schema.sh, which provides diagnostic features like allowed-properties error messages. |
||
| ] | ||
| } | ||
| }' false | ||
|
|
||
| # 6. label_actions with empty actions array — should fail | ||
| validate "label-actions-empty-actions" '{ | ||
| "action": "approve", | ||
| "pr_number": 42, | ||
| "repo": "org/repo", | ||
| "head_sha": "abcdef0123456789abcdef0123456789abcdef01", | ||
| "body": "LGTM", | ||
| "label_actions": { | ||
| "reason": "No labels to change", | ||
| "actions": [] | ||
| } | ||
| }' false | ||
|
|
||
| # 7. label_actions with invalid action verb — should fail | ||
| validate "label-actions-invalid-verb" '{ | ||
| "action": "approve", | ||
| "pr_number": 42, | ||
| "repo": "org/repo", | ||
| "head_sha": "abcdef0123456789abcdef0123456789abcdef01", | ||
| "body": "LGTM", | ||
| "label_actions": { | ||
| "reason": "Replace a label", | ||
| "actions": [ | ||
| { "action": "replace", "label": "old-label" } | ||
| ] | ||
| } | ||
| }' false | ||
|
|
||
| # 8. label_actions with extra property — should fail | ||
| validate "label-actions-extra-property" '{ | ||
| "action": "approve", | ||
| "pr_number": 42, | ||
| "repo": "org/repo", | ||
| "head_sha": "abcdef0123456789abcdef0123456789abcdef01", | ||
| "body": "LGTM", | ||
| "label_actions": { | ||
| "reason": "Adding label", | ||
| "actions": [ | ||
| { "action": "add", "label": "reviewed" } | ||
| ], | ||
| "priority": "high" | ||
| } | ||
| }' false | ||
|
|
||
| echo "" | ||
| if [ "${FAILURES}" -gt 0 ]; then | ||
| echo "${FAILURES} test(s) failed." | ||
| exit 1 | ||
| else | ||
| echo "All tests passed." | ||
| fi | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -105,7 +105,7 @@ | |
| "$defs": { | ||
| "finding": { | ||
| "type": "object", | ||
| "required": ["severity", "category", "file", "description"], | ||
| "required": ["severity", "category", "file", "description", "verified_variables", "unchecked_variables"], | ||
|
ben-alkov marked this conversation as resolved.
qodo-code-review[bot] marked this conversation as resolved.
ben-alkov marked this conversation as resolved.
ben-alkov marked this conversation as resolved.
ben-alkov marked this conversation as resolved.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [medium] backward-incompatible Making verified_variables and unchecked_variables required on the finding definition forces all finding producers across all review dimensions to emit empty arrays for fields semantically meaningful only for the security sub-agent. Consider making these fields optional or conditionally required for security-related categories only.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We made the conscious decision for them to be always required
ben-alkov marked this conversation as resolved.
ben-alkov marked this conversation as resolved.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [medium] breaking-schema Adding verified_variables and unchecked_variables to the required array is a backward-incompatible schema change. The companion fullsend PR (#2363) was CLOSED, not merged. AGENTS.md section 6 documents lockstep versioning between repos. Suggested fix: Open a new companion PR in fullsend-ai/fullsend that updates the Finding Go struct in internal/cli/postreview.go, and link it from this PR's description. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [low] schema-compatibility The new fields are required rather than optional. Any existing or external producer of findings without them will fail schema validation immediately. Adding as optional would have preserved backward compatibility while allowing producers to adopt at their own pace. |
||
| "properties": { | ||
| "severity": { "type": "string", "enum": ["critical", "high", "medium", "low", "info"] }, | ||
| "category": { "type": "string", "minLength": 1 }, | ||
|
|
@@ -115,7 +115,17 @@ | |
| "remediation": { "type": "string" }, | ||
| "actionable": { | ||
| "type": "boolean", | ||
| "description": "When true with a non-empty remediation, routes the verdict to request-changes so the fix agent can address the finding automatically." | ||
| "description": "True when this non-blocking finding should be tracked as a follow-up issue if the review approves." | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [low] scope-creep The PR changes the actionable field's schema description from 'When true with a non-empty remediation, routes the verdict to request-changes...' to 'True when this non-blocking finding should be tracked as a follow-up issue if the review approves.' This semantic change is not authorized by issue #2095. |
||
| }, | ||
| "verified_variables": { | ||
|
ben-alkov marked this conversation as resolved.
|
||
| "type": "array", | ||
| "items": { "type": "string", "minLength": 1 }, | ||
| "description": "Variables in the security-sensitive context that were verified as having the security control applied." | ||
| }, | ||
| "unchecked_variables": { | ||
| "type": "array", | ||
| "items": { "type": "string", "minLength": 1 }, | ||
| "description": "Variables in the security-sensitive context that were not verified as having the security control applied." | ||
| } | ||
| }, | ||
| "additionalProperties": false | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[high] logic-error
The jq example heading says 'For request-changes (including actionable low/info findings) or reject:' but the jq command uses --arg action "approve". This heading/content mismatch could cause an agent following the first template to emit action: "approve" when it intends to emit request-changes.
Suggested fix: Change the heading at line 303 to 'For approve with actionable low/info findings:' to match the --arg action "approve" in the jq example below it.