Skip to content

test(cli): fail loudly when two agent_loader tests compile to the same fixture path - #946

Merged
AmaadMartin merged 1 commit into
google:mainfrom
AmaadMartin:fix/agent-loader-test-unique-compiled-fixtures
Sep 25, 2026
Merged

AmaadMartin merged 1 commit into
google:mainfrom
AmaadMartin:fix/agent-loader-test-unique-compiled-fixtures

Conversation

@adk-foundry-bot

@adk-foundry-bot adk-foundry-bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

This pull request will be merged automatically

Scheduled merge: 2026-09-25 21:33 UTC (about 24h from opening).

It was selected by [ADK Foundry] because the merge critic approved
the change, it is small, it touches no sensitive path, and CI is
green. No human has reviewed it.

To stop it: close this pull request, add the status/on-hold
label, or leave a review comment. Any of the three cancels the
merge; pushing a commit restarts the clock. Nothing is merged while
a question is open.

Approving does not stop it. An approval, or a comment that says
only lgtm, lets the merge run on schedule. Add any other text and
the merge stops.

Staged from fork PR #958.

Link to Issue or Description of Change

  • Problem: The AgentFile tests share one mocked temp directory, so agent files with identical basenames compile to the same output path. When two tests compile to the same path, the module runner returns the cached module from the first test. Seven tests collided on agent1.cjs and agent2.cjs, causing four tests to assert against stale modules from earlier tests.
  • Solution: Add mockCompiledOutput to record each compiled outfile path in a Set and throw an error on duplicate paths. Give colliding test fixtures unique filenames so each test compiles and imports its own module. Add a unit test that verifies AgentFile.load() rejects duplicate compiled fixture paths.

Testing Plan

  • I have added or updated unit tests for my change.
  • All unit tests pass locally (npx vitest run dev/test/utils/agent_loader_test.ts).

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

…e path

The AgentFile block mocks createTempDir to return one shared directory, so two
tests whose agent files share a basename compile to the same absolute path. The
module runner then hands the second import() the module the first test already
evaluated. Seven tests were colliding on agent1.cjs and agent2.cjs.

Route every esbuild.build mock through mockCompiledOutput, which claims the
outfile in a file-scoped Set and throws on a repeat. Rename five fixtures so the
guard is satisfiable. No test title, assertion or expected string changes.
@AmaadMartin AmaadMartin added the automerge: scheduled Foundry will merge this automatically; close it to stop that label Sep 24, 2026
@AmaadMartin

Copy link
Copy Markdown
Collaborator

Merging in about 6h unless someone objects. Close this PR, add status/on-hold, or comment to stop it. Approving, or commenting only lgtm, lets it merge. No human has reviewed this change.

@AmaadMartin

Copy link
Copy Markdown
Collaborator

Merging in about 1h unless someone objects. Close this PR, add status/on-hold, or comment to stop it. Approving, or commenting only lgtm, lets it merge. No human has reviewed this change.

@adk-foundry-approver adk-foundry-approver left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved automatically by ADK Foundry. No human has read this change.

This approval attests only that the change passed the gates below, all
enforced in code:

  • the merge critic read the diff and approved it (93.9% precision measured
    against 107 upstream pull requests with known maintainer outcomes)
  • ? changed lines across ? file(s), inside the 200/5 ceiling
  • no auth, credential, security, release or dependency-manifest path touched
  • required checks green, re-verified immediately before this approval
  • opened 25h ago and visible as automerge: scheduled throughout,
    with no objection from anyone

To stop this merging, close the pull request or add status/on-hold. To stop
the mechanism entirely, revoke this account's access; delivery continues and
nothing merges.

@AmaadMartin
AmaadMartin merged commit b1283ba into google:main Sep 25, 2026
16 checks passed
@AmaadMartin AmaadMartin added automerge: merged Merged automatically by Foundry after its 24h review window expired with no objection and removed automerge: scheduled Foundry will merge this automatically; close it to stop that labels Sep 25, 2026
@AmaadMartin AmaadMartin mentioned this pull request Sep 28, 2026
prasanna8585 pushed a commit to prasanna8585/adk-js that referenced this pull request Nov 10, 2026
…e path (google#946)

The AgentFile block mocks createTempDir to return one shared directory, so two
tests whose agent files share a basename compile to the same absolute path. The
module runner then hands the second import() the module the first test already
evaluated. Seven tests were colliding on agent1.cjs and agent2.cjs.

Route every esbuild.build mock through mockCompiledOutput, which claims the
outfile in a file-scoped Set and throws on a repeat. Rename five fixtures so the
guard is satisfiable. No test title, assertion or expected string changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge: human-lgtm automerge: merged Merged automatically by Foundry after its 24h review window expired with no objection

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants