Skip to content

fix: record methods with @Labels even if they look trivial#327

Draft
kgilpin wants to merge 8 commits intomasterfrom
fix/labels-bypass-trivial-filter
Draft

fix: record methods with @Labels even if they look trivial#327
kgilpin wants to merge 8 commits intomasterfrom
fix/labels-bypass-trivial-filter

Conversation

@kgilpin
Copy link
Copy Markdown
Contributor

@kgilpin kgilpin commented May 6, 2026

Methods annotated with @Labels (or named explicitly under methods: in appmap.yml, or labeled there) were being dropped by the getter/setter trivial-method filter before the agent ever consulted the opt-in. They now bypass that filter so explicit user intent always wins.

Extract the @Labels-by-name reading from CodeObject into a shared LabelUtil so ConfigCondition can ask the same question during match.

Copilot AI and others added 5 commits May 5, 2026 18:47
…itory key in serializer

Agent-Logs-Url: https://github.com/getappmap/appmap-java/sessions/9269e403-28ed-4394-be5f-17ca657e822a

Co-authored-by: kgilpin <86395+kgilpin@users.noreply.github.com>
Methods annotated with @Labels (or named explicitly under `methods:` in
appmap.yml, or labeled there) were being dropped by the getter/setter
trivial-method filter before the agent ever consulted the opt-in. They
now bypass that filter so explicit user intent always wins.

Extract the @Labels-by-name reading from CodeObject into a shared
LabelUtil so ConfigCondition can ask the same question during match.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two latent regressions were leaving the agent's integration tests
silently disabled:

1. The integrationTest Gradle task was missing testClassesDirs,
   classpath, and useJUnitPlatform(). Gradle 9 stopped wiring those
   from the test sourceSet for custom Test tasks, so the task ran as
   NO-SOURCE and reported success without executing anything.

2. Even with the task fixed, premain's agent-jar discovery via
   Class.getResource only succeeded when the URL protocol was "jar:".
   In tests, Agent.class is also visible on a classpath directory
   (build/classes/java/main) and the resource resolved as "file:",
   so the runtime jar was never extracted and HookFunctions.onMethodCall
   stayed null. Instrumented methods then NPE'd at the first hook call.

Add a fallback that parses -javaagent: out of the JVM input arguments
(via ManagementFactory) and verifies the candidate jar's manifest
declares the right Premain-Class. The two paths together let the eight
existing integration tests in com/appland/appmap/integration actually
run and pass.

Add :annotation as a test-only dependency so future integration tests
can apply @Labels / @NoAppMap to fixture classes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kgilpin kgilpin marked this pull request as draft May 6, 2026 02:21
kgilpin and others added 3 commits May 5, 2026 22:22
Drive a fixture class with @Labels-annotated and config-named getters/
setters under the real -javaagent: setup and assert the resulting
classMap and events. Confirms that:

- @Labels-annotated getter/setter are recorded with their labels
- a getter named under "methods:" in appmap.yml is recorded
- a plain unlabeled getter is still filtered out

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…repositories' into fix/labels-bypass-trivial-filter
…repositories' into fix/labels-bypass-trivial-filter
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.

2 participants