Replace cropperjs, which was stuck on v1 because v2 was too complex to
migrate to, with `@github/image-crop-element`, the cropper GitHub uses
(2.3 KB vs 14.5 KB gzipped). A full selection of a square image uploads
the original file so animated avatars keep working, any other selection
uploads the selected square as PNG.
Custom element events are now typed via `HTMLElementEventMap`, removing
event casts.
<img width="208" height="208" alt="Avatar crop panel with the Gitea
logo"
src="https://github.com/user-attachments/assets/dbdc2744-592a-45ea-91d2-356c34a0d52b">
Ref: https://github.com/go-gitea/gitea/pull/33827
Assisted-by: Claude Code:claude-opus-5-5
The issue timeline API paged the comment query and then dropped code
comments from the page, so pages could come back short or empty while
later pages still held events, and clients that stop at such a page
missed them. Code comments are now excluded in the query itself.
Comments the doer cannot read are still filtered after paging, and
`X-Total-Count` still reflects the page length. Both are left for a
follow-up. Independent of https://github.com/go-gitea/gitea/pull/40496
and https://github.com/go-gitea/gitea/pull/40497.
Refs: https://github.com/go-gitea/gitea/issues/40495
Assisted-by: Claude:claude-opus-5-5
---------
Co-authored-by: silverwind <me@silverwind.io>
Store PAT, Actions task and runner tokens as SHA-256 instead of PBKDF2,
which 160-bit random tokens don't need, and drop the token caches and
`SUCCESSFUL_TOKENS_CACHE_SIZE` that PBKDF2 required. Legacy rows are
rehashed on first use. Older releases can't verify new or rehashed
tokens. A PAT use now writes only its last-used timestamp, at most once
a minute.
Benchmarks on M2 Max, SQLite, median of 5:
| Benchmark | 1 token | 128 tokens |
| :--- | ---: | ---: |
| PAT lookup | 29.4 → 30.7 µs | 2.24 ms → 29.7 µs |
| PAT lookup with last-used | 107 → 29.6 µs | 2.44 ms → 30.1 µs |
| Task lookup | 63.2 → 48.4 µs | 2.25 ms → 49.4 µs |
| Runner verify, no DB | 122 → 160 ns | 141 → 162 ns |
Docs: https://gitea.com/gitea/docs/pulls/607
Assisted-by: Codet
Assisted-by: Claude Code:claude-opus-5-5
---------
Co-authored-by: silverwind <me@silverwind.io>
Releases are listed by `created_unix`, which is the date of the tagged
commit since #36761. A patch release tagged on an older branch commit
(e.g. 1.24.x after 1.25.0) therefore sorts out of publication order, so
the newest release is not always at the top.
List by publication time instead, falling back to the commit date for
drafts. The latest-release badge is unchanged, so an old commit still
cannot take it over.
---
Assisted-by: Codet:claude
---------
Co-authored-by: silverwind <me@silverwind.io>
A pull mirror copied its newest branch tip's committer date into the
repository's "Last updated" field. Commit dates are set by whoever made
the commit, so a single tip dated 2098 kept an idle mirror at the top of
Explore for decades.
Like GitHub, GitLab and Gitea's own push handling, a sync now sets the
update time to the sync time when any ref changed and leaves it
untouched otherwise.
Fixes: https://github.com/go-gitea/gitea/issues/40480
Assisted-by: Codex:GPT-6
Assisted-by: Claude Code:claude-opus-5-5
---------
Co-authored-by: silverwind <me@silverwind.io>
Queued push, create and pull request synchronize events resolved their
branch only when handled, so if it had moved on, the pushed commit got
no run and the newer one got two.
Runs now use the event's commit, and a delayed default branch push no
longer replaces newer schedules.
---------
Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Adds `/api/v1/admin/actions/variables` so instance-level actions
variables can be managed outside the admin UI. All variable scopes now
share one handler implementation and one test.
Assisted-by: Claude Code:claude-opus-5-5
Use provider-neutral S3 naming for object storage and switch CI to
RustFS.
1. Rename `STORAGE_TYPE = minio` to `s3`, `[storage.minio]` to
`[storage.s3]`, and `MINIO_*` keys to `S3_*`. Legacy configs resolve as
before and log deprecation warnings. Explicit `S3_*` keys take
precedence in the same section.
2. Rename `migrate-storage` options to `--storage=s3` and `--s3-*`,
retaining deprecated `minio` aliases.
3. Replace MinIO in CI with RustFS `1.0.6` and rename
`TEST_MINIO_ENDPOINT` to `TEST_S3_ENDPOINT`.
Docs: https://gitea.com/gitea/docs/pulls/659
Assisted-by: Claude Code:claude-opus-5-5
---------
Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: Claude (Opus 4.7) <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
`gitea web` derived the graceful manager's context from the CLI context,
which is canceled on the first SIGTERM, so in-flight requests were
force-closed and the terminate stage never ran.
- Detach the manager's context from that cancellation. With
`SKIP_MINWINSVC=1` on Windows, Ctrl+C now takes two.
- Close idle HTTP/2 connections at shutdown, which otherwise held every
drain until the hammer.
| SIGTERM with | main | this PR |
|---|---|---|
| no connections | 0.01s, no terminate stage | 1.03s |
| 64 MiB download in flight | cut after 10 MB | completes |
| idle HTTP/2 connection | 0.01s | 1.01s |
Regressed in: https://github.com/go-gitea/gitea/pull/35348
Carries forward https://github.com/go-gitea/gitea/pull/39533 by
@mandel-macaque.
Assisted-by: Hermes Agent:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5
---------
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Like GitHub since December 2025, `pull_request_target` workflows now run
from the default branch whatever the pull request targets, so an
outdated workflow on a release branch can't run with secrets.
`github.ref`, `github.sha` and local reusable workflows follow it, while
branch filters still match the base. Runs now record that ref, so runs
from older versions keep the base on rerun.
Breaking: pull requests targeting a non-default branch now run the
default branch's `pull_request_target` workflows, so workflows that only
exist on that branch stop running and `actions/checkout` without `ref`
checks out the default branch.
Ref:
https://github.blog/changelog/2025-11-07-actions-pull_request_target-and-environment-branch-protections-changes/
Assisted-by: Claude Code:claude-opus-5-5
The "Approve runs" button was missing on
https://gitea.com/gitea/runner/pulls/1246. The merge box only looked at
the latest commit status per context, so an older run's later update,
like its cancellation, hid a newer run still awaiting approval. It now
collects runs from all statuses of the head commit.
Assisted-by: Claude Code:claude-opus-5-5
Render user mentions like GitHub, semibold in the surrounding text
color, and highlight mentions of the signed-in user in yellow so they
stand out in long threads.
The renderer adds `user-mention` and `current-user` classes, the styling
is pure CSS. CODEOWNERS and OAuth creator links use the same class, team
mentions are unchanged.
| Before | After |
| --- | --- |
| <img width="291" height="29" alt="before"
src="https://github.com/user-attachments/assets/6c451e7a-dfce-4e95-a386-f9aa9d28c721"
/> | <img width="291" height="29" alt="after"
src="https://github.com/user-attachments/assets/6b137c71-4692-46f2-adf8-d77ee87f3077"
/> |
Assisted-by: Claude Code:claude-opus-5-5
Integration tests load fixtures after the app starts, while the indexers
still initialize and populate in the background. A slow start indexed
every fixture repo or dropped early index updates, making search tests
flaky.
The indexer startup goroutines now join a WaitGroup that only the test
harness waits on. This replaces the issue indexer's `syncReindex` flag.
Also fixes a flaky `SyncDirs` test that relied on directory listing
order.
Assisted-by: Claude Code:claude-opus-5-5
After applying a patch in the web editor, Gitea redirected to
`/src/branch/<branch>/__dummy_for_EditRepoFileForm.TreePath(Required)__`,
which is a 404. The patch form only sends that placeholder `tree_path`
to pass form validation, but the handler still used it as the redirect
path. It now redirects to the branch root, like cherry-pick and revert
do.
Fixes: https://github.com/go-gitea/gitea/issues/40449
Assisted-by: Claude Code:claude-opus-5-5
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Reduce the work Go tests spend on fixture setup, without dropping any
test or covered code. Every fixture repository reset listed and stat'ed
both trees, and many packages copied repositories or created a database
they never use.
- List the fixture repository source tree once per process
- Skip the repository copy in DB-only packages and the database in
settings-only packages
- Drop the unused repository copy and git init from migration tests
- Push LFS files last in `TestGitGeneral`, so LFS hooks don't run on
every later git command
- Link the integration test binary without DWARF
Measured locally on macOS, wall and CPU time:
| | Before | After |
|---|---|---|
| Warm fixture repository reset | 127 ms | 63 ms |
| 30 affected unit packages | 13.6 s, 72 s CPU | 10.0 s, 51 s CPU |
| Migration tests | 29.9 s, 19.1 s CPU | 13.7 s, 8.8 s CPU |
| `TestGitGeneral` | 81 s, 69 s CPU | 62 s, 54 s CPU |
| 46 API integration tests | 41.7 s | 39.0 s |
| Integration test binary relink | 8.7 s, 11.6 s CPU | 3.7 s, 5.7 s CPU
|
Assisted-by: Claude Code:claude-opus-5-5
Rework the merge box after GitHub, fix auto merge edge cases, and add
`auto_merge` to the pull request API.
- Review, checks, mergeability and blocker sections that refresh while
checks run, each rendered from a `pullMergeBoxSection` instead of the
flat info item list.
- Auto merge waits out conflicts, and is canceled on close, WIP, or a
retarget or push by a non-writer.
- Bypassing branch protection needs an explicit checkbox.
- Merging follows the delete branch setting, and the timeline can
restore the deleted branch.
- Unrelated branches get their own status instead of a conflict.
- The merge API answers a merge blocked by an open dependency with 422
instead of 500.
<img width="600" alt="Merge box ready to merge"
src="https://github.com/user-attachments/assets/95dcec16-fba5-446f-81f9-5af1245c887f"
/>
<img width="600" alt="Merge box with review required and checks pending"
src="https://github.com/user-attachments/assets/640ec08e-a964-4520-85e1-5c606dfaf222"
/>
Fixes: https://github.com/go-gitea/gitea/issues/39851
Fixes: https://github.com/go-gitea/gitea/issues/24513
Assisted-by: Claude Code:claude-opus-5-5
---------
Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: silverwind <me@silverwind.io>
External CI can report any commit status state, but only the six known
states rendered an icon, so `running` or something like `stage-1` showed
nothing. `running` is now an official state rendered with the same
spinner as Actions, and any other state gets a fallback icon. The
combined status still treats both as pending.
A state longer than the 7-character column (e.g. `in_progress`) caused a
500. It now returns 422, as does an empty state. Widening the column
instead would need a migration, happy to do that in a follow-up if
preferred.
| Before | After |
| --- | --- |
| <img width="1904" height="654" alt="before"
src="https://github.com/user-attachments/assets/811c6a4e-7b5a-4919-8d86-ec586d9f9bfb"
/> | <img width="1919" height="675" alt="after"
src="https://github.com/user-attachments/assets/a088c70d-47fe-40c5-93f7-43d1bacfa77e"
/>|
Fixes: https://github.com/go-gitea/gitea/issues/39608
Add e2e coverage for browser flows that regressed before and had no
browser test.
- Web editor: preview with relative links, diff preview and proposing on
a new branch, catching CRLF in the diff and the commit
- Task lists: toggling in preview and after save with non-ASCII text
- Actions: cancel, rerun and view the earlier attempt
- File navigation: tree, go to file and tag selector on a nested file
with special characters
Assisted-by: Claude Code:claude-opus-5-5
With `block_on_official_review_requests` enabled, a scheduled auto merge
stayed stuck after the last official review request was cleared, because
nothing rechecked the PR. A request can be cleared by removing a user's
request, by removing a team's request, or when the requested reviewer
submits any review, including a plain comment.
All three cases now trigger an auto merge recheck. Previously only
approvals and dismissals did. Every recheck now skips pull requests
without a scheduled auto merge before opening the git repository.
Fixes: https://github.com/go-gitea/gitea/issues/40415
Assisted-by: Claude Code:claude-opus-5-5
---------
Co-authored-by: bircni <bircni@icloud.com>
Co-authored-by: silverwind <me@silverwind.io>
Adds an instance-level `DEFAULT_TEAM_VISIBILITY` setting
(`private`/`limited`/`public`, default `private`) so administrators can
configure the default visibility for newly created teams when it isn't
explicitly chosen in the web form or sent via the API. Also fixes a
template bug where the "Private" radio was always force-checked on the
new-team page regardless of the actual default.
Fixes: https://github.com/go-gitea/gitea/issues/40128
## Verification
Tested all three config values (absent/`private`, `public`, `limited`)
against both the web form default and the API (`POST /orgs/{org}/teams`
without `visibility`) — in each case the correct default was applied.
## Test 1: Key absent in app.ini -> falls back to "private"
<img width="3178" height="1312" alt="image"
src="https://github.com/user-attachments/assets/7ce87372-eb3e-4f03-84da-fc21ace86eca"
/>
## Test 2: DEFAULT_TEAM_VISIBILITY = public
<img width="2802" height="1348" alt="image"
src="https://github.com/user-attachments/assets/aa1af297-9557-434d-82c6-1af253eec2ab"
/>
## Test 3: DEFAULT_TEAM_VISIBILITY = limited
<img width="2778" height="1198" alt="image"
src="https://github.com/user-attachments/assets/1e66565b-c275-454a-a7d1-66d11ef3b9ee"
/>
---------
Co-authored-by: silverwind <me@silverwind.io>
https://github.com/blakesmith/ar is unmaintained since 2019 and panics
on a negative member size (https://pkg.go.dev/vuln/GO-2026-6905), with
no fixed version. Debian packages only need a small subset of the `ar`
format, so this reads it in-tree.
- Malformed or truncated archives are rejected with a 400 instead of a
500 or a panic
- Parsing stops after the first `control.tar` member, deb(5) allows only
one
Assisted-by: Claude Code:claude-opus-5-5
Many settings pages had a generic or missing title, so browser tabs and
history named the wrong page. Titles now use the active sidebar label,
or the page header on sub-pages, and are set once where several handlers
render the same page. The user and org webhook list headers print the
title, so they now read "Webhooks" instead of "Settings".
| Page | Before | After |
| --- | --- | --- |
| Runners, secrets, Actions general, admin job queue | Actions |
Runners, Secrets, General, Job queue |
| User and org webhooks, org options, 2FA enroll, account and keys after
a form error | Settings | Webhooks, Organization, Enroll in Two-Factor
Authentication, Account, SSH / GPG Keys |
| Admin self check, OAuth2 app edit, repo public access, repo LFS
pointer files | (none), owner/repo | Self Check, Edit OAuth2
Application, Public Access, Find pointer files |
| Admin trace, new branch protection rule, package cleanup rules |
Monitoring, Branch Protection -, Packages | Trace, Add New Rule,
Add/Edit Cleanup Rule, Cleanup Rule Preview |
| Admin webhook add and edit | Add/Update Webhook | Add/Update System
Webhook, Add/Update Default Webhook |
| Sidebar on admin queue, admin webhook edit, user OAuth2 app edit | no
highlight | Queues, Webhooks, Applications |
Assisted-by: Claude Code:claude-opus-5-5
Elements `<a>` without `href` are not focus-able, screen readers didn't
expose it as a button.
Use `<button type="button">` for these elements, and fix what the
conversion exposed:
- Disabled reactions and the copy-content button use `aria-disabled`,
because native `disabled` suppresses their tooltips
- The random label color button gets a label
- Hover, disabled and alignment styles that only matched `<a>` apply to
the buttons
- Unpinning an issue with the keyboard works, and removing a
non-permitted "blocked by" dependency sends the right type
Fixes: https://github.com/go-gitea/gitea/issues/40337
Assisted-by: Claude Code:claude-opus-5-5
---------
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: silverwind <me@silverwind.io>
Adds audit actions for security-relevant changes that were not logged at
all, and records a few remaining events on paths that skipped them:
- Account login prohibition (`user:status:prohibitlogin`) and the
organization setting that lets repository admins change team access
- Actions runner registration tokens issued, runners removed or
enabled/disabled, and Actions variables, for every scope
- Instance config changes, including maintenance mode
(`system:config:update`)
- Deploy token regeneration and pull mirror address changes
- Review deletion and dismissal, package removal, and release and tag
removal
- Repository restores via `gitea admin restore-repo`, OAuth2 secret
rotation on API update, and SSH keys added or removed by authentication
source sync
The authentication source SSH key sync moved from the asymkey model to
the asymkey service so it can record events.
Follow-up to https://github.com/go-gitea/gitea/pull/40317 and
https://github.com/go-gitea/gitea/pull/40322.
---------
Co-authored-by: silverwind <me@silverwind.io>
Several entry points change users, credentials or 2FA without writing an
audit event, while the equivalent web or service path does. This records
the existing actions on those paths:
- `user:create` for self sign-up, OAuth2 auto-registration, link-account
registration and `gitea admin user create`
- `user:accesstoken:add` for `gitea admin user generate-access-token`
and `user create --access-token`; `user:accesstoken:remove` for `DELETE
/api/v1/token`
- `user:twofactor:disable` for the admin "reset 2FA" option and `gitea
admin user disable-2fa`
- `user🔑ssh:add`, `user🔑gpg:add/remove` for the API
- `user📧primary`, `user📧activate`, `user:status:active` for
settings, the activation page/links and OAuth2 source sync deactivation
- `user:oauth2application:grant` when a grant's scope changes,
`user:externallogin:add` on registration via an external login
- `user:authentication:fail:twofactor` for wrong recovery codes, failed
WebAuthn assertions and 2FA during password reset
Should be backported to v28.
---------
Co-authored-by: silverwind <me@silverwind.io>
Several API and background paths change repositories without writing the
audit event the web UI writes for the same change. This records the
existing actions on those paths:
- Webhook add/update/remove via the API (repository, organization, user
and system hooks)
- Branch and tag protection add/update/remove via the API
- Deploy keys and deploy tokens via the API, and deploy tokens generated
in the web UI
- Push mirror add, archive/unarchive and default branch changes via the
API
- Project create/update/delete via the API, and closing/reopening
projects in the web UI
- `repository:create` for migrations, `pr:merge` for scheduled
auto-merges, `pr:comment:create` for reviews (with `review_id` and
`review_type`) and review code comments
- `repository:delete` for repositories removed by the missing-repository
cleanup or an owner purge
Webhook, secret and OAuth2 application events now also keep the
impersonator.
Assisted-by: Claude Code:claude-fable-5-2
---------
Signed-off-by: bircni <bircni@icloud.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: delvh <dev.lh@web.de>
The API accepted a new name for an organization's Owners team. The owner
team is looked up by its name, so the organization had no owner team
afterwards and its owners lost access to it.
The API now rejects the rename, as the web UI already does.
Fixes#40380
Plain repository creation marked a new repository as ready before its
git data, hooks and initial commit existed, and auto-init cloned the new
repository to build its initial commit on top of whatever it already
contained.
- Auto-init builds the initial commit in a freshly initialized temp
repository instead of a clone
- New repositories are inserted as being created and marked ready once
initialized, as fork, template generation, adoption and migrations
already do
---------
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
The web repo search response embedded the whole commit status model
although the dashboard only uses its state and target URL. It now
returns just those two fields.
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
GitHub resolves `uses: $/{path}` against the repository and commit of
the job's workflow file, not the triggering ones. When those differ, as
with reusable workflows from elsewhere or owner and global workflows:
- such steps are pinned to `self:{repo}/{path}@{sha}` in the runner
payload
- `$/` steps with expressions in their path fail the run as an invalid
workflow, as they can't be pinned safely and GitHub rejects them too
Same-source jobs keep `$/`, so older runners are unaffected.
Assisted-by: Claude Code:claude-opus-5-5
---------
Co-authored-by: Zettat123 <zettat123@gmail.com>
`GET /users/{username}/orgs/{org}/permissions` returned a user's team
roles to anyone who could see the org, revealing concealed members and
their roles. Now only the user, unrestricted org members and site admins
get the real answer, everyone else gets the non-member response:
- Outsiders get no roles, for public members too.
- Restricted members only get their own roles.
- Public-only tokens get none, and site admins need an `all`-scoped
token.
Assisted-by: Claude Code:claude-opus-5-5
---------
Co-authored-by: silverwind <me@silverwind.io>
Actions `edited` payloads omitted `changes`, so workflows could not see
previous values. Issue/PR title and body edits now carry
`changes.title`/`changes.body`, base branch changes add
`changes.base.ref`/`changes.base.sha` (and `changes.ref` now holds the
old branch, not the new one), release edits carry
`changes.name`/`changes.body`.
_Written by Claude (Opus 5.5)._
---------
Co-authored-by: Claude (Opus 5.5) <noreply@anthropic.com>
Adds GitHub-style code search endpoints and makes code search behave the
same in the web UI and the API, whether it runs on git grep, bleve or
Elasticsearch.
- `GET /repos/{owner}/{repo}/code/search` searches any branch, tag or
commit with git grep, so it works without the code indexer.
- `GET /search/code` searches the default branches of all accessible
repositories with the code indexer.
- One query syntax everywhere: every term must match a file's content or
path, case-insensitively. It supports `"phrases"`, `/regexp/` (git grep
only) and the `path:`, `language:`, `repo:`, `user:` and `org:`
qualifiers. Invalid queries return an error.
- All engines apply the same include, exclude, vendored and size rules,
and return every match. The web UI shows them as multiple snippets per
file with the matched text highlighted.
<img width="359" height="295" alt="image"
src="https://github.com/user-attachments/assets/59b7aa66-b1dc-4938-9ef9-66668ae08d7c"
/>
Fixes: https://github.com/go-gitea/gitea/issues/10706
Fixed: https://github.com/go-gitea/gitea/issues/15841
Fixes: https://github.com/go-gitea/gitea/issues/31375
Related: https://gitea.com/gitea/gitea-mcp/issues/280
Docs: https://gitea.com/gitea/docs/pulls/615
AI usage disclosure: Yes, I used AI to write code, review changes and
verify the factuality of the overview I provided. I take full
responsibility for the code in this PR.
---------
Co-authored-by: silverwind <me@silverwind.io>
Jobs that ran on ephemeral runners lose `runner_name` in the
`workflow_job` completed webhook and the jobs API, because the runner
row is deleted when the task finishes. GitHub keeps both `runner_id` and
`runner_name`, and GARM ignores completed jobs without a name, holding
the runner slot until its periodic cleanup.
The name is now stored on the task when claimed, and a migration
backfills tasks whose runner row still exists.
---------
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Add e2e tests for flows that had no browser coverage: editing and
quote-replying an issue with an uploaded image, file tree and go-to-file
navigation, the Actions run view and workflow dispatch, and branch
protection rules with their priority.
The tests exposed bugs that are fixed here:
- Quote reply into an empty comment box left the Comment button disabled
- Removing an uploaded attachment did not update the comment buttons
- Going back from a file opened via the file tree to the initially
loaded page kept showing the other file
Assisted-by: Claude Code:claude-opus-5-5
Allow compare refs named diff or patch to use the normal compare page
while preserving explicit .diff and .patch downloads.
Compare refs ending in diff or patch were incorrectly matched as raw
.diff/.patch routes. This caused normal compare pages such as
main...diff and main...patch to return an empty or invalid response.
The route matching is now constrained so valid raw diff/patch downloads
continue working while branches named diff or patch use the normal
compare page.
Assisted-by: Agent:GPT-5.6 Luna
Fixes https://github.com/go-gitea/gitea/issues/40303
---------
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
1. `ctx.ServerError("LogMessage", err)` is very messy and useless. When
the log is printed, it already contains the caller's file and line
number
2. `ctx.NotFound(nil)` and `ctx.NotFound(err)` were abused a lot, now
only `ctx.NotFound()`
---------
Co-authored-by: silverwind <me@silverwind.io>
`AccessibleRepositoryCondition(user, unitType)` now requires the repo to
have the requested unit enabled and not globally disabled, consistent
with the per-repo permission checks. This affects code search, Actions
run listings, LFS object reuse, recently pushed branches and org project
milestones.
Written by Claude.
The login tab order test fails in WebKit on macOS, so `make test-e2e`
fails locally on every Mac. CI on Linux is unaffected.
- macOS WebKit moves Tab focus only between text fields, plus buttons
and checkboxes when the system keyboard navigation setting is on, and
never to links, like Safari. Option+Tab reaches every element there and
acts as Tab in Linux WebKit, so the test presses Alt+Tab in WebKit.
- Headless WebKit applies the username `autofocus` late, which pulled
focus back from the password field. The test now waits for the autofocus
first, which also covers it.
Follow-up to https://github.com/go-gitea/gitea/pull/40081
Assisted-by: Claude Code:claude-opus-5-5
With the bleve, elasticsearch or meilisearch issue indexer, a keyword
search filtered by project matched issues by the projects they had when
they were last indexed, so newly added issues were missing and removed
ones still showed up.
- Reindex an issue when its projects change, using `IssueChangeProjects`
from https://github.com/go-gitea/gitea/pull/30205.
- Reindex the issues of a deleted project, so the "No project" filter
finds them again.
Entries that are already stale are corrected on the issue's next change
or an index rebuild.
Fixes: https://github.com/go-gitea/gitea/issues/33451
Assisted-by: Claude Code:claude-opus-5-5
---
🤖 Opened with [Superhuman](https://github.com/gaurav0107/superhuman), an
open-source contribution agent.
---------
Co-authored-by: silverwind <me@silverwind.io>
`IsLocked` and `IsLatest` in `services/packages/terraform/state.go`
return early when the package **is** a terraform state (`==` instead of
`!=`), so the `OnBeforeRemovePackageAll` /
`OnBeforeRemovePackageVersion` guards never fire. As a result, deleting
through the generic package API (`DELETE
/api/v1/packages/{owner}/terraform/{name}[/{version}]`) or the web UI
ignores the state lock and allows removing the latest state version,
while the terraform state endpoints reject both.
Changes:
- Flip the type check in `IsLocked` and `IsLatest`.
- `DeleteState` (terraform state `DELETE` endpoint) relied on the bug:
after checking the lock it removed every version one by one with
`RemovePackageVersion`, including the latest. With the guard fixed, it
failed with 500 partway through and left a half-deleted state (the
existing `TestPackageTerraform` subtests catch this). It now calls
`RemovePackage`, which checks the lock and deletes everything in one
transaction.
- The generic package delete API used `APIErrorInternal` for every
error, so the guard errors became 500. It now uses `APIErrorAuto`, which
returns 422 for these.
- Added a `GenericPackageAPI` subtest to `TestPackageTerraform`:
deleting an older version works, deleting the latest version or a locked
state returns 422, and deleting an unlocked state works. It fails on
current `main`.
Tested locally with `go test -run '^TestPackage' ./tests/integration`
(SQLite): all pass.
AI disclosure: I used an AI assistant (Claude) to find the bug, trace
the code paths, and draft the change and this description. I reviewed
the change and ran the tests myself.
Signed-off-by: choam2426 <choam2426@gmail.com>
Deleting a package or a package version from the web UI, the admin panel
or `DELETE /api/v1/packages/...` removed the database rows but never
rebuilt the Debian, Alpine, RPM or Arch repository index, so clients
kept seeing the deleted version until something else triggered a
rebuild. Only the registries' own delete endpoints and the cleanup task
rebuilt it.
https://github.com/go-gitea/gitea/pull/22810 was closed in favor of
`OnBeforeRemovePackageVersion`, but that hook runs before the version is
gone, so it can't refresh the index. This adds an `OnAfterRemovePackage`
hook and rebuilds the owner's repository files there, the same way the
cleanup task does.
Deleting the last RPM of a group also removed the repodata of all other
groups of the owner. Now only the emptied group's files are removed.
Fixes: https://github.com/go-gitea/gitea/issues/32830
Fixes: https://github.com/go-gitea/gitea/issues/40304
Fixes: https://github.com/go-gitea/gitea/issues/40305
---
🤖 Opened with [Superhuman](https://github.com/gaurav0107/superhuman), an
open-source contribution agent.
---------
Co-authored-by: silverwind <me@silverwind.io>
Introduce "FlashErrorAuto" for "XxxErrorAuto" family and simplify the
error handling logic.
* Use ErrorUnwrapForHTML for web error messages
* Use ErrorUnwrapForUser for api error messages
* Make Flash message can take up to about 3000 bytes
Next step: completely refactor "ctx.ServerError"
---------
Co-authored-by: silverwind <me@silverwind.io>