Skip to content

refactor: delete four uncalled helpers in core modules - #25869

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
refactor/drop-uncalled-helpers
Oct 29, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
refactor/drop-uncalled-helpers

Conversation

@RohanK6

@RohanK6 RohanK6 commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Four functions that nothing calls are gone from core modules, so readers stop mistaking them for live paths.

member_memory_identity (memory_stores.py), registry_slugs (connections/tool_aliases.py), stage_redacted_copy (snapshot_redact.py) and _open_no_internal_redirect (skill_providers/skillsh.py) have no caller in src, test, scripts, website or docs. git grep -w finds only each def. None is in an __all__, an entry point, or a getattr/string lookup.

Why it matters

Two of them sit next to security code. A reader who sees _open_no_internal_redirect or stage_redacted_copy can take it for the guard that really runs, and change the wrong one. Dead helpers also cost review time on every PR that touches these files.

Not a goal

What changed (motivation → approach → change)

Each function was checked for callers by exact name, by partial name, and through getattr, __all__ and entry points. All four had none, so all four go. The shutil import only stage_redacted_copy used goes with it. For the two security-adjacent ones, the live path was confirmed not to route through them: skills.sh's _sync_fetch_json hands _ALLOWED_HOSTS and _is_internal_url straight to _http.sync_fetch_json, which calls open_guarded itself. snapshot.py calls redact_bundle_for_egress directly.

Backwards compatibility

Compatible: no caller exists, so nothing that runs today changes.

None of the removed names has a reader on origin/main: git grep -n -w <name> across src, test, scripts, website and docs prints only each def. The lines below name the live path that does each job instead, and the test that holds it:

Reader: src/kiro_crew/execution_context.py:validate_execution -- chat -- reads a member's database identity through read_member_database_identity, never member_memory_identity; test_execution_context.py::test_database_identity_path_and_cross_member_routing
Reader: src/kiro_crew/connections/tool_aliases.py:declared_tool_aliases -- chat -- walks get_all_registry_providers() itself, never registry_slugs; test_connections_tool_aliases.py::test_flag_on_writes_the_resolved_map
Reader: src/kiro_crew/snapshot.py:_redacted_upload_copy -- app -- the aws_control backup egress calls redact_bundle_for_egress directly, never stage_redacted_copy; test_snapshot_redaction.py::TestTheOutboundCopyIsRedacted::test_the_redacted_copy_lives_in_the_caller_workdir

Tests

No test added: deleting uncalled code has no behavior to pin. Evidence instead:

  • The 21 test files that import these four modules: 1139 passed.
  • Local gate: backend 11042 passed, 1 failed. That one, test_auto_improvement_members.py::test_assignments_build_real_context_from_only_their_private_store, fails the same way on clean origin/main on this host. Frontend related set: 12501 passed.
  • mypy, flake8, isort, black, line cap, comment history, brand, harness parity and the flake-pattern ratchet all pass.

Manual verification

N/A — unit coverage sufficient: the change only deletes code no path calls, and the module test suites pass.

Related Issues

Closes #25865

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.

member_memory_identity (memory_stores), registry_slugs
(connections/tool_aliases), stage_redacted_copy (snapshot_redact) and
_open_no_internal_redirect (skill_providers/skillsh) have no caller in
src, test, scripts, website or docs, and none is reached through
__all__, an entry point or a getattr/string lookup.

Neither security-adjacent one is the live guard. skills.sh fetches go
through _sync_fetch_json, which hands _ALLOWED_HOSTS and
_is_internal_url to _http.sync_fetch_json, which calls open_guarded
itself. Snapshot egress redaction runs through snapshot.py calling
redact_bundle_for_egress directly. The shutil import only
stage_redacted_copy used goes with it.

Closes #25865
@RohanK6
RohanK6 requested review from a team and KiroCrewCaptain as code owners October 29, 2026 18:32
@RohanK6
RohanK6 requested a review from dodgeblaster October 29, 2026 18:32
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/snapshot_redact.py

  • @RohanK6 posted a complete reasoning template for f120fd7.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

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

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks. This PR deletes four functions that nothing calls. Searching the tree for each removed name finds no remaining reader, and no other code in snapshot_redact.py used the shutil import it drops.

[DESIGN-REVIEWED] f120fd7

Description read

[DESCRIPTION-READ] 70aad6779383bcefe0c85e80bbbb6dd44344d71d0ce822dcfb6b86ccd5bda426

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of f120fd73346908a20eb4220be199584b142b46ea — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing to check.

What this change ships

Inventory (5 items) — 5 justified

Intent: make code easier to read by removing four functions that nobody calls, so readers stop taking them for the live paths. This is a FIX (the cleanup is tracked in #25865).

  1. member_memory_identity deleted from memory_stores.py — justified
  2. registry_slugs deleted from connections/tool_aliases.py — justified
  3. stage_redacted_copy deleted from snapshot_redact.py — justified
  4. _open_no_internal_redirect deleted from skill_providers/skillsh.py — justified
  5. The shutil import that only stage_redacted_copy used is removed — justified

[FIRST-PRINCIPLES-REVIEWED] f120fd7

Description read

[DESCRIPTION-READ] 4ece8a286dd50543d909f8830ed00f3e832acd8cdf8855edd56176340ea74ae8

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] f120fd7

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

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

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] f120fd7

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

@RohanK6

RohanK6 commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: f120fd7
  • What rule changed: none. The diff deletes stage_redacted_copy from snapshot_redact.py (a 3-line wrapper: copytree then redact_bundle_for_egress) and its now-unused import shutil. No redaction rule, pattern, table or egress path changes.
  • Before -> after (what was allowed/blocked, now): unchanged. The wrapper had no caller, so nothing went through it before and nothing does now. Snapshot egress redaction still runs snapshot._redacted_upload_copy -> redact_bundle_for_egress, untouched.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a hidden caller would fail with AttributeError (loud, not a silent leak). None exists: git grep -n -w stage_redacted_copy on origin/main across src, test, scripts, website and docs prints only the def; no __all__, entry point or getattr/string lookup names it.
  • Evidence checked (which sandbox result proves it): N/A for a sandbox result, since no sandbox or mask rule is touched. The redaction proof is test_snapshot_redaction.py::TestTheOutboundCopyIsRedacted (outbound copy redacted, local bundle left unredacted, copy in the caller workdir): passes on this head.
  • No regression:
    • Tools still work (which tools/commands were run, result): pytest on the 21 test files importing memory_stores, tool_aliases, snapshot_redact and skillsh: 1139 passed. mypy (3748 files) and flake8 clean.
    • Backward compatible (old config / old data / old callers still work, how checked): no config, data or caller reads this function; checked by the grep above on origin/main ae1bb2d.
    • Existing tests (which suites passed on this head): the 1139 above; local gate backend related set 11042 passed (1 failure that also fails on clean main on this host), frontend related set 12501 passed; CI design, first-principles, Opus and GPT lanes pass on this head.
  • How to undo: revert this one commit; the function and import come back byte-identical.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 29, 2026

@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.

Approved on behalf of the watch holder (bolichen). Design and First Principles pass on this head (or skipped / author override), UX skipped or pass, no conflict, no open change request.

@KiroCrewCaptain
KiroCrewCaptain merged commit 9300156 into main Oct 29, 2026
92 of 93 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the refactor/drop-uncalled-helpers branch October 29, 2026 19:50
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 29, 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.

Four uncalled helpers in core modules

2 participants