chore(#4727): name the tool-conversion helpers for the runtime that uses them (#4732)

* chore(#4727): name the tool-conversion helpers for the runtime that uses them

GSD has had no Gemini runtime since #1928 removed it (Google sunset Gemini CLI
on 2026-06-18, shipped 1.8.0), yet two helpers were still named for it:

  claudeToGeminiTools    -> claudeToAntigravityTools
  convertGeminiToolName  -> convertAntigravityToolName

The sole consumer is convertClaudeAgentToAntigravityAgent, whose own comment
read "Map tools to Gemini equivalents (reuse existing convertGeminiToolName)".
Nothing named Gemini consumes them, because nothing named Gemini exists. The
new names follow the convention the file already sets with its neighbouring
Copilot pair, claudeToCopilotTools / convertCopilotToolName.

Zero behavior change. Every mapped VALUE is byte-identical, deliberately:

  read_file, write_file, replace, run_shell_command, glob,
  search_file_content, google_web_search, web_fetch, write_todos

Those are Gemini's built-in tool dialect and Antigravity genuinely speaks it.
This rename covers only the identifiers, which are the one part of the surface
that was GSD's choice rather than Google's contract.

Renamed in BOTH copies. CLAUDE.md labels bin/install.js "(generated)", but no
script emits it -- build:lib is tsc -p tsconfig.build.json and writes only
gsd-core/bin/lib/**. These converters are the #1099/#1173/#1182 situation: they
were extracted into src/runtime-artifact-conversion.cts while bin/install.js
kept its own working inline copies, so each symbol existed twice in two
independently hand-maintained files. Renaming one would have left two names for
one concept. Verified first that no capability descriptor resolves either by
name -- antigravity's descriptor names only convertClaudeCommandToAntigravitySkill
and convertClaudeAgentToAntigravityAgent, neither of which moved.

Comments keep their reasoning and their issue refs (#3362 AskUserQuestion,
#1394 Skill/SlashCommand); only the subject is corrected, from "Gemini CLI" to
Antigravity speaking the Gemini dialect. Those describe the dialect's behavior,
which is still Antigravity's behavior, so deleting them would destroy the record
of two real bugs.

docs/research/gemini-to-antigravity-migration.md is left unedited and carries a
dated addendum instead: it is pinned to c0b2a05d2f and quotes #1928's commit
message verbatim, so rewriting a citation to match a later tree would falsify a
primary source. ADR-1593's dimension-3 row is updated, because that table is a
present-tense index of which helper implements each dimension and would
otherwise name a symbol that no longer exists.

Coverage: the module is the only export surface -- bin/install.js exports none
of these four, its inline copies being module-private -- so the new assertion
targets gsd-core/bin/lib/runtime-artifact-conversion.cjs and checks the new keys
present, the old keys absent (no alias left behind), deepStrictEqual on the whole
map so an added or removed key fails, and each excluded input individually. The
installer's inline copy stays covered behaviorally by the existing test that
imports convertClaudeAgentToAntigravityAgent from bin/install.js.

Phase 4a of epic #4709. Refs #4727

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* chore(#4727): fix three review blockers — ADR append-only, honest verdict, changeset

The isolated adversarial review returned BLOCK on three majors. All three were
right and all three are fixed here.

1. ADR-1593 was amended IN PLACE, violating docs/adr/README.md:5: "ADRs are
   append-only. Amendments extend existing ADRs with a dated section rather
   than replacing them." The dimension-3 row is restored to its original text
   and a dated "Amendment — 2026-09-14 (#4727)" section is appended instead.
   Worse than the policy breach: the previous commit applied OPPOSITE rules to
   two docs in one change, freezing the research doc's citations while
   rewriting the ADR's. Both now follow append-only.

2. The research-doc addendum claimed "the rename recommended in the PRESERVE
   table has landed" and that the "PRESERVE — trap" verdict "still holds".
   Neither is true. §2(c) is headed "MUST NOT be renamed" and the §6 table
   files both symbols under (c). The rename OVERTURNS that verdict, and the
   addendum now says so in those words: it is a NARROWING of (c), whose real
   subject is what Google owns -- the directories, the dialect, GEMINI.md, the
   model ids, and for these two symbols the mapped VALUES, which stay
   byte-identical. What (c) had swept in with them were two GSD-chosen
   identifiers no external contract references. Claiming endorsement from a
   verdict that forbade the change was the actual defect; the substantive
   argument was always sound.

   The addendum also now names the two superseded rows (~:55, ~:136) so a
   later reader is not misled, and discloses that §2(a)'s verbatim quotation
   (~:40) no longer matches its source: it reproduces the test docblock's old
   "convertGeminiToolName" wording, and #4727 reworded that docblock. The
   docblock had to move -- leaving it would make the #1928 guard describe a
   symbol that does not exist -- so the mismatch is disclosed rather than
   papered over by editing the quote, which is the one thing the addendum
   exists to avoid.

3. no-changelog was the wrong call. scripts/changeset/lint.cjs reports
   fail_missing_fragment because the diff touches src/ and bin/, and
   CONTRIBUTING.md:216 states src/ edits are user-facing "even though the
   generated .cjs is gitignored", with :224 adding "When unsure whether a
   change is user-facing, add the fragment." Confirmed concretely: gsd-core is
   in package.json's files array so the compiled module ships, and there is no
   exports map, so a consumer's deep require of
   gsd-core/bin/lib/runtime-artifact-conversion.cjs resolved
   .convertGeminiToolName before this change and gets undefined after. A
   Changed fragment is added. I had asserted "nothing user-facing" without
   running the repo's own changeset lint; the reviewer ran it.

Two review findings are accepted and recorded rather than fixed, both in the
research addendum's new §8: the bin/install.js half of the rename is
test-unprotected (that file exports none of the four identifiers and the export
audit asserts undefined for both spellings, so reverting it breaks no test --
its behavior is covered, its naming is not), and closing that needs the
repo-wide drift guard, which is #4729 and the last phase of the epic for
precisely this reason.

Refs #4727

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* chore(#4727): backfill changeset pr number to 4732

Refs #4727

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* test(#4727): assert both halves of the windsurf pre-write guard's contract

PR #4732's `conformance test (windows-latest, 24, shard 2/3)` failed on exactly
one assertion, and the base branch was green, so this is not inherited:

    tests/windsurf-hooks-bridge.test.cjs:104
    expected exit 2, got 0
    stderr: gsd-windsurf-pre-write: git probe 'git rev-parse --show-toplevel (cwd)' …
    duration_ms: 2909

Root cause, not a flake. hooks/gsd-windsurf-pre-write.js gives every git probe a
2000 ms budget (SPAWNOPT.timeout) and FAILS OPEN when a probe cannot run — its
own header states that outright, because "a hook bug must never wedge Cascade".
hooks/lib/git-probe.js (#3911) exists precisely because that budget is routinely
exceeded in CI; its header records a macOS run landing at 2084/2112/2177 ms,
just past the budget, and its reportIfUndetermined() announces the case on
stderr while deliberately changing no exit code.

So the hook has TWO documented outcomes:

  (a) probe resolved and the file's git root differs  -> BLOCK, exit 2
  (b) probe UNDETERMINED (timeout / spawn failure)   -> FAIL OPEN, exit 0,
                                                         announced on stderr

G1 and G1b asserted `status === 2` unconditionally, encoding only (a). They
therefore fail whenever the documented (b) occurs, which makes them
load-sensitive by construction. My diff did not touch that hook or its tests;
it re-packed the Windows chunks (6 -> 8 under #4737's derived cap), which raised
load enough to tip the 2 s budget and expose the latent assertion.

Both tests now branch on whether the hook ANNOUNCED an undetermined probe, and
assert the correct half in each case. This is not a loosened assertion:

  - undetermined -> exit 0 is REQUIRED. That arm still has teeth, because it
    fails if the hook ever blocks on a probe it could not determine, which is
    the dangerous direction — wedging the agent on a hook bug.
  - determined   -> the original exit 2 plus the original stderr-reason regex,
    unchanged.

The matcher is tied to reportIfUndetermined's exact message rather than a loose
/git probe/, and was proven against both strings: it matches the real
undetermined diagnostic and does NOT match a normal block message. No retry, no
sleep, no timing-dependent logic.

Deliberately NOT done: raising the hook's 2000 ms budget. That is forbidden here
without an explicit instruction, and it would only move the cliff rather than
fix the test's false premise.

Scope note: this is a test fix in a file unrelated to the rename, carried here
because it is what makes #4732 red. CLAUDE.md's no-deferral rule is explicit
that a defect found anywhere in the tree is fixed in the current change, and
that it overrides one-concern-per-PR.

Refs #4727

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: sim <sim@local>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-09-14 15:11:27 -04:00
committed by GitHub
parent 9b750dc00a
commit b647e28313
9 changed files with 233 additions and 55 deletions

View File

@@ -12,8 +12,8 @@
* co-selected valid runtime still installs.
* B. The `gemini` runtime is gone from every runtime-name-policy surface.
* C. Antigravity is PRESERVED everywhere it shared surface with gemini
* (GEMINI.md instruction file + the shared convertGeminiToolName tool
* vocabulary) — the shared-infra regression this change had to avoid.
* (GEMINI.md instruction file + the shared convertAntigravityToolName
* tool vocabulary) — the shared-infra regression this change had to avoid.
*/
'use strict';
@@ -204,11 +204,66 @@ describe('#1928 Antigravity preserved (shared surface with the removed gemini ru
test('the shared Gemini-backend tool vocabulary still powers Antigravity agent conversion', () => {
const input = ['---', 'name: gsd-x', 'description: d', 'tools: Read, Write, WebFetch, Skill', '---', '', 'body'].join('\n');
const toolsLine = convertClaudeAgentToAntigravityAgent(input).split('\n').find((l) => l.startsWith('tools:')) || '';
assert.ok(toolsLine.includes('read_file'), 'Read → read_file via the retained convertGeminiToolName');
assert.ok(toolsLine.includes('read_file'), 'Read → read_file via the retained convertAntigravityToolName');
assert.ok(toolsLine.includes('write_file'), 'Write → write_file');
assert.ok(toolsLine.includes('web_fetch'), 'WebFetch → web_fetch');
assert.ok(!/\bskill\b/.test(toolsLine), 'Skill is still excluded (would be an invalid backend tool name)');
});
test('#4727 the rename is complete: no gemini-named alias survives alongside the antigravity-named exports', () => {
// Exports-shape check against the compiled module, not a text scan of source — #4727 renamed
// claudeToGeminiTools/convertGeminiToolName to claudeToAntigravityTools/convertAntigravityToolName
// in place; a partial rename would leave BOTH names live as two aliases for one concept, which
// is exactly the drift this epic exists to end.
const mod = require(path.join(ROOT, 'gsd-core', 'bin', 'lib', 'runtime-artifact-conversion.cjs'));
assert.ok(
Object.prototype.hasOwnProperty.call(mod, 'claudeToAntigravityTools'),
'the renamed tool map must be exported under its new name',
);
assert.ok(
Object.prototype.hasOwnProperty.call(mod, 'convertAntigravityToolName'),
'the renamed conversion function must be exported under its new name',
);
assert.ok(
!Object.prototype.hasOwnProperty.call(mod, 'claudeToGeminiTools'),
'the retired gemini-named map must not still be exported — a surviving alias means the rename never finished',
);
assert.ok(
!Object.prototype.hasOwnProperty.call(mod, 'convertGeminiToolName'),
'the retired gemini-named function must not still be exported — a surviving alias means the rename never finished',
);
// The rename must be a pure identifier change: every value byte-identical, so an added OR
// removed key (not just a renamed export) fails this too.
assert.deepStrictEqual(mod.claudeToAntigravityTools, {
Read: 'read_file',
Write: 'write_file',
Edit: 'replace',
Bash: 'run_shell_command',
Glob: 'glob',
Grep: 'search_file_content',
WebSearch: 'google_web_search',
WebFetch: 'web_fetch',
TodoWrite: 'write_todos',
}, 'the tool map values are Gemini\'s built-in tool dialect, which Antigravity speaks — Google\'s '
+ 'contract, not GSD\'s to alter by renaming the map that carries it');
// In-set / out-of-set boundary pair: the excluded ids still return null individually...
for (const excluded of ['mcp__anything', 'Task', 'Agent', 'AskUserQuestion', 'ask_user', 'Skill', 'SlashCommand']) {
assert.strictEqual(
mod.convertAntigravityToolName(excluded),
null,
`${excluded} must still be excluded from the Antigravity tool dialect after the rename`,
);
}
// ...and an unmapped name still falls through to the lowercase default.
assert.strictEqual(
mod.convertAntigravityToolName('SomeOtherTool'),
'someothertool',
'an unmapped tool name must still lowercase-fallback after the rename',
);
});
});
/**

View File

@@ -3717,8 +3717,8 @@ describe('bin/install.js compatibility export audit (#1559, retired by #2876)',
'convertClaudeToCursorMarkdown',
'convertClaudeToCodexMarkdown',
'transformContentToHyphen',
'claudeToGeminiTools',
'convertGeminiToolName',
'claudeToAntigravityTools',
'convertAntigravityToolName',
'rewriteStagedSkillBodies',
'rewriteStagedCommandBodies',
'_computePathPrefix',

View File

@@ -452,10 +452,10 @@ Do nothing.`;
//
// The gemini-RUNTIME's own top-level converter (convertClaudeToGeminiAgent) and
// its dedicated test coverage were removed with the gemini runtime (#1928,
// Google sunset Gemini CLI 2026-06-18). convertGeminiToolName and
// claudeToGeminiTools STAY — they are shared infra reused by Antigravity (which
// runs on the same backend tool-name vocabulary), so the Antigravity-facing
// regression coverage below is retained unchanged.
// Google sunset Gemini CLI 2026-06-18). convertAntigravityToolName and
// claudeToAntigravityTools STAY — they are shared infra reused by Antigravity
// (which runs on the same backend tool-name vocabulary), so the
// Antigravity-facing regression coverage below is retained unchanged.
describe('#1394 regression: excludes Skill/SlashCommand from Antigravity frontmatter', () => {
// Skill/SlashCommand are Claude-only tools with no Gemini-backend built-in
@@ -463,7 +463,7 @@ describe('#1394 regression: excludes Skill/SlashCommand from Antigravity frontma
// emit an invalid 'skill'/'slashcommand' tool name, which fails frontmatter
// validation (tools.N: Invalid tool name) and aborts the entire agent load.
// Antigravity reuses convertGeminiToolName (it runs on the Gemini backend),
// Antigravity reuses convertAntigravityToolName (it runs on the Gemini backend),
// so the exclusion intentionally applies there too. Antigravity surfaces GSD
// skills through the skill surface (SKILL.md), not the agent tools: allowlist,
// so dropping the invalid 'skill' tool name does not remove skill access —

View File

@@ -101,8 +101,21 @@ describe('gsd-windsurf-pre-write.js (pre_write_code guard)', () => {
tool_info: { file_path: path.join(otherRepo, 'target.txt') },
}, { cwd: cwdRepo });
assert.equal(result.status, 2, `expected exit 2, got ${result.status} (stderr: ${result.stderr})`);
assert.match(result.stderr, /differs from the active project root|inside a git internal/);
// hooks/gsd-windsurf-pre-write.js gives every git probe a 2000 ms budget
// (SPAWNOPT.timeout) and, by documented design, fails OPEN (exit 0) via
// hooks/lib/git-probe.js's reportIfUndetermined() (#3911) when the probe
// cannot be resolved in time — its own header records a macOS CI run
// landing at 2084ms/2112ms/2177ms, just past the budget. This is NOT a
// tolerated flake: both halves of the hook's contract are asserted below,
// and which half applies is decided by the observed probe outcome, not
// guessed in advance.
const probeUndetermined = /git probe '[^']+'.*allowing this call because the probe's answer is unknown/.test(result.stderr);
if (probeUndetermined) {
assert.equal(result.status, 0, `probe was undetermined, so the hook must fail OPEN (exit 0), got ${result.status} (stderr: ${result.stderr})`);
} else {
assert.equal(result.status, 2, `expected exit 2, got ${result.status} (stderr: ${result.stderr})`);
assert.match(result.stderr, /differs from the active project root|inside a git internal/);
}
});
test('G1b: a write inside a DIFFERENT repo\'s .git internals -> exit 2 + stderr reason', (t) => {
@@ -116,8 +129,18 @@ describe('gsd-windsurf-pre-write.js (pre_write_code guard)', () => {
tool_info: { file_path: path.join(otherRepo, '.git', 'config') },
}, { cwd: cwdRepo });
assert.equal(result.status, 2, `expected exit 2, got ${result.status} (stderr: ${result.stderr})`);
assert.match(result.stderr, /inside a git internal \(\.git\) directory/);
// Same rationale as G1 above: hooks/gsd-windsurf-pre-write.js's 2000 ms
// per-probe budget, its documented fail-open, and hooks/lib/git-probe.js's
// reportIfUndetermined() (#3911) mean an undetermined probe is a
// legitimate, documented outcome (CI observed 2084ms/2112ms/2177ms —
// just past budget), not a flake to be tolerated by loosening the assert.
const probeUndetermined = /git probe '[^']+'.*allowing this call because the probe's answer is unknown/.test(result.stderr);
if (probeUndetermined) {
assert.equal(result.status, 0, `probe was undetermined, so the hook must fail OPEN (exit 0), got ${result.status} (stderr: ${result.stderr})`);
} else {
assert.equal(result.status, 2, `expected exit 2, got ${result.status} (stderr: ${result.stderr})`);
assert.match(result.stderr, /inside a git internal \(\.git\) directory/);
}
});
test('G2: a write resolving to the SAME git root as cwd -> exit 0 (allowed)', (t) => {