fix: fix: disinto init repo creation silently fails — wrong API endpoint for user namespace (#164) #165
No reviewers
Labels
No labels
action
backlog
blocked
bug-report
in-progress
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
tech-debt
underspecified
vision
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#165
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-164"
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?
Fixes #164
Changes
AI Review
Summary
This PR fixes a silent failure in
setup_forge(): the original fallback usedPOST /api/v1/users/${human_user}/reposwhich is not a valid Forgejo endpoint for repo creation (it's the token-listing path). The fix replaces it with the correct endpoints:POST /api/v1/admin/users/${org_name}/repos— the proper Forgejo admin API for creating a repo under a specific user accountPOST /api/v1/user/repos— the authenticated user's own repo creation endpointError 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
bin/disinto:928-936: TheHUMAN_TOKENfallback usesPOST /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 iforg_name != johbathe collaborator calls would 404 against the wrong path. In practice the fallback is only reached whenorg_nameis 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.mdAI Review: APPROVE — Correct fix: replaces invalid Forgejo endpoint with proper admin/user APIs and adds explicit error handling