Skip to content

docs(protocols): document integrator-facing Protocol contracts (O4)#26

Merged
rennf93 merged 1 commit into
masterfrom
feat/protocol-docstrings
Jun 23, 2026
Merged

docs(protocols): document integrator-facing Protocol contracts (O4)#26
rennf93 merged 1 commit into
masterfrom
feat/protocol-docstrings

Conversation

@rennf93

@rennf93 rennf93 commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Summary

Design-partner feedback O4 (guard-core half). The public Protocol classes are the exact extension points where integrators plug in custom stores/handlers — and they carried zero docstrings. This adds WHAT/WHEN/HOW class docstrings plus a per-method/property contract docstring to all of them.

Covered (async, guard_core/protocols/):

  • RedisHandlerProtocol, AgentHandlerProtocol, CloudIpStoreProtocol, GeoIPHandler, GuardRequest, GuardResponse + GuardResponseFactory, GuardMiddlewareProtocol

Each method now documents the return-value semantics that were previously implicit:

  • None-on-miss for reads, None vs empty-set for CloudIpStoreProtocol.get, bool success flags, TTL in seconds, and when the engine invokes each member.

Sync mirror

The guard_core/sync/protocols/ mirror carries the same contracts with a blocking-I/O note (ContextManager vs AsyncContextManager). cloud_ip_store_protocol.py is regenerated via unasync; the rest are the hand-maintained templates. check-sync green.

Scope / safety

Docstrings only — git diff touches no signature, name, export, or @runtime_checkable decorator.

Verification

  • check-sync: OK · ruff + ruff-format + mypy + vulture + xenon + deptry: clean · bandit: exit 0 (zero findings in changed files)
  • Full suite: 3696 passed, 100% line + branch coverage (0 missed), zero warnings

Part of the coordinated guard-core release (with O1/O2, O5, O6). Sibling: guard-agent O4.

Add WHAT/WHEN/HOW class docstrings plus per-method/property contract
docstrings to every public Protocol the engine exposes as an extension
point: redis, agent, cloud-IP store, geo-IP, request, response, and
middleware. Documents return-value semantics that were previously
implicit (None-on-miss, None vs empty set, bool success, TTL in seconds)
and when the engine invokes each member.

Sync mirror under guard_core/sync/protocols/ carries the same contracts
with a blocking-I/O note (ContextManager vs AsyncContextManager);
cloud_ip_store regenerated via unasync, check-sync green. Docstrings
only — no signature, name, export, or @runtime_checkable change.
@github-actions github-actions Bot added area: protocols Touches guard_core/protocols/ area: sync Touches guard_core/sync/ (sync mirror generated by unasync) labels Jun 23, 2026
@rennf93
rennf93 merged commit 8af1da9 into master Jun 23, 2026
10 of 11 checks passed
@rennf93
rennf93 deleted the feat/protocol-docstrings branch June 23, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: protocols Touches guard_core/protocols/ area: sync Touches guard_core/sync/ (sync mirror generated by unasync)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant