test(api): prevent silent v1 OpenAPI breaking changes - #381
Conversation
|
Important Review available on request
Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📝 WalkthroughWalkthroughOpenAPI v1 호환성 기준선에 API 작업 정보를 추가했습니다. YAML 명세를 수집하고 작업, ChangesOpenAPI v1 호환성
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/openapi_v1_compatibility_contract.py`:
- Around line 32-82: Update collect_operations to parse the OpenAPI document
structurally as YAML instead of relying on exact indentation and raw string
formats, while preserving extraction of HTTP method, path, operationId, and
response keys. Ensure valid quoted paths, inline operationId comments, and
anchored responses values are handled correctly, and add regression tests
covering these formatting variants.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6994b3cc-c4ea-4703-bcde-83d6b8084ae0
📒 Files selected for processing (3)
scripts/openapi_v1_compatibility_baseline.jsonscripts/openapi_v1_compatibility_contract.pyscripts/test_openapi_v1_compatibility_contract.py
|
@opencode-agent review Review exact head Review read-only; preserve independent reviewer identity. Do not mutate the branch, synthesize author approval, weaken protection, or merge. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '== HEAD =='
git rev-parse HEAD
printf '%s\n' '== STATUS =='
git status --short
printf '%s\n' '== CHANGED FILES AGAINST FIRST PARENT =='
git diff --name-status HEAD^ HEAD
printf '%s\n' '== DIFF =='
git diff --no-ext-diff --unified=80 HEAD^ HEAD -- \
scripts/openapi_v1_compatibility_contract.py \
scripts/openapi_v1_compatibility_baseline.json \
scripts/test_openapi_v1_compatibility_contract.py
printf '%s\n' '== PYTHON OUTLINE =='
ast-grep outline scripts/openapi_v1_compatibility_contract.py --items all --view expanded
printf '%s\n' '== RELATED WORKFLOW OR SCRIPT REFERENCES =='
rg -n -C 3 --glob '!scripts/openapi_v1_compatibility_contract.py' --glob '!scripts/test_openapi_v1_compatibility_contract.py' \
'openapi_v1_compatibility_contract|openapi_v1_compatibility_baseline|compatibility contract' .Length of output: 2404 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '== PR METADATA =='
gh pr view 381 --repo ContextualWisdomLab/clearfolio \
--json number,baseRefName,baseRefOid,headRefName,headRefOid,commits,files \
--jq '{number, baseRefName, baseRefOid, headRefName, headRefOid, commits: [.commits[] | {oid:.oid,messageHeadline:.messageHeadline}], files: [.files[].path]}'
printf '%s\n' '== COMPATIBILITY-GATE COMMITS REACHABLE FROM HEAD =='
git log --oneline --decorate --all -- \
scripts/openapi_v1_compatibility_contract.py \
scripts/openapi_v1_compatibility_baseline.json \
scripts/test_openapi_v1_compatibility_contract.py
printf '%s\n' '== CHECKER =='
cat -n scripts/openapi_v1_compatibility_contract.py
printf '%s\n' '== BASELINE =='
cat -n scripts/openapi_v1_compatibility_baseline.json
printf '%s\n' '== TESTS =='
cat -n scripts/test_openapi_v1_compatibility_contract.py
printf '%s\n' '== OPENAPI CANDIDATE FILES =='
fd -HI -t f -i 'openapi|swagger' . | sed -n '1,160p'Length of output: 16785 🏁 Script executed: #!/bin/bash
set -euo pipefail
base='961f44a19c4ced87f8062b3ab9842a9a08d05235'
head='d5407a24c646abf08f41c1ebb393687795599747'
printf '%s\n' '== PR DIFF AGAINST MAIN =='
git diff --no-ext-diff --unified=40 "$base" "$head" -- \
scripts/openapi_v1_compatibility_contract.py \
scripts/openapi_v1_compatibility_baseline.json \
scripts/test_openapi_v1_compatibility_contract.py
printf '%s\n' '== PYTHON TEST AND CI CONFIGURATION =='
fd -HI -t f 'pyproject.toml|pytest.ini|tox.ini|setup.cfg|Pipfile|requirements.*|.*\.ya?ml' . \
| grep -E '(^|/)(pyproject\.toml|pytest\.ini|tox\.ini|setup\.cfg|Pipfile|requirements[^/]*|\.github/workflows/[^/]+\.ya?ml)$' \
| while IFS= read -r f; do
printf '\n--- %s ---\n' "$f"
rg -n -C 4 -i 'pytest|python|scripts/test|openapi_v1|test_.*\.py' "$f" || true
done
printf '%s\n' '== OPENAPI PATHS STRUCTURE AND COMPATIBILITY OPERATIONS =='
rg -n -C 3 \
'^(paths:| /api/v1/(analytics/kpi-snapshot|analytics/kpi-snapshot-exports|convert/jobs|viewer/)| (get|post):| operationId:| responses:| (200|202|400|401|403|404|409):)' \
docs/deployment/clearfolio-buyer-connector.openapi.yaml
printf '%s\n' '== BASELINE MODIFICATION GUARDS =='
rg -n -i -C 3 \
'openapi_v1_compatibility_baseline|compatibility baseline|baseline.*(immutable|protected|hash|checksum)|immutable.*baseline' \
.github scripts README.md docs pyproject.toml pytest.ini tox.ini setup.cfg 2>/dev/null || trueLength of output: 25307
I found one blocking issue.
You are interacting with an AI system. |
Objective
Advance issue #315 with a deterministic v1 compatibility gate so repository-owned OpenAPI changes cannot silently remove an existing operation, rename its
operationId, or remove an advertised response status without an explicit version/baseline decision.Exact current-head evidence
961f44a19c4ced87f8062b3ab9842a9a08d05235;d5407a24c646abf08f41c1ebb393687795599747;Compatibility contract
The checker parses the repository-owned OpenAPI structure, normalizes actual HTTP operations, and compares path/method, stable
operationId, and advertised response-status sets against the checked-in v1 baseline. Removal, identity change, or response-status removal fails closed. Additive operations and response statuses remain compatible. Formatting variants such as quoted paths, inline comments, and supported anchored response mappings are covered by regression tests.Scope boundary
Offline compatibility checker and baseline only. This does not change the public OpenAPI, controllers, DTOs, runtime negotiation, generated clients, naruon integration, or release schema provenance. Issue #315 remains open for those guarantees.
Merge gate
Keep this exact head unchanged. Auto-merge may act only after live required checks remain terminal-success, zero valid unresolved findings remain, and a qualifying independent non-author approval is attached to this exact head. Any head/base movement requires complete exact-head revalidation; predecessor evidence does not transfer.