Skip to content

feat(OMN-10076): backfill_contracts script + impl - #465

Merged
jonahgabriel merged 2 commits into
mainfrom
jonah/omn-10076-backfill-impl
Apr 27, 2026
Merged

jonahgabriel merged 2 commits into
mainfrom
jonah/omn-10076-backfill-impl

Conversation

@jonahgabriel

Copy link
Copy Markdown
Contributor

Summary

  • Implements scripts/backfill_contracts.py for OMN-10076 (Task 14 of OMN-9582 contract auto-generation plan)
  • Removes all 5 xfail markers from tests/unit/scripts/test_backfill_contracts.py; all tests now pass as regular unit tests

What the script does

  • --range OMN-START:OMN-END (default OMN-123:OMN-9892) sweeps all ticket IDs in range
  • Per ticket: skip if contracts/OMN-XXXX.yaml exists (idempotent), tombstone if Linear 404, generate skeleton via generate_skeleton_contract() if found
  • --dry-run prints intended actions without writing
  • Fails fast with nonzero exit + clear message when LINEAR_API_KEY is absent
  • Reports: N generated, M skipped (exists), K tombstoned (not found), E errors

DoD evidence

  • 5 unit tests pass: uv run pytest tests/unit/scripts/test_backfill_contracts.py -v → 5 passed
  • Full suite: 1170 passed, 45 skipped, 0 failures
  • uv run mypy src/ scripts/backfill_contracts.py --strict → Success: no issues
  • uv run ruff format src/ scripts/ tests/ && uv run ruff check src/ scripts/ tests/ → All checks passed
  • pre-commit run --all-files → all 22 hooks passed
  • OMN-10061 trigger verified: git log --oneline origin/main | grep -q "OMN-10061" → exit 0

Scope

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]

@coderabbitai

coderabbitai Bot commented Apr 27, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@jonahgabriel has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 59 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 282f96dd-55f2-4ae9-a1fc-3af75bf4c64e

📥 Commits

Reviewing files that changed from the base of the PR and between 91fd4cb and ab0b059.

📒 Files selected for processing (2)
  • scripts/backfill_contracts.py
  • tests/unit/scripts/test_backfill_contracts.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jonah/omn-10076-backfill-impl

Comment @coderabbitai help to get the list of available commands and usage tips.

@jonahgabriel
jonahgabriel enabled auto-merge April 27, 2026 22:01
…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).
@jonahgabriel
jonahgabriel force-pushed the jonah/omn-10076-backfill-impl branch from a2db7c8 to ab0b059 Compare April 27, 2026 23:22
@jonahgabriel
jonahgabriel added this pull request to the merge queue Apr 27, 2026
Merged via the queue into main with commit efd8240 Apr 27, 2026
23 of 24 checks passed
@jonahgabriel
jonahgabriel deleted the jonah/omn-10076-backfill-impl branch April 27, 2026 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant