Repository navigation
feat(OMN-10076): backfill_contracts script + impl - #465
Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
…arkers Implements `scripts/backfill_contracts.py`: - `generate_for_ticket()` — idempotent per-ticket contract generator; skips existing files, tombstones Linear-404 tickets, generates skeleton YAML for found tickets via `generate_skeleton_contract()`. - `_build_linear_client()` — patchable factory for the thin HTTP Linear client. - `main()` — CLI with `--range OMN-START:OMN-END`, `--dry-run`, `--contracts-dir`; fails fast on missing LINEAR_API_KEY. - Custom exception hierarchy (EM/TRY003 compliant): `_GeneratorNotFoundError`, `_LinearAPIError`, `_RangeParseError`. Removes all five `xfail` markers from `tests/unit/scripts/test_backfill_contracts.py`. All 5 tests now pass; full suite (1170 passed, 45 skipped) green. mypy --strict clean, ruff clean, all pre-commit hooks pass.
issueSearch returns fuzzy results — OMN-10 could match OMN-100. After the search returns nodes, filter to the node whose identifier field exactly equals the requested ticket_id. If no node matches exactly, treat the ticket as not found (tombstone path). Addresses hostile-reviewer finding #1 (high confidence).
a2db7c8 to
ab0b059
Compare
Summary
scripts/backfill_contracts.pyfor OMN-10076 (Task 14 of OMN-9582 contract auto-generation plan)xfailmarkers fromtests/unit/scripts/test_backfill_contracts.py; all tests now pass as regular unit testsWhat the script does
--range OMN-START:OMN-END(defaultOMN-123:OMN-9892) sweeps all ticket IDs in rangecontracts/OMN-XXXX.yamlexists (idempotent), tombstone if Linear 404, generate skeleton viagenerate_skeleton_contract()if found--dry-runprints intended actions without writingLINEAR_API_KEYis absentN generated, M skipped (exists), K tombstoned (not found), E errorsDoD evidence
uv run pytest tests/unit/scripts/test_backfill_contracts.py -v→ 5 passeduv run mypy src/ scripts/backfill_contracts.py --strict→ Success: no issuesuv run ruff format src/ scripts/ tests/ && uv run ruff check src/ scripts/ tests/→ All checks passedpre-commit run --all-files→ all 22 hooks passedgit log --oneline origin/main | grep -q "OMN-10061"→ exit 0Scope
This PR implements the script only. Bulk execution across the full range is OMN-10073 (separate ticket), blocked on explicit trigger verification.
Related
[skip-receipt-gate: OMN-10076 contract attached inline above]