fix: validate gitea_edit_pr no-fields before authentication (#43) #44
Reference in New Issue
Block a user
Delete Branch "fix/issue-43-edit-pr-validate-before-auth"
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?
Closes #43.
Problem
gitea_edit_prcalled_auth()(and resolved the remote) before checking whether any editable field was provided. A pure validation error (no fields) then surfaced asRuntimeError: No credentials …in environments without Gitea auth — makingtests/test_mcp_server.py::TestEditPR::test_edit_pr_no_fields_raisesdepend on credentials/network/env.Fix
Move the payload build + no-fields
ValueErrorahead of_resolve/_auth/URL setup. When fields are provided the path is unchanged (_resolve→_auth→ auditedPATCH). No change to auth, retry/backoff, audit, config profiles, or worktree helpers; no secrets/env touched.Tests
test_edit_pr_no_fields_validates_before_auth: no-fields call raisesValueErrorand calls neitherget_auth_headernorapi_request(auth mocked toNone).test_edit_pr_success/test_edit_pr_no_fields_raisesunchanged.Checks
mcp_server.py,tests/test_mcp_server.py).TestEditPR: 3 passed..envcreds): 287 passed, 0 failures, 0 errors — proving the no-fields test no longer depends on the environment. (JUnit XML; harness swallows pytest stdout on multi-file runs.)git diff --check: clean.Files changed
mcp_server.py,tests/test_mcp_server.py.Process
Done in an isolated worktree per the new standard:
./scripts/worktree-start fix/issue-43-edit-pr-validate-before-auth→branches/fix-issue-43-edit-pr-validate-before-auth.⚠️ Authored by me — do not self-merge. Needs review by another author.
Pull request closed