fix: record methods with @Labels even if they look trivial#327
Draft
fix: record methods with @Labels even if they look trivial#327
Conversation
…otes exist Agent-Logs-Url: https://github.com/getappmap/appmap-java/sessions/2575e3fc-ec41-4655-ab8e-0d6c7f3670b7 Co-authored-by: kgilpin <86395+kgilpin@users.noreply.github.com>
…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>
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.