Skip to content

feat(gateway): introduce gateway enforcement layer and bump to v1.1.3 - #35

Merged
Skull-boy merged 3 commits into
mainfrom
feat/runtime-enforcer
Sep 5, 2026
Merged

Skull-boy merged 3 commits into
mainfrom
feat/runtime-enforcer

Conversation

@Skull-boy

Copy link
Copy Markdown
Owner

Summary of Changes

This PR introduces the Gateway Enforcement Layer for Scyvera and bumps the package release to v1.1.3.

Previously, runtime gating relied on decorating individual call sites with @enforcer.gate(...). While effective, it could not physically prevent agent code from bypassing decorators and directly calling third-party SDK clients (Threat T4).

The new Gateway Architecture (BaseGateway, GitHubGateway, QdrantGateway) establishes a single enforcement boundary:

  • API credentials and raw SDK clients (PyGithub, qdrant-client) are held privately inside the gateway instances and never exposed.
  • Every public method is gated per-instance with @enforcer.gate(...) using default-deny semantics.
  • External client exceptions are caught and wrapped into GatewayError for deterministic fault isolation.
  • Optional package extras (scyvera[github], scyvera[qdrant], scyvera[all]) keep the core Scyvera package lightweight and zero-dependency beyond schema validators.

Key Highlights

  • Gateway Architecture (src/scyvera/gateway.py):
    • BaseGateway: Abstract base class with dependency-injected ContractEnforcer.
    • GitHubGateway: Gated GitHub API interactions (post_comment, close_issue, merge_pr, create_label, read_issue, list_issues, read_pr_files).
    • QdrantGateway: Gated Qdrant operations (search, upsert, delete).
  • Exceptions (src/scyvera/exceptions.py): Added GatewayError to wrap third-party API exceptions.
  • Reference Implementation (implementations/langgraph/duplicate-issue-detector): Updated nodes to route all external GitHub operations strictly through GitHubGateway.
  • Packaging & CI:
    • Defined [project.optional-dependencies] in pyproject.toml (github, qdrant, all, dev).
    • Added .github/workflows/lint-gateway.yml to prevent raw API imports outside gateway.py.
    • Updated publish-pypi.yml and validate-contracts.yml test environments.
    • Added comprehensive unit test suite in tests/test_gateway.py (73 total tests passing).
    • Updated README.md and CHANGELOG.md with gateway documentation.

Verification

  • python -m pytest tests/ -v passes (73/73 tests).
  • scyvera validate implementations/langgraph/duplicate-issue-detector/contract.yaml passes.
  • scyvera lint implementations/langgraph/duplicate-issue-detector/contract.yaml passes (0 warnings).
  • python -m build & twine check dist/* passed with clean distributions.

- Implemented BaseGateway, GitHubGateway, and QdrantGateway
- Enforced single boundary enforcement for API credentials
- Added GatewayError exception wrapper
- ContractEnforcer.gate() supports read action type
- Bump version to 1.1.3 across package and CHANGELOG
@Skull-boy Skull-boy self-assigned this Sep 5, 2026
@Skull-boy Skull-boy added documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed Agent labels Sep 5, 2026
@Skull-boy
Skull-boy merged commit cf899e3 into main Sep 5, 2026
6 checks passed

This branch was successfully deployed

1 active deployment
pypi — d1f21a81 Deployed Sep 5, 2026 by Skull-boy via Build, Test, and Publish #7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Agent documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant