Fix: read attributes_total from the assessment*.json to set the max attribute expectations for schema validation#315
Conversation
…tribute expectations for schema validation
📈 Test Coverage Report
Coverage calculated from unit tests only |
AgentReady Code ReviewPR: Fix: read attributes_total from the assessment*.json to set the max attribute expectations for schema validation SummaryThis PR reads The intent is correct — the hardcoded 🔴 Critical Issues1. Schema is not restored on validation failureGitHub Actions bash steps exit on non-zero by default. If Fix: Use a 2. Race condition on concurrent CI runsThe schema file is part of the checked-out repo. If two leaderboard PRs are validated simultaneously on different runners that share a cached workspace, they will corrupt each other's schema modifications. Schema files should never be mutated as part of transient validation logic. 🟠 High Issues3. Allows non-comparable leaderboard submissionsThe leaderboard's value depends on all scores being computed against the same attribute set. Allowing submissions with 15–24 attributes means a 90/100 score from 15 attributes is displayed alongside a 90/100 score from 25 attributes with no indication they're different. This makes rankings misleading. Issue #309's Option A (clear rejection at submission time) maintains integrity: Competing fix: PR #312 (DRAFT) addresses the same issue by relaxing the schema to 4. Arbitrary minimum threshold of 15The magic number 🟡 Medium Issues5. Potential bash arithmetic injection
6. No tests addedThe PR checklist items for unit tests and integration tests are unchecked. Any change to validation logic should have corresponding test coverage. This is especially important given the schema-mutation approach being novel and potentially fragile. 🟢 Positive Observations
Recommendation: Request ChangesThe schema-mutation approach is fragile and introduces a race condition. The broken restore-on-failure is a correctness bug that will leave a corrupted schema in the workspace on any invalid submission — which is the exact common case this PR is meant to handle. Suggested path forward:
|
AgentReady Code Review — PR #315Reviewer: Claude Code (review-agentready) SummaryThis PR reads 🔴 Critical Issues1. Circular Validation — Schema Configured by Untrusted InputThe core problem: the submitted file's own A malicious submitter can set Correct fix: The valid range for 2. Schema Not Restored on Validation FailureIf Fix: Use a 3. No Upper Bound on
|
| Attribute | Status | Notes |
|---|---|---|
| Security — Input Validation | ❌ Fail | User-controlled value shapes the validator |
| Error Handling / Graceful Degradation | ❌ Fail | Schema not restored on failure |
| CI/CD Workflow Quality | Happy path works; brittle on error paths |
Recommended Fix
Update assessment-schema.json directly — replace "const": 25 with a range, and update the findings bounds to match:
"attributes_total": {
"type": "integer",
"minimum": 15,
"maximum": 50
},
"findings": {
"type": "array",
"minItems": 1,
"maxItems": 50,
...
}
This makes the schema permanently flexible without runtime mutation from untrusted input and eliminates all issues above.
Overall verdict: ❌ Request changes — the approach introduces a trust inversion that undermines the validation's security guarantee. The schema should be made permanently flexible rather than dynamically shaped by the input being validated.
AgentReady Code ReviewPR: #315 - Fix: read attributes_total from assessment*.json to set max attribute expectations for schema validation SummaryThis PR modifies Score Impact Analysis
Note: This PR only modifies a GitHub Actions workflow; no source assessors are affected. Security ReviewStatus: Expression Injection: The No Upper Bound on Code QualityStatus: 1. Conflicting with open PR #312 (blocking): Both this PR and PR #312 fix issue #309, but via different approaches:
PR #312's approach (static range in schema) is simpler, safer, and already includes regression tests. This PR should be evaluated against #312 and one approach chosen. Consider closing this PR in favor of #312, or defining which use case each serves. 2. Backup/restore does not use On ephemeral runners this doesn't affect persistence, but subsequent steps in the same job see a corrupted schema. A 3. In-place schema mutation pattern (low): Modifying a tracked source file in a CI job is a code smell. Prefer writing a temp file: This requires 4. Hard-coded minimum of 15 (low): The value 5. Test CoverageStatus: The PR checklist shows unit and integration tests were not run or added. No new tests are included for the minimum threshold logic or the dynamic schema modification. PR #312 includes regression tests for the same feature — consider whether those tests cover this approach, or add dedicated tests. DocumentationStatus: ✅ No action required The change is confined to a GitHub Actions workflow. No user-facing documentation update is needed. Required Changes
Suggested Improvements
AgentReady Compliance Notes
Review generated by AgentReady Specialist | AgentReady |
AgentReady Code Review — PR #315
SummaryThis takes a CI-level approach to the same issue fixed by PR #312 — dynamically patching the schema to match the submitted IssuesCriticalNo cleanup trap — schema file left modified on failure If Fix: Race condition — parallel PR validations corrupt the schema If two leaderboard submissions trigger simultaneously, both jobs modify the same Fix: avoid modifying the checked-in file entirely. Pass the expected count as a flag to MediumMinimum threshold inconsistency with PR #312 This PR uses
The jq filter assumes
Findings that are "skipped" status are still included in the findings array. Setting MinorPR description has malformed issue reference
Testing checklist is entirely unchecked No unit tests, integration tests, or manual testing are confirmed. Changes to CI validation logic should have at least manual testing evidence. What's Good
Attribute Impact
Verdict: Do not merge in current form. The race condition and missing cleanup trap are blocking issues. Recommend instead extending |
|
closing in favor of #312 |
Description
Read attributes_total from the json file and use it to temporarily modify specs/001-agentready-scorer/contracts/assessment-schema.json for validating the report.
Type of Change
Related Issues
Fixes # #309
Relates to #
Changes Made
Testing
pytest)Checklist
Screenshots (if applicable)
Additional Notes