Skip to content

test: assert the test-mode gateway guard through sendPrompt and gbot_send - #68

Merged
ScriptedAlchemy merged 2 commits into
mainfrom
test/guard-behavior
Sep 16, 2026
Merged

ScriptedAlchemy merged 2 commits into
mainfrom
test/guard-behavior

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Follow-up to #64, which the owner merged before these two commits landed on its branch. Test-only: applies test behavior, not implementation to the test-mode gateway guard tests (would the test pass if every import returned undefined? no).

Behavior-test check

  • test/gateway-send.test.js: real loopback HTTP server; asserts the literal sendPrompt result object for a loopback session, then — with GROK_BOT_ALLOW_ANY_GATEWAY=1 switched on — the literal refusal message for the non-routable https://gateway.invalid (production policy would let it through; test mode must not) and that the server saw exactly the two loopback requests. Replaces a fetch mock call-count assertion.
  • test/url-policy.test.js: asserts the literal Rejected … test mode … messages for gateway and backend hosts instead of a shared /test mode/ regex.
  • tests/route-unit/tools.test.ts: invokes the gbot_send MCP tool with https://gateway.invalid + GROK_BOT_ALLOW_ANY_GATEWAY=1 and asserts the literal tool error text and an empty fake-gateway call log, then invokes it against the loopback fake and asserts the literal structuredContent. Replaces an expect(process.env.GROK_BOT_TEST).toBe('1') pin.

Verification

  • npm run test:unit 201/201, npm run build && npm run test:routes 14/14
  • npx changeset status --since=origin/main: nothing to bump (tests are outside changedFilePatterns), so Changeset present passes without a label

Review

change-risk-reviewer (Sol) reviewed these test changes on #64's branch: one Medium (a guard regression would have contacted the real box.cursor.sh) — addressed by targeting gateway.invalid with the escape hatch on. Nothing else remained.

@changeset-bot

changeset-bot Bot commented Sep 16, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 52d100f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-16T06:51:21.603668Z 52d100f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ScriptedAlchemy
ScriptedAlchemy merged commit 55f5966 into main Sep 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant