Make Kodus rules repository suitable as a source for AI code reviews #3
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thidev/Kodus-rules#3
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
This repository is intended to be the living source of rules used by an AI reviewer for repository and pull-request reviews. The current rules are useful, but the repository needs an explicit, machine-consumable contract so findings are precise, consistent, actionable, and safely mapped to GitHub review verdicts.
Requested work
1. Define and validate a rule schema
Add a documented schema (JSON Schema or equivalent) and CI validation for every rule file. Require, where applicable: a stable immutable rule ID, title, category, severity, scope (
file,diff, orpull-request), language/framework applicability, path/include/exclude globs, detection guidance, exceptions and false-positive guidance, remediation guidance, and valid positive/negative examples. Reject malformed, duplicate, or incomplete rules in CI.2. Normalize severity and verdict semantics
Document one severity model and its mapping to reviewer output:
critical: security breach, data loss/corruption, outage, or critical auth/payment failure; blocks merge;high: important broken behavior, unsafe authorization, or severe reliability/performance issue; normally blocks merge;medium: recoverable defect or meaningful risk; normally non-blocking unless project policy says otherwise;low: minor quality or maintainability issue; informational.Explicitly distinguish correctness issues from warnings and prevent style-only rules from becoming blocking findings. Define
REQUEST_CHANGES,COMMENT, andAPPROVEbehavior.3. Define a GitHub-compatible finding format
Specify a canonical finding containing rule ID/title, severity, file path, exact changed line or range when possible, concise technical problem, impact, correction, confidence, and blocking status. Document behavior for findings outside changed lines, missing locations, and uncertainty. Do not fabricate locations; security/auth uncertainty must fail closed.
4. Improve rule quality and consistency
Review existing rules for stable language conventions, consistent terminology/severity, narrow applicability paths, explicit exceptions, testable criteria, contradictory/duplicate coverage, and examples matching the rule text. Add checks for duplicate IDs/titles, invalid paths, missing examples, and severity/scope mismatches.
5. Add high-value missing checks
Consider explicit rules for SSRF, unsafe pagination/offset/limit/index validation (including negative values), insecure security fallbacks, timing attacks, case-normalization bypasses, TOCTOU/race conditions, cleanup on all lifecycle exits, transaction boundaries/idempotency/retries, tenant isolation, and sensitive data exposure in logs/errors/responses/telemetry/URLs.
6. Document project-context contracts
Document how consumers provide repository instructions, architecture constraints, linked repositories, API contracts, acceptance criteria, generated-code/migration exceptions, severity overrides, ignored paths, and language/framework selection. Make precedence explicit so policies cannot silently conflict.
7. Version and synchronize safely
Add a rule-set version/manifest and document compatibility, pinning by commit/tag, breaking changes, SHA verification, and failure behavior when the source is unavailable or invalid. Security-sensitive reviews must never silently use an old or partial rule set.
8. Test the rules
Add fixture-based tests for positive/negative examples, exceptions, zero/one/many cases, selection across multiple files, hostile inputs, concurrency-sensitive cases, expected severity/blocking status, and locations. Important rules should demonstrate failing behavior before the corresponding fix and passing behavior afterward.
9. Document contribution workflow
Add CONTRIBUTING guidance for adding/modifying rules, choosing severity, writing examples, running validation, and reviewing rule changes. Require contributors to identify sibling call sites/backends/exit paths and state what was not verified.
Acceptance criteria
Non-goals