feat: cheat sheet → CRE mapping suggestion contract (Workstream F, F1–F2) - #1022
feat: cheat sheet → CRE mapping suggestion contract (Workstream F, F1–F2)#1022skypank-coder wants to merge 1 commit into
Conversation
…1+F2) Adds the review-artifact data contract for the Cheat Sheet -> CRE mapping pipeline (Workstream F), checkpoints F1 and F2 only: - SUGGESTIONS_SCHEMA: JSON Schema for the suggestions.json document - CandidateCRE / MappingSuggestion dataclasses - write_suggestions_json: deterministic, self-validating writer - load_approved_suggestions: schema-validate -> parse -> filter to approved, raising SuggestionSchemaError (naming the offending field) on violation F3 (suggestions_to_parse_result) and F4/F5 (CLI) are separate follow-ups. Includes golden valid/invalid fixtures and 8 unit tests (no Postgres needed).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan includes up to 2 reviews per rolling hour; 1 remains after this review. Summary by CodeRabbit
WalkthroughAdds the Workstream F suggestion schema, candidate and mapping dataclasses, deterministic JSON serialization, schema validation, approved-suggestion loading, malformed-input handling, and tests with valid and invalid fixtures. ChangesWorkstream F suggestion artifacts
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This PR adds an offline, schema-validated suggestion contract with deterministic read/write behavior; no actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
What & why
First slice of Workstream F from the "Autonomous LLM Pipeline for Cheat Sheet → CRE
Mapping" RFC: the suggestions.json data contract (checkpoints F1–F2). This is the
review-first artifact schema the rest of the pipeline reads and writes; landing it
alone lets the contract be reviewed before the adapter and CLI build on it.
Scope (F1–F2 only)
SUGGESTIONS_SCHEMA— JSON Schema (draft-07) for the §4 suggestion item;additionalProperties: false, required-field lists,status/confidenceenums,scorebounded [0,1].CandidateCRE+MappingSuggestiondataclasses (advisory fields carried through).write_suggestions_json— deterministic (sorted keys, self-validates before writing).load_approved_suggestions— validate → parse → filterstatus == "approved";violations raise
SuggestionSchemaErrornaming the offending field path.Not in this PR (follow-ups)
suggestions_to_parse_result(the import adapter — touches defs.Standard /ParseResult / Node_collection). The reconciliation design (title→section,
build_tags/validate_classification_tags, fixed name="OWASP Cheat Sheets", skip
zero-link Standards, drop advisory fields) is captured as docstring notes for that PR.
Tests
8 tests, no Postgres/Neo4j needed: valid fixture validates, invalid fixture fails schema,
malformed load raises a field-named error, only-approved filtering, nested CandidateCRE
parsing, write→load round-trip, write determinism, written file re-validates.
Notes
jsonschemais a dev dependency — F is offline import tooling, matching existingrepo usage (application/tests/librarian/*). Promote to requirements.txt if F ever runs
in prod.
jsonschemamissing library stubs (import-untyped), consistent withexisting modules; repo has no mypy gate.