Skip to content

refactor(agent-hooks): move the hand-off wrappers out of AgentConcurrencyUtilHooks (#1213) - #1218

Merged
PIsberg merged 2 commits into
mainfrom
refactor/1213-hooks-handoffs
Nov 8, 2026
Merged

PIsberg merged 2 commits into
mainfrom
refactor/1213-hooks-handoffs

Conversation

@PIsberg

@PIsberg PIsberg commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Closes #1213. Stacked on #1208: this PR targets #1208's branch, and GitHub retargets it to main when #1208 merges.

What moved

HandedAll, Handed, HandedTask, HandedStage, StageFunction, StageBiFunction and Submissions now live nested in a new package-private AgentHandOffHooks. To make that work, three members of AgentConcurrencyUtilHooks went from private to package-private (COMMON_POOL_TASK, RUNNING_HANDED, observed). Nothing else changed behaviour.

AgentConcurrencyUtilHooks: 4,757 → 4,227 lines on #1208's base.

What did not move, and why

The ~200 public static hooks stay put. The weaver binds call sites to them by owner and descriptor, and they are public API under japicmp's semantic-versioning gate, so moving one is a removal that 1.x cannot ship. That split is filed for 2.0 as #1217.

Why the new class name ends in Hooks

Nothing in it is a hook, but the suffix is load-bearing:

  • SiteCapture skips frames of an Agent*Hooks class and its nested classes. Under the name AgentHandOffs, a finding raised under HandedTask.run() would have named this file as the user's line.
  • DetectorFeedCoverageTest and DetectorConditionalInsertTest scan only Agent*Hooks.java sources, and this file calls two detector accessors.

SiteCaptureTest pinned the nested-class rule with the old name as a string literal, which would have stayed green through that regression. It now resolves the real class, so a future move fails it.

Verification

🤖 Generated with Claude Code

…encyUtilHooks (#1213)

AgentConcurrencyUtilHooks was the largest main class (5,137 lines with
#1209), and every agent-feed fix grows it. Its public static hooks are
bound by the weaver by owner and descriptor and are public API under
japicmp's semantic-versioning gate, so none can move in 1.x. Its
package-private machinery can: HandedAll, Handed, HandedTask,
HandedStage, StageFunction, StageBiFunction and Submissions now live
nested in AgentHandOffHooks, reached by import, with three outer members
widened from private to package-private. 4,757 to 4,227 lines on this
base; no behaviour change.

The holder's name is load-bearing: SiteCapture skips frames of an
Agent*Hooks class and its nested classes, and a HandedTask.run() frame
named AgentHandOffs$HandedTask would have been attributed as the user's
line. SiteCaptureTest pinned that rule with the old nested name as a
string literal, which would have stayed green through the regression;
it now resolves the real class, so a future move fails it.

Stacked on #1208, which adds an Arrays.equals call that keeps
java.util.Arrays imported; ForkJoinWorkerThread is unused on every
branch and goes. Verified: static chain (clean verify -DskipTests) green;
fast tier on this branch; a simulated merge with #1209 merges the hooks
file cleanly (CHANGELOG conflicts only between #1208 and #1209), compiles,
and passes 191 tests across the hook, site and feed-coverage suites.
Diagram structure gains exactly one node, AgentHandOffHooks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Base automatically changed from fix/tpe-subclass-and-handler to main November 8, 2026 06:54
@codecov

codecov Bot commented Nov 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.00000% with 16 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...java/se/deversity/asynctest/AgentHandOffHooks.java 91.91% 8 Missing and 8 partials ⚠️

📢 Thoughts on this report? Let us know!

@PIsberg
PIsberg merged commit 96994ff into main Nov 8, 2026
53 checks passed
@PIsberg
PIsberg deleted the refactor/1213-hooks-handoffs branch November 8, 2026 09:27
PIsberg added a commit that referenced this pull request Nov 8, 2026
…ntrancy

class-diagram.svg conflicted (generated): regenerated with tools/generate-architecture-diagrams.sh, which keeps main's AgentHandOffHooks (#1218) and adds this branch's KotlinMutexReentrancyDetector and KotlinMutexes.
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.

[P4] Split AgentConcurrencyUtilHooks (5,137 lines) into package-private hook families

1 participant