Skip to content

chore: re-gate web search#1625

Merged
aidandaly24 merged 2 commits into
mainfrom
regate-web-search
Jun 23, 2026
Merged

chore: re-gate web search#1625
aidandaly24 merged 2 commits into
mainfrom
regate-web-search

Conversation

@nborges-aws

Copy link
Copy Markdown
Contributor

Description

Re-gate web search after changes to devEx

Related Issue

Closes #

Documentation PR

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

How have you tested the change?

  • I ran npm run test:unit and npm run test:integ
  • I ran npm run typecheck
  • I ran npm run lint
  • If I modified src/assets/, I ran npm run test:update-snapshots and committed the updated snapshots

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

@nborges-aws nborges-aws requested a review from a team June 23, 2026 20:34
@github-actions github-actions Bot added the size/m PR size: M label Jun 23, 2026
@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 23, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Jun 23, 2026
@aidandaly24 aidandaly24 merged commit 9e39abf into main Jun 23, 2026
24 checks passed
@aidandaly24 aidandaly24 deleted the regate-web-search branch June 23, 2026 20:34
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.20.2.tgz

How to install

gh release download pr-1625-tarball --repo aws/agentcore-cli --pattern "*.tgz" --dir /tmp/pr-tarball
npm install -g /tmp/pr-tarball/aws-agentcore-0.20.2.tgz

@agentcore-cli-automation agentcore-cli-automation left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for re-gating this. I have two concerns worth addressing before merge — the new AddScreen test doesn't actually exercise the gating logic it claims to, and the top-level add web-search / remove web-search subcommands ignore --json on the gating error path. Details inline.


expect(lastFrame()).toContain('Web Search');
expect(lastFrame()).toContain('Coming soon');
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test does not actually exercise the gating logic for web-search.

ADD_RESOURCE_ITEMS in AddScreen.tsx is computed at module import time, so its disabled/description values are frozen based on whatever ENABLE_GATED_FEATURES was at the moment the test file imported AddScreen. The beforeEach setting process.env.ENABLE_GATED_FEATURES = '1' (and this test's delete) have no effect on the rendered output — the constants are already baked in.

In the default vitest env, ENABLE_GATED_FEATURES is unset, so this test passes coincidentally. It would still pass even if the source change in AddScreen.tsx were reverted, since the only thing being asserted is that "Coming soon" appears anywhere in the frame, and knowledge-base already produces that text on the existing module-load gating path. Symmetrically, the existing beforeEach(... = '1') is also a no-op for tests 1 and 2.

A few options:

  1. Use vi.resetModules() + dynamic import('../AddScreen.js') inside each test after setting/unsetting ENABLE_GATED_FEATURES, so the module re-evaluates with the desired env. This is the pattern used in src/lib/utils/__tests__/platform.test.ts.
  2. Move the gating computation inside the AddScreen component (e.g., useMemo on render, like AddGatewayTargetScreen does) so the env is read per render and tests can flip the env between renders.
  3. To meaningfully assert the gating for web-search specifically, also assert that the knowledge-base row is not showing "Coming soon" when ENABLE_GATED_FEATURES=1, and that both rows show "Coming soon" when it's unset — so the test would fail if gating regressed.

Without one of these, the test gives a false sense of coverage.

if (!isGatedFeaturesEnabled()) {
console.error('Error: Web search target type is not yet available.');
process.exit(1);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When --json is passed and the feature is gated, this writes a plain-text error to stderr and exits 1, breaking the JSON output contract for the subcommand. A caller piping agentcore add web-search --json will see no JSON on stdout and a human-readable line on stderr — different from every other failure mode of this command (e.g. validation errors at L961 / L877-878 still emit {success: false, error: ...} JSON).

Same issue at L996-998 for remove web-search.

Options:

  1. Mirror the existing error pattern: if cliOptions.json, console.log(JSON.stringify({ success: false, error: 'Web search target type is not yet available.' })) before process.exit(1); otherwise console.error(...).
  2. Move the gate check inside runCliCommand by throw new ValidationError(...) (like the --type webSearch path at L599 does for gateway-target), which handles JSON formatting uniformly. You'd need to move the gate check below runCliCommand('add.web-search', ...) and similarly for remove.web-search.

Option 2 also has the side benefit of routing the gating rejection through the existing telemetry/error-classification path for these commands.

.option('--json', 'Output as JSON [non-interactive]')
.action(async (cliOptions: { name?: string; gateway?: string; excludeDomains?: string; json?: boolean }) => {
if (!isGatedFeaturesEnabled()) {
console.error('Error: Web search target type is not yet available.');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor consistency: this error is prefixed with Error: while the corresponding gate at L996 (remove) and the inner ValidationError at L599 (gateway-target) are not. Pick one style. (Non-blocking — feel free to defer if you address the JSON-output issue below.)

@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 37.03% 13554 / 36601
🔵 Statements 36.3% 14411 / 39696
🔵 Functions 31.69% 2327 / 7343
🔵 Branches 30.78% 8926 / 28992
Generated in workflow #3785 for commit 38be0db by the Vitest Coverage Report Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants