davsclaus opened a new pull request, #25642:
URL: https://github.com/apache/camel/pull/25642

   ## Motivation
   
   Remove the **"Test Visibility: Drop \`public\` From Test Classes and 
Methods"** section from `AGENTS.md` (`CLAUDE.md` is a symlink to it).
   
   Camel test classes have been `public` for **~20 years**, and essentially 
every existing test class in the codebase is `public`. AIs — and humans — 
overwhelmingly learn by copying nearby tests, so this rule actively fights the 
corpus it lives in: it instructs contributors to write package-private tests 
while thousands of surrounding examples are `public`. The result is pointless 
style drift in every touched file, for zero functional benefit.
   
   The rule had also accreted a thicket of exceptions and *still* didn't cover 
everything:
   
   - supertype overrides must stay `public` (JLS 8.4.8.3),
   - base/support classes must stay `public`,
   - anything under `components/camel-test/**` and `test-infra/**` must stay 
`public`,
   - **and, not previously documented:** tests driven by the test-infra 
`CamelContextExtension` (`@RouteFixture` / `@ContextFixture`) must stay 
`public`, because the extension invokes the fixture methods **reflectively** — 
and on **Java 25** `Method.invoke` on a package-private receiver class throws 
`IllegalAccessException`.
   
   That last gap recently broke CI: a change that faithfully followed the rule 
(dropping `public` from a Kafka health-check IT) made every test in the class 
fail at fixture setup on Java 25 with *"illegal access to method: 
createRouteBuilder"*.
   
   A convention that needs this many carve-outs, contradicts 20 years of 
existing code, drives AI-generated drift, and still causes build failures is 
not worth keeping. `public` tests are perfectly fine.
   
   ## Change
   
   - Delete the entire "Test Visibility" section (51 lines) from `AGENTS.md`.
   
   No code changes; documentation/guidance only.
   
   ---
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   _Claude Opus 4.8 on behalf of @davsclaus_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to