Skip to content

fix(copyright): handle Javadoc @author with a trailing homepage anchor#1283

Merged
mstykow merged 3 commits into
mainfrom
fix/copyright-author-trailing-anchor
Jul 15, 2026
Merged

fix(copyright): handle Javadoc @author with a trailing homepage anchor#1283
mstykow merged 3 commits into
mainfrom
fix/copyright-author-trailing-anchor

Conversation

@mstykow

@mstykow mstykow commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #1281, closing the remaining @author residual on eclipse-vertx/vert.x.

#1281 recovered @author <a href="url">Name</a> (name inside the anchor). vert.x also uses the form where the name is plain text and an http anchor follows it as a handle/homepage link:

* @author Francesco Guardiani <a href="https://slinkydeveloper.github.io/">@slinkydeveloper</a>

The trailing URL + @handle still broke extraction (no author). This drops the trailing http(s) anchor (href and link text) from an author-marked line when a plain-text name precedes it, leaving just the name. Scoped to an author marker; the name-inside-anchor form and copyright/contact anchors are unaffected.

Testing

  • cargo test --lib copyright::detector::tests_false_positives::test_javadoc_author_with_html_anchor_is_extracted — extended with the trailing-anchor case.
  • cargo test --features golden-tests --test copyright_golden — 36/36 pass.
  • cargo test --lib copyright::prepare — 103 pass.

Compare evidence

eclipse-vertx/vert.x @ 78ade62: recovers Francesco Guardiani (and the other trailing-anchor @author files), closing the 4-file residual noted in #1282.

🤖 Generated with Claude Code

The prior fix recovered `@author <a href="url">Name</a>` (name inside the
anchor). eclipse-vertx/vert.x also uses the form where the name is plain
text and an http anchor follows it as a handle/homepage link —
`@author Francesco Guardiani <a href="https://…">@slinkydeveloper</a>` —
which still produced no author because the trailing URL and `@handle`
broke extraction.

Drop the trailing http(s) anchor (href and link text) from an
author-marked line when a plain-text name precedes it, leaving just the
name. Scoped to an author marker; the name-inside-anchor form and
copyright/contact anchors are unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Maxim Stykow <maxim.stykow@gmail.com>
@greptile-apps

greptile-apps Bot commented Jul 15, 2026

Copy link
Copy Markdown

Greptile Summary

This PR extends Javadoc @author extraction to handle two additional patterns: a trailing HTML handle anchor (@author Name <a href="…">@handle</a>) and a bare trailing handle (@author Name @handle), closing a residual extraction gap against eclipse-vertx/vert.x. Two complementary layers are introduced: a new static regex in prepare.rs that strips the HTML anchor before author detection runs, and a new strip_trailing_at_handle function inserted early in the refine_author pipeline that removes bare social handles post-extraction.

  • prepare.rs: AUTHOR_TRAILING_HTTP_ANCHOR_RE fires before the existing AUTHOR_HTTP_ANCHOR_RE, requiring a letter immediately after the marker so it never fires on the name-inside-anchor form handled by fix(copyright): recover Javadoc @author names and drop bare XML tags #1281.
  • refiner/author.rs: strip_trailing_at_handle removes a trailing @handle token when the remaining prefix is non-empty, alphabetic, and contains no @ — correctly leaving email-based author strings untouched.
  • tests_false_positives.rs: Two new end-to-end cases are added to test_javadoc_author_with_html_anchor_is_extracted, covering both the HTML-wrapped handle and the bare handle patterns.

Confidence Score: 5/5

Safe to merge — the change is a narrowly scoped fix to two well-isolated extraction layers, both guarded by letter/at-sign checks that prevent misfires against the existing name-inside-anchor form.

Both new code paths carry explicit guards that prevent them from firing on the patterns handled by the previous PR. The regex ordering in prepare.rs is correct: the new trailing-anchor regex runs first and the letter guard ensures the name-inside-anchor form is unaffected. The refiner function is guarded against email-bearing or empty prefixes. End-to-end tests cover both new patterns through the full detection pipeline.

No files require special attention.

Important Files Changed

Filename Overview
src/copyright/prepare.rs Adds AUTHOR_TRAILING_HTTP_ANCHOR_RE to strip trailing HTML handle/homepage anchors from @author lines; applied before the existing AUTHOR_HTTP_ANCHOR_RE to avoid interference. Letter-guard on the capture group correctly prevents misfires against the name-inside-anchor form.
src/copyright/refiner/author.rs Adds strip_trailing_at_handle as a second layer for bare @handle tokens; placed early in refine_author before collective-contributor truncation. Guards against empty prefix, email-bearing prefix (contains '@'), and non-alphabetic-only prefix are correct and consistent with the sibling function.
src/copyright/detector/tests_false_positives.rs Extends test_javadoc_author_with_html_anchor_is_extracted with both new patterns (HTML-wrapped handle and bare handle); tests are end-to-end via detect_copyrights_from_text, covering both the prepare.rs and refiner layers.

Reviews (3): Last reviewed commit: "docs(copyright): correct the trailing-an..." | Re-trigger Greptile

Comment thread src/copyright/prepare.rs Outdated
mstykow and others added 2 commits July 15, 2026 09:46
Some Javadoc `@author` tags follow the name with a bare social/VCS handle
rather than an anchor — `@author Francesco Guardiani @slinkydeveloper`. The
handle's `@` prefix got the whole candidate rejected as a code fragment,
so no author was extracted.

Strip a trailing `@handle` when a real name precedes it, keeping just the
name. Guarded so an email address or a standalone `@ref`/`@type` token is
left untouched. Closes the last of the vert.x `@author` residual.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Maxim Stykow <maxim.stykow@gmail.com>
Address review: under the `(?i)` flag `[A-Z]` is case-insensitive, so the
"begins with an uppercase letter" comment was misleading. Spell the class
as `[A-Za-z]` and describe the guard accurately — the text between the
marker and the anchor must begin with a letter (never `<`), which is what
separates this trailing-anchor form from the name-inside-anchor form.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Maxim Stykow <maxim.stykow@gmail.com>
@mstykow
mstykow merged commit 871e127 into main Jul 15, 2026
18 of 19 checks passed
@mstykow
mstykow deleted the fix/copyright-author-trailing-anchor branch July 15, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant