docs(protocols): document integrator-facing Protocol contracts (O4)#26
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Design-partner feedback O4 (guard-core half). The public
Protocolclasses 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,GuardMiddlewareProtocolEach method now documents the return-value semantics that were previously implicit:
None-on-miss for reads,Nonevs empty-set forCloudIpStoreProtocol.get,boolsuccess 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 (ContextManagervsAsyncContextManager).cloud_ip_store_protocol.pyis regenerated via unasync; the rest are the hand-maintained templates. check-sync green.Scope / safety
Docstrings only —
git difftouches no signature, name, export, or@runtime_checkabledecorator.Verification
Part of the coordinated guard-core release (with O1/O2, O5, O6). Sibling: guard-agent O4.