Skip to content

Fix jfr-mcp event count, uncompressed pprof and thin-data regressions - #128

Merged
jbachorik merged 5 commits into
mainfrom
claude/suspicious-germain-c383c5
Nov 1, 2026
Merged

jbachorik merged 5 commits into
mainfrom
claude/suspicious-germain-c383c5

Conversation

@jbachorik

Copy link
Copy Markdown
Collaborator

What & why

Draft so CI can run the full gate, which takes about 44 minutes locally with the published recordings. CI passing on these commits flips it to ready.

jfr_open event count (cd5b980): jfr_open reported totalEvents: 0 where jfr_summary reported 4262. Open reads metadata only, so the count isn't known yet. totalEvents is now null with a note, in jfr_open, jafar://sessions and jfr_list_types without scan.

Uncompressed pprof (c38c932): pprof_open failed with Not in GZIP format on raw protobuf profiles. Both forms now open, detected from the magic bytes rather than the extension. Content that is neither is rejected with Not a pprof profile. The shell's PprofModule gets the same fix.

jfr_compare on thin data (6be8639): frames going from 0 to 1 sample raised WARNING regressions on 7 and 3 sample recordings. A frame regression now needs 30 samples in each recording, 5 samples of the frame in one of them, and a two-proportion z score of at least 3. These thresholds are my judgement; they aren't derived from data.

Test reliability (a1ab952, bc3b449): LlmConfigTest no longer reads the local settings file. runsInParallelThreads no longer fails at a 10 second limit on a busy machine, and no longer swallows parser exceptions.

How verified

Local runs on JDK 25, macOS, before merging current main.

Gate Result
./gradlew spotlessCheck test shadowJar --continue at 6be8639, with published recordings exit 1: 2313 tests, 3 failed, 16 skipped; jfr-mcp tests were up to date from an earlier run
spotlessCheck, LlmConfigTest and TypedJafarParserStabilityTest with --rerun, after the last two commits BUILD SUCCESSFUL: 11 and 4 tests, 0 failed
runsInParallelThreads with 36 CPU-burning processes passed in 10.41 s, past the old limit

The 3 failures in the first row are the two tests fixed here: 2 in LlmConfigTest, 1 in runsInParallelThreads.

MCP over stdio on the built jar:

  • Event count: totalEvents: null from open, 4262 from jfr_summary.
  • pprof: pprof_open, pprof_summary and pprof_hotmethods on a raw profile, its gzipped copy and both with misleading extensions matched once session and path fields were dropped. The pre-fix jar failed on the two raw files.
  • Compare: 3 WARNINGs became 0, with one INFO regression:insufficient-samples.

Coverage notes

JfrOpenEventCountTest, JfrCompareThinDataTest and new cases in PprofParserTest and PprofModuleTest cover the fixes. In JfrCompareThinDataTest, four of the five tests first failed on a missing field, and only the first test and the rate-gate test were shown to catch the old behaviour.

Not verified / known limitations

  • The full gate has not run on all five commits, or against current main, which is why this is a draft. The branch is 2 commits behind main; a trial merge has no conflicts.
  • The /jfr-analyzer flow hasn't been run against this build, only direct stdio calls.
  • a1ab952 overlaps with 7fb23fe on main, which isolates all tests from local LLM config in Gradle. It's harmless, and still helps runners that don't go through Gradle, but can be dropped.
  • Per-type count stays 0 in jfr_list_types without scan; countsNote covers it.
  • CHANGELOG.md is not updated.

Breaking changes / migration

Tool output changes that clients may parse:

  • jfr_open, jafar://sessions, and jfr_list_types without scan: totalEvents goes from a number to null. totalEventsNote and countsNote are new.
  • jfr_compare: direction can be inconclusive. significant, sufficientSamples, minSamplesPerRecording and the regression:insufficient-samples finding are new, and that finding replaces regression:none on thin data.
  • pprof_open: new error text for invalid files.

Skills in btraceio/agent-plugins that read totalEvents or direction may need updating; this hasn't been checked.

Links

None.

🤖 Generated with Claude Code

jbachorik and others added 5 commits November 1, 2026 11:11
jfr_open returned totalEvents: 0 while jfr_summary reported 4262 for the
same recording. Open reads metadata only and the session counter is only
incremented by typed handlers, which the MCP server never uses, so the
zero was never a count.

totalEvents is now null with a totalEventsNote in jfr_open and
jafar://sessions, and null with a countsNote in jfr_list_types without
scan. Clients reading totalEvents as a number will see the change.

Verified: reproduced over stdio before the fix; JfrOpenEventCountTest
failed before it. The full gate fails 13 tests, the same 13 by name as
clean HEAD; none are in jfr-mcp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pprof_open failed with "Not in GZIP format" on raw protobuf profiles
because the reader always assumed gzip. It now decides from the magic
bytes, so the extension does not matter. Content that is neither gzip
nor a protobuf Profile is rejected with "Not a pprof profile", which also
keeps empty files from opening as empty profiles.

The shell's PprofModule rejected the same files, so it now claims raw
content when the extension matches and the first tag is valid.

Verified: reproduced over stdio before the fix; the new PprofParserTest
and PprofModuleTest cases failed before it. The full gate fails 13 tests,
the same 13 by name as clean HEAD; none are in pprof-parser or
pprof-shell.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comparing 7 and 3 sample recordings raised WARNING regressions for frames
going from 0 to 1 sample, because a single sample of 3 clears a
percentage-point threshold.

A frame regression now needs 30 samples in each recording, 5 samples of
the frame in one of them, and a two-proportion z score of at least 3.
Rate findings are gated on the same recording minimum. Thin data gets an
INFO regression:insufficient-samples finding in place of regression:none.
Frame rows gain significant and can have direction inconclusive; the
result gains sufficientSamples and minSamplesPerRecording.

Verified: reproduced over stdio before the fix (3 WARNINGs, now 0);
JfrCompareThinDataTest failed before it. The full gate fails 13 tests,
the same 13 by name as clean HEAD; none are in jfr-mcp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tests expect no configured model, but picked up llm.model from
~/.config/jafar/llm.properties on any machine that has one, and failed.
They now supply an empty settings file through the existing LlmConfig
constructor. JAFAR_LLM_MODEL in the environment can still affect them.

Verified: :shell-core:test --tests '*LlmConfigTest' passes, 11 tests with
that settings file present; the 2 failures reproduced before the change.
The full gate was not rerun with this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
runsInParallelThreads allowed 10 seconds for two parses of test-ap.jfr
and failed at that limit during a full gate with the published 179 MB
recording, while passing in about 3 seconds alone. It also swallowed
parser exceptions, so a failed parse could pass.

The test now waits on futures with a 5 minute bound that only catches a
hang, and parser exceptions fail it.

Verified: passes alone in 2.2 s and in 10.41 s with 36 CPU-burning
processes running. The full gate was not rerun with this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Combined JUnit Test Report

  • Total: 2330
  • Passed: 2314
  • Failures: 0
  • Errors: 0
  • Skipped: 16

HTML Test Reports

Run artifacts: https://github.com/btraceio/jafar/actions/runs/41300861684

@jbachorik
jbachorik marked this pull request as ready for review November 1, 2026 11:37
@jbachorik
jbachorik merged commit 04e21df into main Nov 1, 2026
4 checks passed
@jbachorik
jbachorik deleted the claude/suspicious-germain-c383c5 branch November 1, 2026 11:37
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.

1 participant