Skip to content

test: drop the second copy of the mcp server glob-deny check - #39259

Merged
iamwhatever merged 1 commit into
mainfrom
crew/testoptimizer/twin-enterprise-glob-deny
Nov 18, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
crew/testoptimizer/twin-enterprise-glob-deny

Conversation

@iamwhatever

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Remove one byte-identical duplicate test from test_enterprise_policy_translate_terms.py with no loss of any check or covered line.

TestInstallRows::test_an_mcp_server_glob_deny_still_refuses_the_policy, added with the install rows in #38471, is a copy of TestUnknownValues::test_an_mcp_server_glob_deny_refuses_the_policy, added in #30856. Both tests:

  • have the same body (ast.dump equal),
  • use the same literal input, rules:\n - {capability: mcp, effect: deny, match: ['corp-*/x']}\n,
  • make the same check, pytest.raises(t.Unrepresentable),
  • run under the same fixture: the module-level autouse enterprise fixture (EDITION = "lts").

Neither class has a fixture, setUp, mark or skip of its own. Neither test carries the file's _POSIX_PATHS skip, and neither is listed in windows-collect-ignore.txt or windows-expected-failures.txt. So the two run the same lines on the same platforms.

Why it matters

scripts/find_duplicate_test_bodies.py counts duplicate-body groups as a test-quality measure. This pair is the only group, among those new or grown since c844e1e5e9, whose copies read the same data. Every other new pair parametrizes over different lists, takes a different fixture, or is a security suite kept per rule. After this change the count goes from 128 to 127 groups on origin/main 42d0d666e0.

Not a goal

  • No change under src/ and no change to test/conftest.py.
  • No other duplicate group is touched. Same-file pairs that parametrize over different lists stay separate.
  • No change to what the kept test checks.

What changed (motivation → approach → change)

The copy in TestInstallRows is deleted, 3 lines. TestUnknownValues::test_an_mcp_server_glob_deny_refuses_the_policy stays as it is.

Backwards compatibility

Compatible: test-only.

Removes nothing: no checked behaviour is removed. The removed test's single check is made, with the same input and fixture, by the kept test.

Reader: test/test_enterprise_policy_translate_terms.py:TestUnknownValues.test_an_mcp_server_glob_deny_refuses_the_policy -- release -- the same check on the same input, still run

Tests

Proof: not provable -- test-only change

Why the deletion is safe:

  • The content is the same. The two bodies are ast.dump-equal, and the input, the check and the fixture are the same (see above).
  • The module is still tested. src/kiro_crew/platform/enterprise_policy_translate.py keeps the kept test, and the file's other 168 tests.
  • Test count: 170 → 169 for the file. Only the removed test is gone.
  • Coverage, for this file alone under --cov=kiro_crew -n0:
    • enterprise_policy_translate.py: 483 executed lines and 226 executed branches, before and after.
    • All src: 95,614 lines and 1,285 branches, before and after. No file differs.
  • A planted error is still caught. Removing the server-glob test (any(c in server for c in "*?[")) from _mcp_patterns in enterprise_policy_translate.py makes t.translate accept the glob deny. The kept TestUnknownValues::test_an_mcp_server_glob_deny_refuses_the_policy then fails with DID NOT RAISE: 1 failed, 168 passed. The plant was reverted from a copy.
  • Order: 169 passed at -n 4 --dist loadgroup, and 169 passed at -n0 in reverse collection order.
  • Duplicate groups on this branch: 127 groups / 385 tests, from 128 / 387 on main.
  • Gates: black and flake8 on the file; check_comment_history.

Manual verification

N/A — unit coverage sufficient: one duplicate test removed; the counts and coverage above are the verification.

Real-machine verification

N/A -- test-only change: removes a duplicate test; nothing new runs.

Related Issues

Duplicate-body follow-up to the 2026-11-18 count (128 groups on 0d68cae9e6).

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners November 18, 2026 20:51
@iamwhatever
iamwhatever enabled auto-merge (squash) November 18, 2026 20:52
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 18, 2026
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision d31755a7d59b3dc6fc899cd98c1c638826b24b67 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ⏭️ skipped

Revision d31755a7d59b3dc6fc899cd98c1c638826b24b67 ships no reviewable capability (docs, tests or generated files only), so there is nothing to inventory. Does not block merge.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of d31755a7d59b3dc6fc899cd98c1c638826b24b67 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the deleted test is the same as TestUnknownValues::test_an_mcp_server_glob_deny_refuses_the_policy, which this file still runs at line 348.

[DESIGN-REVIEWED] d31755a

Description read

[DESCRIPTION-READ] 1ddfd129da7d5624caacd3c3b0c1a8da22729839f6ab9a7f1c8be6ddb1200e7f

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed d31755a7d59b3dc6fc899cd98c1c638826b24b67 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] d31755a

Verdict parsed from the review's SHA-scoped output markers for commit d31755a7d59b3dc6fc899cd98c1c638826b24b67.

False positive or not applicable? A repository writer can comment:
/ai-review override fable d31755a7d59b3dc6fc899cd98c1c638826b24b67 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of d31755a7d59b3dc6fc899cd98c1c638826b24b67 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] d31755a

False positive or not applicable? A repository writer can comment:
/ai-review override gpt d31755a7d59b3dc6fc899cd98c1c638826b24b67 false-positive: <reason, 20 to 500 characters>

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Backend Tests (3.12, 8) red is main's, not this PR's: test/test_bare_session_handle_guard.py::test_no_test_builds_a_bare_session_handle_directly fails on origin/main 640338a (flags test_kas_token_refresh_recovery.py:245, added in #38978). Tracked in #39261, fix in #39262. This PR waits for that fix, then rebases.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 18, 2026
@iamwhatever
iamwhatever disabled auto-merge November 18, 2026 22:02
TestInstallRows carried a byte-identical copy of TestUnknownValues'
test_an_mcp_server_glob_deny_refuses_the_policy: the same input, the
same pytest.raises(Unrepresentable) and the same module fixture, with
no class fixture or mark of its own. The kept copy runs the same lines
on the same platforms.
@iamwhatever
iamwhatever force-pushed the crew/testoptimizer/twin-enterprise-glob-deny branch from 11a9150 to d31755a Compare November 18, 2026 22:03
@iamwhatever
iamwhatever enabled auto-merge (squash) November 18, 2026 22:03
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 18, 2026
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider estimates a 3% chance that this change introduces a defect, within the 12% limit for approving on its own, but it is held at tier 2: reviewer-finding: Design Review.

This PR deletes one test, TestInstallRows::test_an_mcp_server_glob_deny_still_refuses_the_policy. Its body matches TestUnknownValues::test_an_mcp_server_glob_deny_refuses_the_policy line for line (repo line 346–348): the same t.translate input ['corp-*/x'] and the same pytest.raises(t.Unrepresentable) check. Neither class has a fixture, mark or skip of its own, and neither test has the _POSIX_PATHS decorator. Both run only under the module's autouse enterprise fixture, so they cover the same code on the same platforms. Nothing else in the repo refers to the deleted test's name, including the Windows ignore and expected-failure lists, ratchets and registries, so removing it breaks nothing. The file after the change still has two blank lines before class TestBatchOneMeta, so black is satisfied. No source changes. CI is green on Linux and Windows. Removing duplicates is in line with AGENTS.md's guidance to consolidate duplicated logic.

Tier: 2, held for a person: reviewer-finding: Design Review.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit d31755a7d5 · 4 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This review checked head d31755a. The diff deletes 4 lines from one file, test/test_enterprise_policy_translate_terms.py. The deleted test is TestInstallRows::test_an_mcp_server_glob_deny_still_refuses_the_policy. The test that stays, TestUnknownValues::test_an_mcp_server_glob_deny_refuses_the_policy, has the same input and the same pytest.raises(t.Unrepresentable) check. Both run under the same module-level autouse enterprise fixture, so no check is lost. The server-glob check that the kept test pins in _mcp_patterns is still on main. Nothing outside this file names the removed test. No other open PR touches this file, and PR Readiness passed on this head.

Done well: the body proves the deletion is neutral instead of just saying so. It names the kept test as the Reader, plants an error in the production check, and compares coverage before and after.

Optional:

  • The body says "3 lines" were removed. The diff also removes a trailing blank line, so it shows 4.

@iamwhatever
iamwhatever merged commit b3ebff1 into main Nov 18, 2026
99 of 104 checks passed
@iamwhatever
iamwhatever deleted the crew/testoptimizer/twin-enterprise-glob-deny branch November 18, 2026 23:58
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 18, 2026
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.

2 participants