Fix: remove the no-op @ts-ignore on the esbuild-shim-plugin import - #381
Open
AmaadMartin wants to merge 1 commit into
Open
Fix: remove the no-op @ts-ignore on the esbuild-shim-plugin import#381AmaadMartin wants to merge 1 commit into
AmaadMartin wants to merge 1 commit into
Conversation
esbuild-shim-plugin@1.0.3 ships dist/index.d.ts (declaring `shimPlugin: () => Plugin`) and TypeScript resolves it under this repo's moduleResolution: nodenext via the .js -> .d.ts substitution rule, so the @ts-ignore was suppressing nothing. Swapping it for @ts-expect-error makes tsc report "TS2578: Unused '@ts-expect-error' directive", which proves there is no error on that import line. Left in place, the directive blinds the compiler to any future breakage of this import. The eslint-disable for ban-ts-comment exists only to permit the @ts-ignore, so both lines go together. dev/build.js already imports the same symbol from the same package with no suppression. Comment-only deletion: the emitted dev/dist/esm/utils/agent_loader.js is byte-identical before and after.
This was referenced Aug 1, 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
Link to an existing issue (if applicable):
N/A — no existing issue.
Or, if no issue exists, describe the change:
Problem:
dev/src/utils/agent_loader.tscarried an unreasoned checker suppression on theesbuild-shim-pluginimport:This
@ts-ignoresuppresses nothing. The natural assumption is thatesbuild-shim-pluginships no type declarations — that assumption is wrong, and it was checked rather than guessed:esbuild-shim-plugin@1.0.3(the version pinned bypackage-lock.json) declares"types": "dist/index.d.ts"and ships it:TypeScript really resolves it under this repo's
moduleResolution: nodenext. The package'sexportsmap has no"types"condition, but it does not need one — TS resolves"import": "./dist/index.js"and then applies its.js→.d.tssubstitution rule. Fromnpx tsc --noEmit --traceResolution -p tsconfig.json:Direct proof the directive is dead. Swapping
@ts-ignorefor@ts-expect-error(which errors when it has nothing to suppress) and compiling gives:TS2578is conclusive: there is no error on that import line.Corroborating evidence already in the repo:
dev/build.js:15imports the very same symbol from the very same package with no suppression at all. If the import needed one, that line would be a problem too.Left in place, the directive is worse than noise — it blinds the compiler to any future breakage of this import. If
esbuild-shim-pluginever changes its export shape,@ts-ignorewould silently swallow the resulting error.Solution: delete both lines. They are a co-dependent pair:
ban-ts-commentfires on@ts-ignore, so theeslint-disableis load-bearing only because of the@ts-ignorebeneath it. Removing the@ts-ignorealone would leave a stale directive behind.1 file changed, 2 deletions(-). Net suppression count falls by exactly 2;git grep "@ts-ignore" -- "*.ts"now returns zero hits repo-wide. No new suppression of any kind was introduced.Why there is no new
.d.ts. Hand-writingdeclare module 'esbuild-shim-plugin'would not just be redundant, it would be unsound. Because the module already resolves, TypeScript treats such a block as a module augmentation that merges into the package's real declarations — so a hand-written signature that drifts from upstream (e.g. one accepting options the real zero-argument function ignores) would compile cleanly with no error to warn anyone. That would reintroduce exactly the class of silent unsoundness this change removes.Runtime impact: none. This is a comment-only deletion.
shimPlugin()is still wired into the esbuildpluginsarray atagent_loader.ts:189, unchanged.Collision check. Before starting I checked the 285 open PRs on this fork for a competing or overlapping change (
gh pr list ... --json number,title,headRefName, thengh pr diff --name-only/ full-diff greps on every plausibly adjacent PR). No open PR touches@ts-ignore,ban-ts-comment, oresbuild-shim. Six open PRs do touchdev/src/utils/agent_loader.ts(#365, #328, #309, #285, #275, #264), but the earliest hunk in any of them starts at line 49 — none touches the import block at lines 6–16, so there is no line-level overlap and this branch is based onmainrather than stacked.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. — No; deliberately none, see below.
[x] All unit tests pass locally.
Why no unit test accompanies this change. The change adds zero new lines of executable code — it deletes two comment lines, which are erased at compile time and counted by no coverage tool. There is no behavior delta to assert: the emitted JavaScript is byte-identical (demonstrated below). Any test written for this change would pass identically against the fixed and unfixed code, which is a green light with no signal. Fabricating one to hit a coverage number would be worse than writing none.
The real regression guard here is static and machine-checkable, and both gates were run:
The strict
--max-warnings 0form matters: ESLint reports unused directives only as warnings, so plainnpm run lintwould not catch a half-done job.Full acceptance run, all on commit
bbda488:npm run buildnpm run lintnpx eslint "**/*.ts" --max-warnings 0npm run format:checknpm run docs:checknpx vitest run --project unit:dev dev/test/utils/agent_loader_test.tsnpx vitest run --project unit:devts:checkerror set is unchanged. Capturednpx tsc --noEmit --pretty falseon a clean tree and again with the change applied: 280 errors before, 280 after, anddiffof the two reports the outputs are byte-identical. These 280 are pre-existing and out of scope (the roottsconfig.jsondeclares noinclude, sotsc --noEmitsweeps test files that rely on Vitest path aliases); none of them is inagent_loader.tsand none mentions theesbuild-shim-pluginmodule specifier. Note--pretty falseis required — ANSI colour codes sit betweenerrorandTSin the default output, sogrep -c "error TS"silently matches nothing.Pre-existing failures, verified unrelated (both reproduced on pristine
mainatfcfd043with zero diff applied):dev/test/cli/cli_create_test.ts > createAgent > Interactive Mode > should handle Vertex AI selection with gcloud defaults— asserts a mocked project id ofgcloud-projectbut picks up the host machine's real configured gcloud default project. Fails identically onmain.tests/integration/agent_loader/agent_dirname_test.ts— itsbeforeAllrunsnpm installinside the fixture with a 40 s budget and times out in this network-restricted environment, so the assertions never execute. Fails onmaintoo.Manual End-to-End (E2E) Tests
1. The emitted output is byte-identical — the strongest possible demonstration that this is behavior-preserving:
diffreports no differences (exit 0; 15024 bytes both times).2. Real no-mock load through
AgentFile.load(). The existingagent_loader_test.tsmocksesbuild, so it does not exerciseshimPluginfor real. To prove the import still works at runtime I drove the builtdev/dist/esm/utils/agent_loader.jsagainst a scratch.tsagent that uses all three constructsshimPlugininjects —__dirname(reading a sidecar JSON beside it),__filename, andimport.meta.url:And that harness was proved able to fail. Mutating the source to drop
shimPlugin()from the esbuildpluginsarray and rebuilding makes the same run die with:Restoring
shimPlugin()returns it toRUNTIME E2E OK. So the check has real signal, and it confirms the plugin is still correctly wired after the suppression was removed. (The harness was scratch scaffolding and is intentionally not part of this diff — it asserts pre-existing behavior that this comment-only change cannot alter.)To reproduce manually instead: point the ADK CLI at
tests/integration/agent_loader/__dirname/agent.tsand confirm it still compiles, bundles, and loads.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. — N/A; this change only removes comments.
[x] I have added tests that prove my fix is effective or that my feature works. — See "Why no unit test accompanies this change" above: no executable lines are added and no behavior changes, so the guard is the static gate plus the byte-identical-output check.
[x] New and existing unit tests pass locally with my changes.