Skip to content

chore(deps): update chroma, regexp2 v2, replace dimiro1/reply#37858

Merged
silverwind merged 13 commits into
go-gitea:mainfrom
silverwind:update-chroma-regexp2
May 27, 2026
Merged

chore(deps): update chroma, regexp2 v2, replace dimiro1/reply#37858
silverwind merged 13 commits into
go-gitea:mainfrom
silverwind:update-chroma-regexp2

Conversation

@silverwind

@silverwind silverwind commented May 26, 2026

Copy link
Copy Markdown
Member
  • Update github.com/alecthomas/chroma/v2 to v2.25.0.
  • Migrate github.com/dlclark/regexp2 to /v2 (incorporates chore(deps): update regexp2 to v2 #37664); drop the renovate pin.
  • Replace the unmaintained github.com/dimiro1/reply (the last consumer of regexp2 v1 in our own code) with a small built-in reply parser for incoming mail.

github.com/dlclark/regexp2 v1 is gone from the binary with this.


This PR was written with the help of Claude Opus 4.7

silverwind and others added 2 commits May 26, 2026 09:21
chroma v2.25.0 requires regexp2/v2, so move our single regexp2 call site
(models/issues/pull.go) to the /v2 import and drop the renovate pin that
held regexp2 on v1 (linux/386 build issue, fixed in v2). regexp2 v1 stays
as an indirect dep via github.com/dimiro1/reply.

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
Drop the unmaintained github.com/dimiro1/reply, the last consumer of
regexp2 v1 in our own code, and strip incoming-mail reply quotes,
signatures and forwarded headers with a small stdlib-regexp parser
(no lookahead, RE2-only). Covers the common mail-client formats and
languages; bottom posting and forwarded bodies are out of scope.

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 26, 2026
@github-actions github-actions Bot added the skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. label May 26, 2026
@silverwind silverwind requested a review from Copilot May 26, 2026 08:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Go dependencies to newer major versions and removes an unmaintained incoming-mail reply parsing dependency by replacing it with an internal, stdlib-only reply extractor.

Changes:

  • Bump github.com/alecthomas/chroma/v2 to v2.25.0 and migrate github.com/dlclark/regexp2 usage to the /v2 module path.
  • Remove github.com/dimiro1/reply and introduce an internal plain-text email reply extractor for inbound mail processing.
  • Update Renovate constraints and dependency metadata files (go.mod, go.sum, assets/go-licenses.json) accordingly.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
services/mailer/incoming/reply.go Adds internal reply/signature/forward-header stripping logic using stdlib regexes.
services/mailer/incoming/incoming.go Switches inbound mail body processing from reply.FromText to extractReply.
services/mailer/incoming/incoming_test.go Adds unit tests covering many common reply parsing formats/localizations.
renovate.json5 Removes the regexp2 v1 pin now that /v2 is used.
models/issues/pull.go Updates the regexp2 import to github.com/dlclark/regexp2/v2.
go.mod Updates direct requirements (chroma, regexp2/v2) and removes dimiro1/reply.
go.sum Updates checksums for the bumped/removed modules.
assets/go-licenses.json Updates recorded license entries to reflect dependency changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread services/mailer/incoming/reply.go Outdated
@TheFox0x7

Copy link
Copy Markdown
Contributor

licensing wise LGTM. Have not looked at logic yet, just wanted to check on potentially missing attribution but I see no similarities to the library so we're good I think.

@silverwind

Copy link
Copy Markdown
Member Author

It's partially based on dimiro1/reply, with various improvements done. Could add a small attribution.

Trim leading whitespace in headerBlock so indented forwarded header
blocks are detected, consistent with the other boundary checks. Note
in the doc comment that extractReply is based on dimiro1/reply (MIT).

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
Comment thread services/mailer/incoming/reply.go Outdated
Comment thread services/mailer/incoming/reply.go Outdated
Comment thread services/mailer/incoming/reply.go Outdated
@wxiaoguang

Copy link
Copy Markdown
Contributor

Maybe it's better to fork and maintain https://github.com/dimiro1/reply

@silverwind

silverwind commented May 26, 2026

Copy link
Copy Markdown
Member Author

Maybe it's better to fork and maintain https://github.com/dimiro1/reply

There exist a few similar modules, but none are comprehensive and all have their own class of bugs. I think it's best to maintain it in-repo for now, at least I wouldn't commit to maintaining such a lib.

Address review feedback:
- compile the reply patterns via sync.OnceValue so they are built on
  first use rather than at startup
- normalize line endings with util.NormalizeEOL
- recognize common CJK mobile signatures, kept specific enough to avoid
  matching ordinary prose

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
Comment thread services/mailer/incoming/reply.go Outdated
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels May 26, 2026
Detect forwarded-mail header blocks via a data-driven marker list
spanning more locales (incl. Chinese/Japanese/Korean and the CJK
fullwidth colon), replacing the header regexes. Inline the single-use
boundary helper so the patterns are fetched once per call.

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
@silverwind

Copy link
Copy Markdown
Member Author

some more cjk fixes in 9bbc5a8.

@TheFox0x7

Copy link
Copy Markdown
Contributor

Worth noting this does not pass all upstream tests.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 26, 2026
@silverwind

Copy link
Copy Markdown
Member Author

Worth noting this does not pass all upstream tests.

Thought it did, will check again, maybe the last change did something to that.

@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label May 26, 2026
@lunny lunny removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label May 26, 2026
@lunny

lunny commented May 26, 2026

Copy link
Copy Markdown
Member

Sorry the conflict caused by the import path changed.

silverwind and others added 2 commits May 27, 2026 09:02
* origin/main:
  chore: remove mssql `x509negativeserial` workaround (go-gitea#37853)
  [skip ci] Updated translations via Crowdin
Align the new file with the repo-wide module rename merged from main.

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
@silverwind

Copy link
Copy Markdown
Member Author

Worth noting this does not pass all upstream tests.

Currently it's passing 48/60 of those tests, the remaining 12 cases are not possible to fix without introducing regressions. I will check what can be improved but full coverage is neither desireable not beneficial here.

silverwind and others added 3 commits May 27, 2026 09:17
Recognize "Name <email> wrote/schrieb …" attribution lines (the email
must immediately precede the verb, so prose like "Bob <b@x> and he wrote"
is untouched) and strip the trailing "ᐧ" marker some mobile clients add.
Extract the verb list to a constant. Adds regression tests including a
guard that an email mention in prose is preserved.

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
Recognize the verb that ends a quoted-history attribution in Chinese
(写道/寫道), Japanese (書きました) and Korean (작성), matched without a
preceding word-separator since CJK scripts are unspaced. Adds tests.

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
- attribution lead-word branch now requires a day number or weekday, so
  prose like "On the 2024 roadmap … at 10:00" is not mistaken for an
  attribution and cut
- CJK mobile signatures now require a device name, so "发自我的内心" /
  "会議から送信" / "회사에서 보냄" are kept
- simplify: drop the single-use quote regex (use strings.HasPrefix) and
  the per-line double TrimSpace in header detection

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
@silverwind

Copy link
Copy Markdown
Member Author

dimiro1 suite is now at 51/60, this is as far as it can go without regressions.

@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label May 27, 2026
@silverwind silverwind merged commit f810e88 into go-gitea:main May 27, 2026
24 checks passed
@GiteaBot GiteaBot added this to the 1.27.0 milestone May 27, 2026
@silverwind silverwind deleted the update-chroma-regexp2 branch May 27, 2026 21:40
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label May 27, 2026
silverwind added a commit to silverwind/gitea that referenced this pull request May 28, 2026
* origin/main:
  [skip ci] Updated translations via Crowdin
  chore: Move gitea sdk from code.gitea.io/sdk/gitea -> gitea.dev/sdk (go-gitea#37855)
  chore(deps): update `chroma`, `regexp2` v2, replace `dimiro1/reply` (go-gitea#37858)
  chore: clarify SSH clone URL related config options (go-gitea#37877)
  chore: remove mssql `x509negativeserial` workaround (go-gitea#37853)
  [skip ci] Updated translations via Crowdin
  chore: Move import path from code.gitea.io/gitea to gitea.dev (go-gitea#37873)

# Conflicts:
#	renovate.json5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants