Skip to content

BED-9505: canonicalize organization login before collection - #45

Merged
jaredcatkinson merged 1 commit into
mainfrom
fix/BED-9505-canonicalize-org-login
Aug 28, 2026
Merged

BED-9505: canonicalize organization login before collection#45
jaredcatkinson merged 1 commit into
mainfrom
fix/BED-9505-canonicalize-org-login

Conversation

@jaredcatkinson

@jaredcatkinson jaredcatkinson commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Canonicalize org-only collection contexts from GitHub's returned organization login before resource fan-out so downstream resources use the same org_login value as the organizations table. Reuse the preflight organization response through a small cache and add regression coverage for token and org-app collection paths.

Testing: uv run pytest tests/test_source_org_canonicalization.py tests/test_org_scim_resources.py tests/test_app_auth.py tests/test_error_resilience.py

Lint: uv run ruff check src/openhound_github/source.py src/openhound_github/resources/organization.py tests/test_source_org_canonicalization.py

Summary by CodeRabbit

  • Improvements

    • Organization names are now standardized to their official GitHub login names before related resources are loaded.
    • Organization lookups are reused during processing, improving efficiency and avoiding repeated requests.
    • If an organization cannot be resolved, processing continues with a warning instead of failing entirely.
  • Tests

    • Added coverage for organization-name standardization, cached lookups, and supported authentication methods.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c83701ae-cc30-469b-9dd0-03234e712a9d

📥 Commits

Reviewing files that changed from the base of the PR and between 40de52a and c6a2958.

📒 Files selected for processing (3)
  • src/openhound_github/resources/organization.py
  • src/openhound_github/source.py
  • tests/test_source_org_canonicalization.py

Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


Walkthrough

Organization sources now canonicalize configured organization names through GitHub, cache valid responses, and reuse those responses when generating organization resources. Tests cover canonicalization, cache reuse, and both token and GitHub App sources.

Changes

Organization canonicalization and caching

Layer / File(s) Summary
Canonicalize source organizations
src/openhound_github/source.py, tests/test_source_org_canonicalization.py
SourceContext stores organization responses. Source initialization resolves canonical logins, caches valid responses, and applies the flow to organization-app and token-based sources.
Reuse cached organization responses
src/openhound_github/resources/organization.py, tests/test_source_org_canonicalization.py
The organizations resource uses _cached_org_response and avoids repeating the organization lookup. Tests verify the expected permission requests.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to c6a29

This PR canonicalizes organization login values before resource collection and adds regression coverage; no actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant SourceInitialization
  participant GitHubRESTClient
  participant SourceContext
  participant OrganizationResource
  SourceInitialization->>GitHubRESTClient: Fetch configured organization
  GitHubRESTClient-->>SourceInitialization: Return canonical login and response
  SourceInitialization->>SourceContext: Store canonical name and response
  OrganizationResource->>SourceContext: Read organizations_cache
  SourceContext-->>OrganizationResource: Return cached organization response
  OrganizationResource->>GitHubRESTClient: Request organization permissions
Loading

Suggested reviewers: d3vzer0

Poem

A rabbit hops through names unseen
And finds each login, crisp and clean
The cache holds responses tight
Resources skip the lookup flight
Token and App paths now agree
With tests that guard the harmony

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: canonicalizing the organization login before collection.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/BED-9505-canonicalize-org-login

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

@jaredcatkinson
jaredcatkinson merged commit 248e23d into main Aug 28, 2026
3 checks passed
@jaredcatkinson
jaredcatkinson deleted the fix/BED-9505-canonicalize-org-login branch August 28, 2026 19:36
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.

2 participants