maintainer-update #120

Manually merged
adamm merged 10 commits from maintainer-update into main 2026-02-03 13:11:06 +01:00
Owner

Update maintainership files inplace

Staggered with the pr-tests #106

Update maintainership files inplace Staggered with the pr-tests https://src.opensuse.org/git-workflow/autogits/pulls/106
adamm added 21 commits 2026-01-26 09:27:04 +01:00
- Add scenarios for closed/merged project PRs that trigger
   submodule checks and downstream PR updates (manual merge vs close).
- Test the "Consistency check" logic where submodules are reset
  if they don't match the PR set.
- Test the "superfluous PR" check (no-op PRs that should be closed).
- PullRequestWebhookEvent: Verified that PR events correctly
  trigger processing with all necessary Gitea and Git mocks.
- IssueCommentWebhookEvent: Verified that issue comment events
  (which Gitea often uses for PR comments) are handled correctly.
- Recursion Limit: Verified that the recursion protection logic
  correctly terminates and cleans up when the limit is reached.
- Invalid Data Format: Verified that non-event data types return
  appropriate errors.
- Uncomment and fix the existing tests for `synchronized` actions.
- Ensure it uses the new `PullRequestProcessor` interface and mocked dependencies.
Also,
- Add simple unit tests to verify mapping of `models.StateType`
  to internal event strings.
- Verify it correctly wraps `ProcesPullRequest` and handles panics
  via the deferred recovery block.
- Add tests for scenarios where `GetRecentPullRequests` fails.
- Verify the random sleep interval logic (can be tested by mocking
  `time.Sleep` if refactored, or verifying behavior with interval=0).
- Add a test case specifically verifying that `Gitea.SetLabels`
  is called with `staging/Auto` when a *new* project PR is created
  for submodules.
- Verify `PrjGitDescription` and `SetSubmodulesToMatchPRSet` behave
  correctly when a single `PRSet` contains 5+ different package
  repositories.
pr: move interfaces and mocks to parent package
Some checks failed
go-generate-check / go-generate-check (pull_request) Failing after 22s
18f7ed658a
pr: interfaces moved to main package
All checks were successful
go-generate-check / go-generate-check (pull_request) Successful in 7s
f959684540
utils: add maintainer-update to utils
All checks were successful
go-generate-check / go-generate-check (pull_request) Successful in 25s
f0b053ca07
adamm requested review from jzerebecki 2026-01-26 09:27:04 +01:00
Author
Owner

This one should probably be reviewed as one chunk instead of per-commit. If there are issues, I'll add new commits that fix these issues in review on top and I will not be rewriting history.

This one should probably be reviewed as one chunk instead of per-commit. If there are issues, I'll add new commits that fix these issues in review on top and I will not be rewriting history.
jzerebecki approved these changes 2026-02-03 11:01:41 +01:00
jzerebecki left a comment
Owner

Some problems listed inline, but can be fixed in follow ups.

Some problems listed inline, but can be fixed in follow ups.
@@ -130,2 +130,4 @@
-C utils/hujson \
-buildmode=pie
go build \
-C utils/maintainer-update \
Owner

Please also add this to %check

Please also add this to %check
adamm marked this conversation as resolved
@@ -0,0 +23,4 @@
common.PanicOnError(err)
common.PanicOnError(m.WriteMaintainershipFile(f))
common.PanicOnError(f.Close())
common.PanicOnError(os.Rename(filename+".new", filename))
Owner

fsync() missing before rename, without it risks loosing both files.

fsync() missing before rename, without it risks loosing both files.
Author
Owner

So, f.Sync() after f.Close() results in an error. I would assume that such files are flushed already to disk?

So, f.Sync() after f.Close() results in an error. I would assume that such files are flushed already to disk?
adamm marked this conversation as resolved
@@ -0,0 +93,4 @@
expectedError: "Failed to parse JSON",
},
{
name: "add and remove",
Owner

Test is somehow not implementing description, there is nothing being removed.

Test is somehow not implementing description, there is nothing being removed.
adamm marked this conversation as resolved
@@ -0,0 +145,4 @@
pkg = flag.String("package", "", "Package to modify")
rm = flag.Bool("rm", false, "Remove maintainer from package")
add = flag.Bool("add", false, "Add maintainer to package")
lint = flag.Bool("lint-only", false, "Reformat entire _maintainership.json only")
Owner

Move these into run() and remove the global calls, to not duplicate them from main.go and actually test them?

Move these into run() and remove the global calls, to not duplicate them from main.go and actually test them?
adamm marked this conversation as resolved
adamm added 3 commits 2026-02-03 12:21:08 +01:00
util: move flag parsing under run()
All checks were successful
go-generate-check / go-generate-check (pull_request) Successful in 22s
b19d301d95
adamm added 1 commit 2026-02-03 13:10:39 +01:00
utils: sync data when writing new maintainership file
All checks were successful
go-generate-check / go-generate-check (pull_request) Successful in 8s
478a3a140a
adamm manually merged commit 68b67c6975 into main 2026-02-03 13:11:06 +01:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: git-workflow/autogits#120