Skip to content

ACE-095: delete the dead GovernancePolicy port and its seam - #178

Merged
sandeep-agami merged 3 commits into
mainfrom
ACE-095-delete-governance-policy-port
Aug 2, 2026
Merged

ACE-095: delete the dead GovernancePolicy port and its seam#178
sandeep-agami merged 3 commits into
mainfrom
ACE-095-delete-governance-policy-port

Conversation

@sandeep-agami

Copy link
Copy Markdown
Collaborator

Spec: ACE-095

Summary

GovernancePolicy, GovernanceVerdict and WarnOnlyGovernancePolicy were wired into the HTTP
adapter set, but .evaluate() was never called in the product. Its only caller was a single test.
The seam was built for the graded, tiered verdict the governance principles removed, and its
successor spec is abandoned, so nothing was holding it open. Left in place, it invites the next
reader to implement against a port that enforces nothing.

This deletes the port, its value type, its OSS default adapter, the Adapters.governance field,
and every construction site and test that referenced them.

The removed code was inert. Verified against the base commit: Adapters.governance had exactly two
readers repo-wide, both in tests, and .evaluate() had exactly one caller, the test deleted here.
No product call site read the field or invoked the port, so nothing that was enforced before is
unenforced now. The single execute_sql enforcement chokepoint is untouched apart from one
docstring word.

Changes

Deleted

  • ports.py: the GovernancePolicy Protocol and the GovernanceVerdict dataclass.
  • oss_adapters.py: the WarnOnlyGovernancePolicy default adapter.
  • ports.py: the governance field on Adapters, plus all four construction sites that passed it
    (mcp_http.default_adapters(), two in test_tool_extension_seam.py, one in
    test_ah012_executor_seam.py). Three passed the type; the fourth passed base.governance, so a
    grep for the symbol names alone misses it.
  • field from the dataclasses import in ports.py, whose only use was GovernanceVerdict.warnings.

Test contract change

  • tests/test_ports.py::test_warn_only_governance_never_blocks is deleted, not adapted. It was
    the sole caller of .evaluate(); with the port gone it has no contract left to assert. Recorded
    in the spec's ## Decisions per the rule that a deleted test is a contract change.
  • The two seam suites are kept and only drop the governance= kwarg. They cover the tool-extension
    and executor seams, not governance, and still assert their original behavior (adapter defaults,
    sentinel identity, the 403 path, injected-executor vs BUILTIN_EXECUTOR).

Docs

  • Corrected the port-arity docstrings the deletion made wrong, including the one in the vendored
    execute_sql.py (mirror regenerated; the two copies are byte-identical).
  • oss_adapters.py now explains why the fourth port's default lives elsewhere: Executor's
    BUILTIN_EXECUTOR sits in execute_sql.py because that module ships in the stdlib-lean plugin
    mirror, which cannot import oss_adapters.
  • CHANGELOG.md gains a Removed entry. It flags that Adapters is not keyword-only, so a
    consumer that constructed it positionally must re-check the call: the 4th positional slot was
    governance and is now executor, which still constructs but fails later at query time.

Checklist

  • ports.py::GovernancePolicy, ports.py::GovernanceVerdict and
    oss_adapters.py::WarnOnlyGovernancePolicy are gone; grep-clean in packages/agami-core/src.
  • ports.py::Adapters loses its governance field, and all four construction sites stop
    passing it.
  • The sole test exercising .evaluate() is deleted, not adapted.
  • uv run dev.py check green (2412 passed, 4 skipped; ruff clean, gitleaks clean).
  • No dangling import, and no dangling reference in docs/, README.md, any SKILL.md,
    pyproject.toml or deploy config.
  • Vendored mirror in sync (plugins/agami/lib/execute_sql.py byte-identical to source).
  • execute_sql enforcement chokepoint untouched; no gate weakened.

🤖 Generated with Claude Code

GovernancePolicy was declared as a port and wired into Adapters, but no
core call site ever evaluated it: the sole caller of .evaluate() repo-wide
was the test that asserted the warn-only adapter returns allowed=True. A
port with one implementation and zero consumers is not a seam, it is a
placeholder that every construction site has to keep feeding.

