Skip to content

chore: simplify — address /simplify review findings#27

Merged
heznpc merged 1 commit into
mainfrom
chore/simplify-sweep-2026-05-21
May 20, 2026
Merged

chore: simplify — address /simplify review findings#27
heznpc merged 1 commit into
mainfrom
chore/simplify-sweep-2026-05-21

Conversation

@heznpc
Copy link
Copy Markdown
Member

@heznpc heznpc commented May 20, 2026

Summary

Three-agent /simplify review of the modernization sweep (#26 / 01ed305) surfaced concrete issues. This PR fixes the real ones, skips the false-positives.

Correctness

  • SECURITY.md — delete duplicate "Reporting" section. The sweep added a new one without removing the original.

Efficiency (Efficiency agent — HIGH/MED)

  • ci.yml + cd.yml — add cache: pip + cache-dependency-path: pyproject.toml to every setup-python step. Free ~30-60s per matrix job.
  • pyproject.toml — move --cov / --cov-fail-under out of pytest addopts. CI now passes the flags explicitly. Local pytest tests/test_one.py no longer pays instrumentation tax or fails on --cov-fail-under from a single-file run.
  • codeql.yml — gate Autobuild with if: matrix.language == 'python'. The actions matrix entry skips the no-op build step.

Quality (Quality agent — comment cleanup)

  • pyproject.toml — drop multi-line WHAT comments on dev deps + ruff rule list (names are self-describing: B = bugbear, S = bandit).
  • cd.yml — drop step-name-restating comments + pypa-guidance restatements.
  • ci.yml — drop comment explaining why pytest has no flags (now moot, has flags).
  • codeql.yml — drop "leave for simplicity" non-decision narration.
  • .github/CODEOWNERS — 3-line preamble → 1 line.
  • .github/PULL_REQUEST_TEMPLATE.md — drop hardcoded >= 70% (would silently drift); reference ci.yml as source.
  • Delete .python-version — forcing pyenv 3.13 on every clone hurts UX. CI matrix is the canonical version source.

Skipped (agent findings deemed false-positive or out-of-scope)

  • Cross-repo CODEOWNERS / template hoisting (agent itself said "do not fix here").
  • cd.yml version extraction via __version__ (no real drift risk).
  • Gitleaks fetch-depth: 0 → shallow (mixed trade-offs).
  • Merge licenses job into test (3.13) (loses parallelism + separation).
  • cd.yml ci: re-invocation removal (pre-existing scope, would need separate consideration).
  • CHANGELOG [Unreleased] compression (accurate, not a footgun).

Test plan

  • bare pytest runs without coverage (17 passed, 0.15s)
  • pytest --cov=my_mcp_server --cov-fail-under=70 passes (70.64%)
  • ruff check . / ruff format --check . / mypy src/ clean
  • CI green on all 3 Python matrix versions
  • CodeQL analyze (python) green; analyze (actions) skips Autobuild

…ion sweep

Fixes from three-agent review of 01ed305:

Correctness
- SECURITY.md: delete duplicate "Reporting" section (the sweep added a new
  one without removing the original).

Efficiency
- ci.yml + cd.yml: add `cache: pip` + `cache-dependency-path: pyproject.toml`
  to all setup-python steps. Saves ~30-60s per matrix job on cache hit.
- pyproject.toml: move --cov / --cov-fail-under out of pytest addopts; CI now
  passes the flags explicitly. Local `pytest tests/test_one.py` no longer
  pays the instrumentation tax or fails on --cov-fail-under from a
  single-file run.
- codeql.yml: gate Autobuild step with `if: matrix.language == 'python'`.
  The `actions` matrix entry skips the no-op build step.

Quality (comment trim — every starter clone reads these)
- pyproject.toml: drop multi-line WHAT comments on dev deps + ruff rule list.
- cd.yml: drop comments narrating step names and pypa guidance restatements.
- ci.yml: drop comment explaining why pytest has no flags (now moot).
- codeql.yml: drop "leave for simplicity" non-decision narration.
- .github/CODEOWNERS: collapse 3-line preamble to 1 line.

Other
- .github/PULL_REQUEST_TEMPLATE.md: drop hardcoded `>= 70%` (would drift
  silently if threshold bumped); reference ci.yml as source of truth.
- Delete .python-version. Forcing pyenv 3.13 on every clone hurts UX for
  developers who only have 3.12 installed; CI matrix is the canonical
  Python-version source.

Skipped from agent findings (false positives or out-of-scope):
- Cross-repo CODEOWNERS/templates hoisting (agent itself flagged
  "do not fix here").
- cd.yml version extraction via __version__ (no real drift; current
  tomllib approach is fine).
- gitleaks fetch-depth shallow optimization (mixed trade-offs).
- Merge `licenses` job into `test (3.13)` (loses parallelism).
- cd.yml `ci:` re-invocation removal (pre-existing scope).
- CHANGELOG entry compression (accurate, not a footgun).

Local verification:
- bare `pytest` → 17 passed, 0.15s (no cov)
- `pytest --cov=...` → 17 passed, 70.64% coverage
- ruff/mypy/ruff format → clean
@heznpc heznpc enabled auto-merge (squash) May 20, 2026 23:37
@heznpc heznpc merged commit ec7045d into main May 20, 2026
7 checks passed
@heznpc heznpc deleted the chore/simplify-sweep-2026-05-21 branch May 20, 2026 23:38
heznpc added a commit that referenced this pull request May 21, 2026
Adversarial second-pass on commits 01ed305 (PR #26) and ec7045d (PR #27),
both reported as "done / tests pass / CI green". Two Critical findings.

[C1] CodeQL `analyze (actions)` open alert
- Rule: `actions/missing-workflow-permissions`
- File: .github/workflows/cd.yml
- Message: "Actions job or workflow does not limit the permissions of the
  GITHUB_TOKEN."
- Detected by the CodeQL `actions` language matrix that PR #26 itself added.
  PR #26 introduced top-level permissions on most workflows but missed
  cd.yml and setup.yml. The 5 required CI checks didn't include CodeQL,
  so the alert landed silently after merge.
- Fix: add `permissions: contents: read` at workflow top level in cd.yml
  and setup.yml. Jobs continue to opt into the writes they need
  (contents:write / id-token:write / attestations:write for publish;
  issues:write for setup).

[C2] `ok()` and `err()` Response Helpers — dead code marketed as feature
- server.py:41 and server.py:47 defined ok() / err() helpers.
- Zero references anywhere in src/ or tests/ (`grep -rn "\\bok(\\|\\berr("` =
  only the definitions + the introductory comment).
- Coverage report confirmed: server.py:43-44, 49 uncovered.
- README.md:32 and README.ko.md:30 marketed these as "Response Helpers —
  ok() and err() for consistent tool responses" in the "What You Get"
  list — i.e. a public feature claim with no backing code usage.
- The bundled `greet` tool returns plain `str` — the README's marketed
  pattern doesn't match the bundled example.
- FastMCP's idiom is `return value` / `raise on error`; ok/err helpers
  are a raw-MCP-without-FastMCP relic that actively teach the wrong
  pattern.
- Fix: delete ok() / err() / their introductory comment. Replace the
  Tools-section banner comment with one line documenting the actual
  FastMCP idiom. Remove the "Response Helpers" bullet from README.md
  and README.ko.md.

Why this matters beyond cosmetics: a starter is a teaching artifact.
False "What You Get" entries silently propagate the wrong pattern to
every clone. The dead helpers were also reachable code surface that
CodeQL has to scan but no test exercises.

Verification
- All 7 workflows now have top-level `permissions:` (verified via
  `awk` scan of column-1 `permissions:` line).
- ruff / ruff format / mypy strict / pytest 17/17 all clean.
- Coverage 72.12% (improved from 70.64% — uncovered dead code removed).

Out-of-scope for this PR (will be raised as Major findings for user
decision):
- tests/test_tools.py has no `test_greet_registered_on_server` despite
  test_server_info.py and test_code_review.py both having that pattern.
- server_info.py wheel-install fallback path (lines 41-42, 52-56) is 0%
  covered; test only exercises the dev/source-tree read-pyproject path.
- src/my_mcp_server/tools/greet.py defines a `register()` that's never
  called by server.py — fully dead modular example.
- SECURITY.md "branch protection on main" claim is starter-side only;
  clones inherit nothing.
- 4 Dependabot PRs (#28, #29, #30, #31) opened today — #28 is
  attest-build-provenance v3.2.0 → v4.1.0, making our 6-hour-old SHA
  pin already one major behind.
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