Skip to content

tests: key the static-only subprocess allowlist by function, not line number #1078

Open

Description

@pengfei-threemoonslab

Deferred by the engineering-review implementation loop (PRs #1070 and #1074).

Problem

tests/test_adapter_static_only.py allowlists the permitted subprocess.Popen / subprocess.run sites in src/agents_shipgate/cli/verify/git.py by exact line number (cli/verify/git.py:<line>:attr_call:subprocess.run). Any edit above those lines, including a merge of main, moves them and the test job fails with "allowlisted entry … pins line N, but no violation of that surface was found at that line". In the current implementation loop this happened on PR #1070 three times and on PR #1074 after merging main, each time costing a CI round and a commit that changes only two integers. The guard is right; its key is wrong.

Evidence

Proposed fix

Key allowlist entries by enclosing function (module path + qualified function name + surface), resolved from the AST, keeping the prose rationale per entry; keep a strict check that each allowlisted function contains exactly the expected number of that surface so a new spawn inside an allowlisted function is still caught. Migrate the existing entries; no change to what is allowed.

Acceptance criteria

  • Inserting lines above an allowlisted call no longer fails the test.
  • Adding a second subprocess.run inside an allowlisted function, or a new call in a non-allowlisted function, still fails the test.
  • The allowlist still carries a prose rationale per entry.

Source

Engineering review 2026-10-12 implementation loop. Tracked in #1060.

Activity

  1. added
    enhancementNew feature or request
    P2Queued; valuable but not blocking
    workstream:maintenanceShared readers, diagnostics, documentation, build and release maintenance.
    engineering-reviewFiled from the 2026-10-12 comprehensive engineering review
    on Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Queued; valuable but not blockingengineering-reviewFiled from the 2026-10-12 comprehensive engineering reviewenhancementNew feature or requestworkstream:maintenanceShared readers, diagnostics, documentation, build and release maintenance.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions