Skip to content

Commit 2c45318

Browse files
committed
more
1 parent 2b5ac9e commit 2c45318

3 files changed

Lines changed: 46 additions & 31 deletions

File tree

.github/agents/code-review-and-fix.agent.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,16 +162,20 @@ Auto-fix boundaries:
162162
but absent from the current module's check (or vice versa) reveal a version boundary —
163163
the class was likely added or removed between versions.
164164
Then determine the comment form for each class:
165-
**Floor class** (proves "at least version X"): look up when the class was
166-
**introduced** → comment `// added in X.Y`.
167-
**Ceiling class** (proves "not yet version Y"): look up when the class was
168-
**removed** → comment `// removed in Y.Z` (meaning: its presence here ensures we
169-
don't match version Y.Z+ where a different module takes over).
170-
**Single class that provides both bounds**: include both facts in one comment,
171-
e.g. `// added in X.Y, removed in Y.Z`.
165+
**Positive floor class** (proves "at least version X"): look up when the class was
166+
**introduced** → comment `// added in X.Y`.
167+
**Positive ceiling class** (proves "not yet version Y"): look up when the class was
168+
**removed** → comment `// removed in Y.Z` (meaning: its presence here ensures we
169+
don't match version Y.Z+ where a different module takes over).
170+
**Negated exclusion class** in `not(hasClassesNamed(...))`: look up when the class was
171+
**introduced** → comment `// added in Y.Z`, because that first appearance begins the
172+
excluded version range.
173+
**Single positive class that provides both bounds**: include both facts in one comment,
174+
e.g. `// added in X.Y, removed in Y.Z`.
172175
A ceiling class might have been *introduced* much earlier than the module's target version.
173-
Do not use `// added in` for a ceiling class — that is misleading. The relevant fact is
174-
when it was **removed**.
176+
Do not use `// added in` for a positive ceiling class — that is misleading. The relevant
177+
fact is when it was **removed**. But for a negated exclusion class, `// added in` is the
178+
correct form because the class's introduction is exactly what starts excluding newer versions.
175179
Validate the version in the comment before adding or requesting it. Do not guess the
176180
version from the module name alone; confirm it with repository or upstream evidence.
177181
Sources: muzzle `versions.set(...)` ranges, sibling module `classLoaderMatcher()` checks,

.github/agents/code-review.agent.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,11 @@ For each file in scope:
9696
allocated on every invocation.
9797
6. Flag a missing version-boundary comment on a single-class `hasClassesNamed(...)`
9898
check in `classLoaderMatcher()` only after validating the stated boundary from
99-
repository or upstream evidence. Use `// added in X.Y` when the class only provides
100-
the lower bound; if the same class also provides the upper bound because it disappears
101-
in a newer sibling version, preserve or request `removed in Y.Z` too.
99+
repository or upstream evidence. Use `// added in X.Y` for a pure lower bound.
100+
If the same positive class also provides the upper bound because it disappears in a
101+
newer sibling version, preserve or request `removed in Y.Z` too. For negated checks
102+
such as `not(hasClassesNamed(...))`, use `// added in Y.Z` because the class's first
103+
appearance is what starts the excluded version range.
102104
7. Prevent duplicates:
103105
- If equivalent `REVIEW:` already exists above the same line, do not add another.
104106

.github/agents/knowledge/javaagent-module-patterns.md

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,19 @@ class suffices for a simple version boundary — use multiple classes only when:
8282
present (e.g., Jersey checks both the JAX-RS spec API and the Jersey implementation class;
8383
AWS SDK Lambda checks both the Lambda module and JSON protocol core).
8484

85-
Place a comment **above each class name string** stating its version role:
86-
87-
- **Floor class** (proves "at least version X"): use `// added in X.Y`.
88-
- **Ceiling class** (proves "not yet version Y"): use `// removed in Y.Z`.
89-
90-
A single landmark class can sometimes provide **both** bounds: its presence proves the
91-
module is at least version `X.Y`, and the same class disappears in `Y.Z`, so its presence
92-
also excludes `Y.Z+`. In that case, a combined comment such as
85+
Place a comment **above each class name string** stating its version role and matcher shape:
86+
87+
- **Positive floor class** in `hasClassesNamed(...)` (proves "at least version X"):
88+
use `// added in X.Y`.
89+
- **Positive ceiling class** in `hasClassesNamed(...)` (proves "not yet version Y"):
90+
use `// removed in Y.Z`.
91+
- **Negated exclusion class** in `not(hasClassesNamed(...))` or
92+
`.and(not(hasClassesNamed(...)))`: use `// added in Y.Z`, because the class's presence
93+
starts excluding `Y.Z+`.
94+
95+
A single **positive** landmark class can sometimes provide **both** bounds: its presence
96+
proves the module is at least version `X.Y`, and the same class disappears in `Y.Z`, so
97+
its presence also excludes `Y.Z+`. In that case, a combined comment such as
9398
`// added in X.Y, removed in Y.Z` is appropriate.
9499

95100
**How to identify ceiling classes**: check whether a **newer sibling module** exists for
@@ -152,9 +157,9 @@ OpenTelemetry instrumentation:
152157
```java
153158
@Override
154159
public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
155-
// InternalRequest was introduced in 7.0.0
160+
// added in 7.0.0
156161
return hasClassesNamed("org.elasticsearch.client.RestClient$InternalRequest")
157-
// Instrumentation class was introduced in 8.10 (native OTel support)
162+
// added in 8.10 (native OTel support)
158163
.and(not(hasClassesNamed(
159164
"co.elastic.clients.transport.instrumentation.Instrumentation")));
160165
}
@@ -165,9 +170,9 @@ public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
165170
```java
166171
@Override
167172
public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
168-
// LibraryTelemetryOptions was introduced in azure-core 1.53
173+
// added in azure-core 1.53
169174
return hasClassesNamed("com.azure.core.util.LibraryTelemetryOptions")
170-
// OpenTelemetryTracer was introduced in azure-core-tracing-opentelemetry 1.0.0-beta.47
175+
// added in azure-core-tracing-opentelemetry 1.0.0-beta.47
171176
.and(not(hasClassesNamed("com.azure.core.tracing.opentelemetry.OpenTelemetryTracer")));
172177
}
173178
```
@@ -185,13 +190,17 @@ public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
185190
- **Version comments on landmark classes.** For multi-class checks, `.and(not(...))`
186191
chains, or cases where the landmark version differs from the module's base version,
187192
each `hasClassesNamed()` call must have a `//` comment stating the class's **role**:
188-
- Floor class → `// added in X.Y` (class introduced in version X.Y).
189-
- Ceiling class → `// removed in Y.Z` (class removed in version Y.Z, ensuring the
190-
module does not activate on Y.Z+).
191-
- Single class that serves as both floor and ceiling → include both boundaries, e.g.
192-
`// added in X.Y, removed in Y.Z`.
193-
Do not use `// added in` for a ceiling class — that states when the class first appeared,
194-
which is irrelevant and misleading; the purpose is the upper bound.
193+
- Positive floor class → `// added in X.Y` (class introduced in version X.Y).
194+
- Positive ceiling class → `// removed in Y.Z` (class removed in version Y.Z, ensuring
195+
the module does not activate on Y.Z+).
196+
- Negated exclusion class in `not(hasClassesNamed(...))``// added in Y.Z` (class
197+
introduced in version Y.Z, so its presence excludes Y.Z+).
198+
- Single positive class that serves as both floor and ceiling → include both boundaries,
199+
e.g. `// added in X.Y, removed in Y.Z`.
200+
Do not use `// added in` for a **positive** ceiling class — that states when the class
201+
first appeared, which is irrelevant and misleading; the purpose is the upper bound.
202+
Conversely, do use `// added in` for a **negated** exclusion class, because the class's
203+
first appearance is exactly what begins the excluded version range.
195204
To identify ceiling classes, check if a newer sibling module's `classLoaderMatcher()`
196205
checks a different variant or replacement class.
197206
- **Single-class landmark comments are required.** When a single-class

0 commit comments

Comments
 (0)