Merged
Conversation
* set fork-related context data * show submit button based on permissions * add ForkAndEdit field to EditRepoFileForm * modify EditFilePost to handle fork creation and commit to fork * reuse existing fork if user already has one
* query repos by owner and subject * check for existing user repo for subject * disable edit/fork buttons when user already has a repo for the subject * show message in edit view explaining why editing is disabled
* fix wrong error condition (returned on any error, not just 'not found') * fix double increment bug (i++ in loop body + loop increment) * optimise from O(n) queries to single query with hash set lookup O(1) * add proper error logging
* run subject ownership check and fork detection concurrently
* add error for subject ownership violations * validate subject ownership before forking
* fix POST handler to validate subject ownership
* create IDX_repository_owner_subject and IDX_repository_owner_fork * optimizes GetRepositoryByOwnerIDAndSubjectID() and GetForkedRepo() queries
* replace 'Cannot Edit' button with 'Edit Your Article' action link * add translation keys for fork-on-edit error messages * link users to their existing article when subject ownership blocks editing
* simplify fork_and_edit hidden field to only use .NeedsFork * extract repeated nil-guard pattern into $subjectName template variable
* add Playwright tests for modal appearance, cancel actions, and tooltip * test modal shows correct header, content, and button text * verify cancel button and Escape key close modal without action * verify fork button has tooltip with confirmation message
* add repository owner tests for Submit Changes button behavior * add non-owner tests for Fork button and disabled submit button * add unauthenticated user test for sign-in button
* accessibility tests verify Enter opens modal, Tab navigates buttons, and buttons have proper accessible text content * unique name tests verify suffix generation when base name is taken
* use RepoOperationsLink instead of RepoLink in form action url * bypass fork_and_edit in CanWriteToBranch middleware to allow non-owners to reach the EditFilePost handler * skip NeedFork workflow when ForkAndEdit is true to prevent conflicting fork creation attempts
* CheckForkOnEditPermissions for owner/non-owner/unauthenticated * CanWriteToBranch middleware bypass with fork_and_edit=true * existing fork detection using fixture data (repo11/repo10) * subject ownership blocking prevents duplicate forks * form action URL uses RepoOperationsLink not RepoLink
* slug generation migration covering basic slugs, mixed-case deduplication, special characters, unique constraint verification, and empty table handling * index creation, idempotency, and index type verification
…order * fork API behavior when user already owns a repository for the same subject * fork blocked by subject ownership (403), fork succeeds for user without subject repo (202), fork blocked even with custom name (403) * fix error handling order in CreateFork
* update GetForkedRepo signature to return (*Repository, error) * update all callers to handle the new error return value * fixes silent error swallowing
* fix modal promise resolution pattern * add PathEscapeSegments to article template URL * update test comment to list all removed special characters
* trim commit_summary form field before evaluating if it's empty * add test to verify whitespace-only commit_summary uses default message
… errors * replace blanket ServerError with proper error type discrimination * handle stale commit ID (ErrCommitIDDoesNotMatch) as JSONError with user-friendly message * handle concurrent push (ErrPushOutOfDate) as JSONError with same message * handle missing file (ErrRepoFileDoesNotExist, ErrNotExist) as JSONError * add test to verify stale commit ID returns JSONError instead of HTTP 500
… handlers * ViewPullEdit: surface I/O / corruption errors immediately instead of masking them by falling through to README.md * SubmitPullEditPost: same guard in the candidate-probe loop so a real read error on @README.md cannot cause a silent write to the wrong path
* replace hard-coded default with new repo.editor.update_article key * add server-side guard: reject an empty computed commit message with repo.editor.commit_message_required
…CommitID * add to the owner's edit form to satisfy server-side validation that rejects empty commit_choice with HTTP 400
…StaleCommitID * the _edit endpoint's middleware chain couldn't resolve the PR head branch created by submit-change-request, causing HTTP 400 * API endpoint is simpler and more reliable for programmatic file updates
* replace GetCommit(branchName) with GetBranchCommit() (correct API) * fix stale-review test: expect 404 from CommitID gate, add fresh review step before testing stale POST
* InternalPush bypasses post-receive hooks, leaving the branch only in git but not in the database branch table * subsequent API calls that check branch existence via the DB (e.g. ChangeRepoFiles) fail with 'branch does not exist' (HTTP 404) * call SyncBranchesToDB right after creating the branch to ensure consistency between git and the database
* cleanupOrphanedBranch now removes the soft-deleted DB record after DeleteBranch, since the branch was never meant to exist * fixes TestSubmitChangeRequestPRCreationFailureCleanup which expected no trace of the orphaned branch after PR creation failure
taoeffect
approved these changes
Mar 10, 2026
Member
taoeffect
left a comment
There was a problem hiding this comment.
Great work @pedrogaudencio!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
refs/pull/N/headafterSubmitPullEditPostCloses /issues/145
Notes: depends on /pull/152
Co-authored by: Claude Opus 4.6, Sonnet 4.6 and Haiku 4.5