Which GitHub App clones a repo IS visible via the API — resolve source_id instead of the only-App heuristic #74
Labels
No labels
blocked
blocker:ci-red
blocker:conflict
blocker:drill-pending
blocker:unrequested
bug
claimed
documentation
enhancement
epic
merge-next
needs-triage
ready
release
scope:apply
scope:capture
scope:coolify-api
scope:fleet
scope:manifest
scope:secrets
stale
state:addressing
state:bots-reviewing
state:building
state:needs-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: heavy-duty/cast#74
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?
Summary
semantics.mdclaims "nothing Coolify returns about an application says which App cloned it", so cast binds every repo to the instance's only GitHub App when there is exactly one and writes aREVIEW-…marker when there is not. The #72 audit refuted the premise at tagv4.1.2:removeSensitiveDataon applications does not hidesource_id/source_type— both are returned byGET /applicationsandGET /applications/{uuid}(real columns,Application.phpfillable).GET /github-appsexists at v4.1.2 (routes/api.php:131-136) and returns each App'sid(anduuid; onlyclient_secret/webhook_secretare hidden,GithubController.php:18-23).So the association is resolvable via API:
application.source_id↔github-apps[].id, guarded bysource_typebeing the GithubApp morph class. The only-App heuristic and the REVIEW marker are unnecessary whenever the lookup succeeds.What to do
inventory/--emit-draft: resolve each application's GitHub App by joiningsource_idagainstGET /github-apps; emit the real binding instead of the only-App guesssemantics.mdgithub_appsparagraph and thedraft.tsNO_API_COVERAGErow ("which GitHub App clones a repo"), #51-stylePOST /github-apps+POST /security/keysexist at 4.1.2 — note insemantics.mdthat registration of an already-created App is API-doable (the GitHub-side Manifest flow stays manual; that's #7's territory, not this issue's)Caveats
GET /github-appsincludes other teams' system-wide Apps, resolving by id is still not a proxy for being in the right team — the existing team assert stays.private_key_uuid), #5467 (create times out with many repos).Found in #72 (finding 8).
Done in #82 (merged,
2cbcfd2) — first three boxes. The fourth is not done; see below.source_idagainstGET /github-apps—githubAppNameForProjectmatches each application'ssource_idto an App'sid, guarded bysource_typebeing the GithubApp morph. The only-App guess is gone.source_type(public repo), an id missing from the list, or an instance that will not list its Apps. Also guarded: asource_idthat collides with an App id but carries a non-GithubAppsource_typeis not mistaken for one.semantics.md'sgithub_appsparagraph + thedraft.tsNO_API_COVERAGErow (#51-style), plus the emittedenvironments.yamlheader.semantics.mdthat registration of an already-created App is API-doable (POST /github-apps+POST /security/keys). Not done — say the word and I'll send a follow-up; it's a few lines and adjacent to #5/#7.Worth recording: the old heuristic wasn't merely unnecessary, it was silently wrong on a single-App instance — a public repo (no GitHub App at all) got bound to the one App anyway. The
draft-clifixture now pins exactly that: the incubator app (source_id: 7) resolves tohdb-coolify, while the third-party public repo gets a REVIEW marker. Unit tests cover the multi-App case the heuristic could never handle (it wrote REVIEW on every repo; the lookup resolves each).The unticked fourth box (note that App registration is API-doable at 4.1.2) is now tracked in #84, so it isn't lost with this issue closed.