feat(policies): add gemini preset#4962
Conversation
📝 WalkthroughWalkthroughThis PR adds a new Gemini preset enabling Google Gemini API access with enforced network policies. The preset defines allowed REST endpoints on ChangesGemini API Preset and Coverage
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/policies.test.ts`:
- Line 184: The file exceeds the test-size guardrail because multiple
Gemini-specific assertions (the tests containing the "gemini" string and the
related assertion blocks you added) were added to the large policies test;
extract all Gemini-focused tests into a new, focused test file (e.g.,
policies-gemini.test.ts): locate the top-level describe/it blocks that reference
"gemini" and the related assertion groups you added, copy them into the new
file, ensure any shared helpers/imports used by those blocks are imported there,
then remove those blocks from the original test file so the original drops under
the size budget and the new file runs the Gemini assertions separately.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 4a7cf623-2aa8-40c9-8a18-39f48efad02c
📒 Files selected for processing (2)
nemoclaw-blueprint/policies/presets/gemini.yamltest/policies.test.ts
| "brew", | ||
| "claude-code", | ||
| "discord", | ||
| "gemini", |
There was a problem hiding this comment.
Split the new Gemini tests into a dedicated test file to unblock CI.
This file now fails the test-size guardrail (3174 > 2763). Please move the newly added Gemini assertions into a focused file (e.g., test/policies-gemini.test.ts) so test/policies.test.ts drops back under budget.
Also applies to: 233-255, 502-506
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@test/policies.test.ts` at line 184, The file exceeds the test-size guardrail
because multiple Gemini-specific assertions (the tests containing the "gemini"
string and the related assertion blocks you added) were added to the large
policies test; extract all Gemini-focused tests into a new, focused test file
(e.g., policies-gemini.test.ts): locate the top-level describe/it blocks that
reference "gemini" and the related assertion groups you added, copy them into
the new file, ensure any shared helpers/imports used by those blocks are
imported there, then remove those blocks from the original test file so the
original drops under the size budget and the new file runs the Gemini assertions
separately.
Source: Pipeline failures
Summary
Adds a new
geminipolicy preset for Google Gemini API access so the repo can route the Generative Language API through a dedicated, security-scoped preset. This keeps Gemini access consistent with the other policy presets and makes the allowed network surface explicit.Related Issue
None.
Changes
nemoclaw-blueprint/policies/presets/gemini.yamlwith the Gemini host, REST routing rules, and binary allowlist.test/policies.test.tsto include the new preset in the preset list assertions.Type of Change
Verification
npx prek run --all-filespassesnpm testpassesnpm run docsbuilds without warnings (doc changes only)Additional Verification
npm run build:clinpm test -- --run test/policies.test.tsDCO sign-off required by CI.
Signed-off-by: AbbyJL 454816714@qq.com
Summary by CodeRabbit
New Features
Tests