Commit b151e2b
authored
feat: RFC-005 Step 9 — PIP request builder types (#46)
* feat: add RFC-005 PIP request builder types
Add capiscio_sdk/pip.py with PIP request/response dataclasses for SDK
consumers building custom PEP integrations:
- PIPRequest, PIPResponse, Obligation (request/response types)
- SubjectAttributes, ActionAttributes, ResourceAttributes,
ContextAttributes, EnvironmentAttributes (attribute groups)
- EnforcementMode enum with stricter_than() and from_env()
- Constants: PIP_VERSION, DECISION_ALLOW, DECISION_DENY, DECISION_OBSERVE
- Auto-populates txn_id (UUID v7/v4) and environment.time (ISO 8601)
- Envelope fields serialize as JSON null (not absent) in badge-only mode
RFC-005 Step 9 implementation.
44 unit tests, full serialization roundtrip coverage.
* fix: normalize EnforcementMode enum to string in ContextAttributes
Accept Union[str, EnforcementMode] for enforcement_mode and normalize
to string value in __post_init__. This prevents json.dumps() failures
when callers pass EnforcementMode.from_env() directly.
Addresses PR review feedback.1 parent b083a37 commit b151e2b
3 files changed
Lines changed: 852 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
69 | 86 | | |
70 | 87 | | |
71 | 88 | | |
| |||
119 | 136 | | |
120 | 137 | | |
121 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
122 | 153 | | |
123 | 154 | | |
0 commit comments