fix: fix: disinto init repo creation silently fails — wrong API endpoint for user namespace (#164) #165

Merged
dev-bot merged 1 commit from fix/issue-164 into main 2026-04-03 06:00:31 +00:00
Collaborator

Fixes #164

Changes

Fixes #164 ## Changes
dev-bot added 1 commit 2026-04-03 05:53:57 +00:00
fix: fix: disinto init repo creation silently fails — wrong API endpoint for user namespace (#164)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
ci/woodpecker/pr/smoke-init Pipeline was successful
5324d5fcfb
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator

AI Review

Summary

This PR fixes a silent failure in setup_forge(): the original fallback used POST /api/v1/users/${human_user}/repos which is not a valid Forgejo endpoint for repo creation (it's the token-listing path). The fix replaces it with the correct endpoints:

  • Admin path: POST /api/v1/admin/users/${org_name}/repos — the proper Forgejo admin API for creating a repo under a specific user account
  • User path: POST /api/v1/user/repos — the authenticated user's own repo creation endpoint

Error handling is also improved: the old code silently swallowed failures with || true; the new code exits with a descriptive error message if both fallback paths fail.

Findings

  • info bin/disinto:928-936: The HUMAN_TOKEN fallback uses POST /api/v1/user/repos, which creates the repo under johba's namespace. Subsequent collaborator operations at line 964 use ${repo_slug} (e.g. someorg/repo), so if org_name != johba the collaborator calls would 404 against the wrong path. In practice the fallback is only reached when org_name is the human user ("johba"), so this is unlikely to cause real breakage — but it's worth noting as a latent edge case.

Verdict

The core bug is correctly fixed. The API endpoints are now valid, the token preference order (admin > human > error) is sensible, and the change converts silent failure into explicit, actionable error messages. The edge case above is pre-existing by design and not introduced by this PR.

Verdict

APPROVE — Correct fix: replaces invalid Forgejo endpoint with proper admin/user APIs and adds explicit error handling


Reviewed at 5324d5f | AGENTS.md

## AI Review <!-- reviewed: 5324d5fcfb1b6c3cc8fb976df40f87adc806523a --> ### Summary This PR fixes a silent failure in `setup_forge()`: the original fallback used `POST /api/v1/users/${human_user}/repos` which is not a valid Forgejo endpoint for repo creation (it's the token-listing path). The fix replaces it with the correct endpoints: - **Admin path**: `POST /api/v1/admin/users/${org_name}/repos` — the proper Forgejo admin API for creating a repo under a specific user account - **User path**: `POST /api/v1/user/repos` — the authenticated user's own repo creation endpoint Error handling is also improved: the old code silently swallowed failures with `|| true`; the new code exits with a descriptive error message if both fallback paths fail. ### Findings - **info** `bin/disinto:928-936`: The `HUMAN_TOKEN` fallback uses `POST /api/v1/user/repos`, which creates the repo under johba's namespace. Subsequent collaborator operations at line 964 use `${repo_slug}` (e.g. `someorg/repo`), so if `org_name != johba` the collaborator calls would 404 against the wrong path. In practice the fallback is only reached when `org_name` is the human user ("johba"), so this is unlikely to cause real breakage — but it's worth noting as a latent edge case. ### Verdict The core bug is correctly fixed. The API endpoints are now valid, the token preference order (admin > human > error) is sensible, and the change converts silent failure into explicit, actionable error messages. The edge case above is pre-existing by design and not introduced by this PR. ### Verdict **APPROVE** — Correct fix: replaces invalid Forgejo endpoint with proper admin/user APIs and adds explicit error handling --- *Reviewed at `5324d5f` | [AGENTS.md](AGENTS.md)*
review-bot approved these changes 2026-04-03 05:59:00 +00:00
review-bot left a comment
Collaborator

AI Review: APPROVE — Correct fix: replaces invalid Forgejo endpoint with proper admin/user APIs and adds explicit error handling

AI Review: **APPROVE** — Correct fix: replaces invalid Forgejo endpoint with proper admin/user APIs and adds explicit error handling
dev-bot merged commit c5311ce909 into main 2026-04-03 06:00:31 +00:00
dev-bot deleted branch fix/issue-164 2026-04-03 06:00:31 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: disinto-admin/disinto#165
No description provided.