Fix: drop the unresolvable @google/adk subpath imports from the Vertex AI session service test (stacked on #460) - #512
Open
AmaadMartin wants to merge 1 commit into
Conversation
…x AI session service test The core package's exports map declares only the "." subpath, so '@google/adk/sessions/session.js', '@google/adk/sessions/vertex_ai_session_service.js' and '@google/adk/utils/logger.js' resolve for nobody: not for tsc under moduleResolution nodenext, and not for Node. They appeared to work only because the vitest config aliases the '@google/adk' prefix onto core/src, which turns a deep specifier into a plain path into the source tree. Point each import at a specifier that is actually valid. Session is public (core/src/common.ts exports it), so it joins the existing '@google/adk' import. isVertexAiConnectionString, quoteFilterLiteral and logger are internal, so they use the relative path into src that the other 155 core/test imports already use.
This was referenced Aug 3, 2026
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.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
N/A — no public issue tracks this.
Problem:
core/package.jsondeclares exactly one subpath in itsexportsmap ("."). UndermoduleResolution: nodenextanexportsmap is exhaustive, so any specifier other than the bare package name is unresolvable — for TypeScript and for Node alike. Four files imported deep@google/adk/<subpath>specifiers anyway:tests/integration/agents/agent_with_sandbox_executor_test.ts:9@google/adk/agents/processors/code_execution_request_processor.jsresponseProcessorcore/test/sessions/vertex_ai_session_service_test.ts:9@google/adk/sessions/session.jsSessioncore/test/sessions/vertex_ai_session_service_test.ts:27@google/adk/sessions/vertex_ai_session_service.jsisVertexAiConnectionString,quoteFilterLiteralcore/test/sessions/vertex_ai_session_service_test.ts:28@google/adk/utils/logger.jsloggerAll four produce
error TS2307undernpm run ts:check. They appear to work only becausevitest.config.tsaliases the@google/adkprefix ontocore/src, and Vite alias matching is a prefix replacement — so under vitest the deep specifier silently degrades to a path into the source tree, and nowhere else. That alias is what hid the defect.#460 fixes the first row by publishing the symbol as
CODE_EXECUTION_RESPONSE_PROCESSORon the public barrel. This PR fixes the remaining three, which #460 does not touch.Solution: retarget each of the three imports at a specifier that is actually valid. The right target differs per symbol, because only one of the three is public:
Sessionis already public —core/src/common.ts:230exports it (export type {CompositeSessionKey, Session}). It joins the existing'@google/adk'import on the line above. A plain (non-type) named import of a type-only export is the established style here;core/test/a2a/executor_context_test.ts:8does exactlyimport {Session} from '@google/adk';.isVertexAiConnectionStringandquoteFilterLiteralare internal — exported from neithercommon.ts,index.ts, norindex_web.ts. This is acore/test/**unit test of internal helpers, so it uses the relative path intosrcthat the other 155core/testimports already use.loggeris internal too.common.ts:283-284exportsLogLevel,getLogger,setLogLevel,setLoggerand theLoggertype, but not theloggerconst. Matchescore/test/utils/logger_test.ts:9,core/test/a2a/agent_to_a2a_test.ts:24and three others.Deliberately not done, to keep the change minimal and behaviour-neutral:
core/package.jsonis untouched — no subpath entries, no"./*"wildcard. Widening theexportsmap would make the broken imports resolve by publishing new API surface by accident. Verified below that the deep specifier is still rejected.vitest.config.tsis untouched. Anchoring the alias so deep specifiers fail at test time is the natural follow-up, but it is already in flight as Fix: anchor the vitest workspace aliases so deep @google/adk/* specifiers fail at test time #380 and duplicating it here would guarantee a conflict.tsconfig.jsonis untouched, and has noexcludearray to remove.Collision check (run before writing any code, per the fork's 412 open PRs):
Three adjacent PRs found:
fork/main+ 2 commits, so the stack is clean with no rebase.core/test/sessions/vertex_ai_session_service_test.ts, as a consequence of removing the alias that hid them. If Fix: anchor the vitest workspace aliases so deep @google/adk/* specifiers fail at test time #380 lands first this PR's hunk becomes redundant and should be dropped; if this lands first, Fix: anchor the vitest workspace aliases so deep @google/adk/* specifiers fail at test time #380 keeps only itsvitest.config.tschange. Note Fix: anchor the vitest workspace aliases so deep @google/adk/* specifiers fail at test time #380 and Fix: export CODE_EXECUTION_RESPONSE_PROCESSOR from the @google/adk public API #460 conflict with each other ontests/integration/agents/agent_with_sandbox_executor_test.ts(Fix: export CODE_EXECUTION_RESPONSE_PROCESSOR from the @google/adk public API #460 routes it through the new public export, Fix: anchor the vitest workspace aliases so deep @google/adk/* specifiers fail at test time #380 through a relativecore/srcpath) — Fix: export CODE_EXECUTION_RESPONSE_PROCESSOR from the @google/adk public API #460's approach is the one that fixes the underlying packaging defect.Testing Plan
Please describe the tests that you ran to verify your changes. This is required for all PRs that are not small documentation or typo fixes.
Unit Tests:
[x] I have added or updated unit tests for my change.
[x] All unit tests pass locally.
This PR's own delta rewrites import specifiers only; it adds no executable source line, so there is nothing new to cover. The guarantee is a resolution gate, not line coverage, and it is enforced by
npm run ts:check:Targeted runs, all on the pushed commit:
Proof the checks can fail. Each guard was run against the unfixed code and confirmed to fail.
Mutation A — revert this PR's file to the stack base (
git checkout fork/main -- core/test/sessions/vertex_ai_session_service_test.ts), thennpm run ts:check:Restored, the same command prints nothing. Total
tsc --noEmiterror count across the whole stack: 281 before, 277 after — exactly the fourTS2307the bug report names, and no new diagnostics. (The remaining 277 are pre-existing and unrelated; the roottsconfig.jsondeclares noinclude, sotscsweeps the entire repo including the consumer fixtures. Making that clean is not this task.)Mutation B — delete the
common.tsre-export block, then the barrel guard inherited from #460:Mutation C — same deletion, rebuilt, then the real-consumer fixture, which resolves through the genuine
exportsmap ("@google/adk": "file:../../../../core",noEmitOnError: true):C is the one with real teeth: it is the only check in the tree that would still fail if the vitest alias were reintroduced, because it does not go through vitest resolution at all.
Manual End-to-End (E2E) Tests:
Please provide instructions on how to manually test your changes, including any necessary setup or configuration.
Proves the specifier resolves for a genuinely out-of-tree consumer — the property that was actually broken and that no in-repo check covers:
And the negative — confirming the
exportsmap was not widened to make the old specifiers resolve:CI status: absent, validated locally instead.
.github/workflows/validation.yamltriggers onpull_request: branches: [main], so a PR based onfix/export-code-execution-response-processornever triggers it. Everything CI would run was run locally on the pushed commit:npm run buildnpm run lintnpm run format:checkAll matched files use Prettier code style!npm run docs:check--treatWarningsAsErrors, exit 0)npm run ts:check | grep TS2307 | grep @google/adknpm run test:coverage(whole-suite) was not run, per the instruction to run only targeted tests.Checklist
[x] I have read the CONTRIBUTING.md document.
[x] I have performed a self-review of my own code.
[x] I have commented my code, particularly in hard-to-understand areas.
[x] I have added tests that prove my fix is effective or that my feature works.
[x] New and existing unit tests pass locally with my changes.