feat(explorer): add Java agent version selector to Configuration Builder#492
Conversation
✅ Deploy Preview for otel-ecosystem-explorer ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
Adds a Java agent version selector to the Java agent Configuration Builder page header, wiring it through to instrumentation registry fetching and YAML preview generation, and removes the superseded “latest agent version” hook.
Changes:
- Add an “Agent” version selector alongside the existing schema selector and plumb the selected agent version through the builder.
- Refetch Java agent instrumentation registry data when the agent version changes and reflect the selection in the YAML preview header.
- Remove
useLatestJavaAgentVersion(and its unit test) and updatePreviewCardto accept the agent version as an explicit prop; add an integration test for the new selector behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ecosystem-explorer/src/test/integration/configuration-builder-instrumentation-version.integration.test.tsx | New integration coverage for agent version selector + refetch + YAML header behavior. |
| ecosystem-explorer/src/hooks/use-latest-java-agent-version.ts | Removed now-unneeded hook that derived the latest Java agent version implicitly. |
| ecosystem-explorer/src/hooks/use-latest-java-agent-version.test.ts | Removed unit test for the deleted hook. |
| ecosystem-explorer/src/features/java-agent/configuration/configuration-builder-page.tsx | Adds agent selector state, passes javaAgentVersion into instrumentation registry lookups and preview rendering. |
| ecosystem-explorer/src/features/java-agent/configuration/components/preview-card.tsx | Makes the agent version an explicit input prop to YAML generation (instead of reading it via a hook). |
| ecosystem-explorer/src/features/java-agent/configuration/components/preview-card.test.tsx | Updates tests for the new PreviewCard prop and adds coverage for a non-latest agent version. |
Comments suppressed due to low confidence (2)
ecosystem-explorer/src/test/integration/configuration-builder-instrumentation-version.integration.test.tsx:63
- This interaction is coupled to a specific fixture version (selecting "2.26.1") and to a specific rendering string ("2 versions"). Since integration tests read from
public/data/javaagent/**, these assumptions can break whenever the registry data changes. Consider selecting a non-latest option dynamically (e.g., pick the first option that is not latest) and asserting that some stable instrumentation-specific content changes between the two selections, rather than matching a particular count string.
const reactorRow = (await screen.findByTestId(
"instrumentation-row-reactor",
{},
{ timeout: 10_000 }
)) as HTMLElement;
expect(within(reactorRow).getByText("2 versions")).toBeInTheDocument();
await user.selectOptions(agent, "2.26.1");
ecosystem-explorer/src/test/integration/configuration-builder-instrumentation-version.integration.test.tsx:119
expect(localStorage.length).toBe(0)makes this test sensitive to any other feature that might legitimately write to localStorage during render (e.g., theme, feature flags, router state). To keep the test focused on agent-version persistence, it would be more robust to only assert that the agent selector resets to the latest value after remount, without asserting the entire localStorage is empty.
unmount();
expect(localStorage.length).toBe(0);
| it("does not persist the Agent selection — remount resets to latest with empty localStorage", async () => { | ||
| const { unmount } = renderPage(); | ||
| const user = userEvent.setup(); | ||
| const agent = await findAgentSelector(); | ||
| await user.selectOptions(agent, "2.26.1"); | ||
| expect(agent.value).toBe("2.26.1"); | ||
|
|
||
| unmount(); | ||
| expect(localStorage.length).toBe(0); | ||
|
|
||
| renderPage(); | ||
| const reloaded = await findAgentSelector(); | ||
| expect(reloaded.value).toBe("2.27.0"); | ||
| }); |
There was a problem hiding this comment.
The schema selector on the same page doesn't persist either, both default to latest. Avoids the stale-config case where someone reopens the builder weeks later and silently targets an old agent.
Closes #475.
Adds an Agent version selector next to the Schema one in the header. Switching it refetches the registry and updates the YAML preview. No persistence, same as the schema selector. Drops the now-unused useLatestJavaAgentVersion hook.