Removes the GovernancePolicy Protocol, the GovernanceVerdict value type,
the WarnOnlyGovernancePolicy default adapter, and the Adapters.governance
field, plus all four construction sites. The warn-only test is deleted
rather than adapted -- there is nothing left to exercise. Nothing on the
execute_sql enforcement path is touched; enforcement was never routed
through this port.

execute_sql.py is vendored, so plugins/agami/lib/execute_sql.py is
regenerated to match (its only change is a docstring word).
ports.Adapters is public API of the published agami-core package, so a
dropped constructor keyword belongs in a Removed section even though no
downstream in this repo constructs it. Keep-a-Changelog + SemVer.
Adapters is frozen but not kw_only, so removing the 4th field is not
only a dropped keyword: the 4th positional slot was governance and is
now executor. A consumer building it positionally still constructs
successfully and only fails at query time, when the guarded path calls
.execute() on what it thinks is an executor. That is worth a sentence in
the changelog, since a silent rebind is harder to diagnose than a
TypeError. Constructing by keyword is the fix, so kw_only=True is not
added here.

The two docstring counts were wrong in the same direction: four ports
remain, not three. oss_adapters covers three of them because Executor's
default lives in execute_sql (that module ships in the plugin mirror and
cannot import oss_adapters), and test_ports covers the same three
because Executor is tested in test_ah012_executor_seam.py.
Copilot AI review requested due to automatic review settings August 2, 2026 05:05

Copilot AI 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.

Pull request overview

This PR removes the unused GovernancePolicy port seam (and its verdict/value types + default OSS adapter) from agami-core, eliminating an inert interface that had no product call sites and was only exercised by a single test. This simplifies the adapter surface area while keeping the execute_sql enforcement chokepoint unchanged (aside from docstring wording).

Changes:

  • Deleted GovernancePolicy / GovernanceVerdict and removed Adapters.governance, updating all construction sites accordingly.
  • Removed the OSS default WarnOnlyGovernancePolicy adapter and deleted the sole test that exercised .evaluate().
  • Updated docstrings and changelog notes to reflect the new “4 ports” shape and the executor default-location rationale (including the plugin mirror).

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/test_tool_extension_seam.py Drops governance-related imports/assertions and stops passing governance= when constructing Adapters.
tests/test_ports.py Removes governance protocol/value-type coverage and deletes the warn-only governance behavior test.
tests/test_ah012_executor_seam.py Removes the unused governance passthrough when building Adapters for executor seam coverage.
packages/agami-core/src/ports.py Deletes GovernancePolicy/GovernanceVerdict and removes Adapters.governance, updating docs to “four ports”.
packages/agami-core/src/oss_adapters.py Removes WarnOnlyGovernancePolicy and updates module docstring to clarify executor default location.
packages/agami-core/src/mcp_http.py Updates default adapter wiring to no longer import/construct governance; keeps executor default wiring intact.
packages/agami-core/src/execute_sql.py Docstring wording update to reflect “other three ports” after governance removal.
plugins/agami/lib/execute_sql.py Mirrors the same executor docstring wording update in the vendored plugin copy.
CHANGELOG.md Adds an Unreleased “Removed” entry documenting the API change and warning about positional Adapters(...) construction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI 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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment on lines 145 to 149
"""The port adapters, bundled so ``mcp_http.create_app`` takes them as one argument.

A consumer builds this with its own implementations of the ports (its own ``OrgResolver``,
``AuthProvider``, ``ActivitySink``, ``GovernancePolicy``, and optionally an ``Executor``);
``AuthProvider``, ``ActivitySink``, and optionally an ``Executor``);
passing ``adapters=None`` to ``create_app`` uses the OSS defaults (``mcp_http.default_adapters``).
@sandeep-agami
sandeep-agami merged commit f7ce66f into main Aug 2, 2026
8 checks passed
@sandeep-agami
sandeep-agami deleted the ACE-095-delete-governance-policy-port branch August 2, 2026 15:02
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants