a3bb78e06b
Security Quality Gate / npm audit, Bandit, pip-audit, detect-secrets (pull_request) Failing after 16m35s
2.6 KiB
2.6 KiB
V2 Phase 3 Structured Review Recommendations
Date: 2026-07-01
Scope
This slice gives clause_recommendations a structured persistence path so recommendation cards are no longer only stored inside legacy review_tasks.risk_items JSON.
Changes
- Added
review_risk_recommendationstable via migration20260701_0024. - Added ORM model
ReviewRiskRecommendationModel. sync_structured_review_results(...)now rebuilds structured risks, citations, and risk recommendations from completed review task payloads.- Structured review risk API responses now include
clause_recommendations. ReviewTask.risk_itemsresponse overlay now synthesizesclause_recommendationsfrom structured recommendations when structured rows exist.- Frontend review display now prefers
StructuredReviewRisk.clause_recommendations, falling back to legacy risk JSON only when structured recommendations are absent. - Runtime schema check now requires
review_risk_recommendationsand its governance columns.
Compatibility
Legacy review_tasks.risk_items and review_tasks.citations are still written.
The new table is a structural landing point for recommendation cards; it is not a stop-write migration for legacy JSON yet.
Validation
python -m py_compile yuqei-contract-platform\services\contract-api\src\yuqei_contract_api\persistence\models.py yuqei-contract-platform\services\contract-api\src\yuqei_contract_api\persistence\review_results.py yuqei-contract-platform\services\contract-api\src\yuqei_contract_api\persistence\review_tasks.py yuqei-contract-platform\services\contract-api\src\yuqei_contract_api\schema_check.py yuqei-contract-platform\services\contract-api\src\yuqei_contract_api\review_results_backfill_cli.py
python -m pytest yuqei-contract-platform\services\contract-api\tests\test_contract_workflow.py::test_review_completion_keeps_legacy_json_as_display_cache -q
python -m pytest yuqei-contract-platform\services\contract-api\tests\test_contract_workflow.py -q -k "clause_repair"
python -m pytest yuqei-contract-platform\services\contract-api\tests\test_structured_review_results.py -q
npm run web:typecheck
Observed locally:
. [100%]
... [100%]
......... [100%]
Next Step
Run migration 20260701_0024 in the V2 smoke PostgreSQL environment, then run:
- runtime schema-check
- structured review backfill assess
- structured review backfill apply or force apply for smoke data
- review result page smoke for recommendation cards