Skip to content

fix(rulesets): use bare numeric external-name for repository rulesets#72

Merged
devantler merged 1 commit into
mainfrom
claude/fix-repository-ruleset-external-names
Jun 27, 2026
Merged

fix(rulesets): use bare numeric external-name for repository rulesets#72
devantler merged 1 commit into
mainfrom
claude/fix-repository-ruleset-external-names

Conversation

@devantler

Copy link
Copy Markdown
Contributor

Why

The two RepositoryRuleset resources are stuck SYNCED=False and the
provider-upjet-github controller errors on every reconcile, which Coroot
surfaces on prod as recurring CannotObserveExternalResource events:

observe failed: ... Unexpected ID format ("ksail:14699634"), expected numerical
ID. strconv.ParseInt: parsing "ksail:14699634": invalid syntax

Root cause

crossplane.io/external-name was set to the Terraform import-id form
<repo>:<ruleset_id> (ksail:14699634, platform:5275020) instead of the
bare numeric ruleset id the provider actually stores. RepositoryRuleset is
config.IdentifierFromProvider — same as the OrganizationRuleset siblings in
../organization-rulesets/, which all use bare numeric ids ("6986186", …) and
sync fine. The provider strconv.ParseInts the external-name, so the <repo>:
prefix makes it unparseable and the resource never observes.

Fix

Strip the <repo>: prefix on both (the numeric part is already the correct id,
verified against the live GitHub API: ksail "Restrict deletions" = 14699634,
platform "Require merge queue" = 5275020) and correct the misleading
convention note in both files + the README.

Blast radius: none. Both are managementPolicies: ["Observe"] (read-only
adoption) — the provider only reads GitHub state, so this never modifies the
real rulesets; it just lets the observe succeed and populate status.atProvider.

kubectl kustomize deploy/repository-rulesets/ builds clean.

🤖 Generated with Claude Code

The two RepositoryRuleset resources set crossplane.io/external-name to the
Terraform *import* id format `<repo>:<ruleset_id>` (`ksail:14699634`,
`platform:5275020`) instead of the bare numeric ruleset id the upjet provider
stores (RepositoryRuleset is config.IdentifierFromProvider, exactly like the
working OrganizationRuleset siblings, which all use bare numeric ids and sync
fine). The provider strconv.ParseInt's the external-name and fails:

  observe failed: ... Unexpected ID format ("ksail:14699634"), expected
  numerical ID. strconv.ParseInt: parsing "ksail:14699634": invalid syntax

so both resources are stuck SYNCED=False and Coroot raises recurring
`CannotObserveExternalResource` events on prod. Strip the `<repo>:` prefix (the
numeric part is already the correct ruleset id, verified against the live GitHub
API) and fix the misleading convention note here and in the README. These are
managementPolicies: ["Observe"] (read-only) so there is zero blast radius on the
real GitHub rulesets.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@devantler devantler marked this pull request as ready for review June 27, 2026 09:46
@devantler devantler merged commit 1e9af49 into main Jun 27, 2026
8 checks passed
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