sayfirst-contract 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. sayfirst_contract-0.3.0/.gitignore +10 -0
  2. sayfirst_contract-0.3.0/LICENSE +202 -0
  3. sayfirst_contract-0.3.0/NOTICE +12 -0
  4. sayfirst_contract-0.3.0/PKG-INFO +146 -0
  5. sayfirst_contract-0.3.0/README.md +127 -0
  6. sayfirst_contract-0.3.0/hatch_build.py +50 -0
  7. sayfirst_contract-0.3.0/pyproject.toml +49 -0
  8. sayfirst_contract-0.3.0/scripts/build_contract.py +317 -0
  9. sayfirst_contract-0.3.0/src/sayfirst_contract/__init__.py +2 -0
  10. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/binding/http-unix-socket/openapi.json +4088 -0
  11. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/digests.json +34 -0
  12. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/attributes.json +126 -0
  13. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/evidence-export-manifest-vectors.json +1503 -0
  14. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/evidence-preimage-v1.json +62 -0
  15. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/generation.json +5 -0
  16. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/golden-scenarios.json +359 -0
  17. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/policy-evaluation-v1.json +979 -0
  18. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/problem-codes.json +244 -0
  19. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/recipes/policy-evaluation-v1.md +91 -0
  20. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/schemas/approval-resolve-request.schema.json +43 -0
  21. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/schemas/approval-result.schema.json +91 -0
  22. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/schemas/decision-ask-request.schema.json +42 -0
  23. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/schemas/decision-record.schema.json +154 -0
  24. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/schemas/decision-result.schema.json +162 -0
  25. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/schemas/delegation.schema.json +70 -0
  26. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/schemas/evidence-entry-writer.schema.json +697 -0
  27. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/schemas/evidence-entry.schema.json +746 -0
  28. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/schemas/evidence-export-result.schema.json +134 -0
  29. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/schemas/evidence-page-result.schema.json +58 -0
  30. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/schemas/evidence-verdict.schema.json +142 -0
  31. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/schemas/grant-signal.schema.json +50 -0
  32. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/schemas/grant.schema.json +90 -0
  33. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/schemas/peer.schema.json +37 -0
  34. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/schemas/policy-status.schema.json +80 -0
  35. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/schemas/principal.schema.json +88 -0
  36. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/schemas/problem-document.schema.json +41 -0
  37. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/schemas/status-result.schema.json +314 -0
  38. sayfirst_contract-0.3.0/src/sayfirst_contract/_contracts/domain/schemas/whoami-result.schema.json +84 -0
  39. sayfirst_contract-0.3.0/src/sayfirst_contract/approvals.py +153 -0
  40. sayfirst_contract-0.3.0/src/sayfirst_contract/artifacts.py +68 -0
  41. sayfirst_contract-0.3.0/src/sayfirst_contract/binding/__init__.py +2 -0
  42. sayfirst_contract-0.3.0/src/sayfirst_contract/binding/http_unix_socket/__init__.py +25 -0
  43. sayfirst_contract-0.3.0/src/sayfirst_contract/binding/http_unix_socket/addresses.py +173 -0
  44. sayfirst_contract-0.3.0/src/sayfirst_contract/binding/http_unix_socket/client.py +618 -0
  45. sayfirst_contract-0.3.0/src/sayfirst_contract/binding/http_unix_socket/replay.py +116 -0
  46. sayfirst_contract-0.3.0/src/sayfirst_contract/binding/http_unix_socket/routes.py +232 -0
  47. sayfirst_contract-0.3.0/src/sayfirst_contract/cli.py +146 -0
  48. sayfirst_contract-0.3.0/src/sayfirst_contract/client.py +73 -0
  49. sayfirst_contract-0.3.0/src/sayfirst_contract/decisions.py +150 -0
  50. sayfirst_contract-0.3.0/src/sayfirst_contract/evidence.py +569 -0
  51. sayfirst_contract-0.3.0/src/sayfirst_contract/evidence_recipes.py +575 -0
  52. sayfirst_contract-0.3.0/src/sayfirst_contract/generation.py +198 -0
  53. sayfirst_contract-0.3.0/src/sayfirst_contract/golden.py +550 -0
  54. sayfirst_contract-0.3.0/src/sayfirst_contract/grants.py +192 -0
  55. sayfirst_contract-0.3.0/src/sayfirst_contract/plugins.py +377 -0
  56. sayfirst_contract-0.3.0/src/sayfirst_contract/policy.py +86 -0
  57. sayfirst_contract-0.3.0/src/sayfirst_contract/problems.py +191 -0
  58. sayfirst_contract-0.3.0/src/sayfirst_contract/replay.py +386 -0
  59. sayfirst_contract-0.3.0/src/sayfirst_contract/retrospective_policy.py +286 -0
  60. sayfirst_contract-0.3.0/src/sayfirst_contract/status.py +152 -0
  61. sayfirst_contract-0.3.0/src/sayfirst_contract/transport/__init__.py +7 -0
  62. sayfirst_contract-0.3.0/src/sayfirst_contract/transport/cli.py +229 -0
  63. sayfirst_contract-0.3.0/src/sayfirst_contract/transport/peer.py +209 -0
  64. sayfirst_contract-0.3.0/src/sayfirst_contract/transport/socket_client.py +761 -0
  65. sayfirst_contract-0.3.0/src/sayfirst_contract/values.py +24 -0
  66. sayfirst_contract-0.3.0/src/sayfirst_contract/whoami.py +361 -0
  67. sayfirst_contract-0.3.0/tests/canned_daemon.py +88 -0
  68. sayfirst_contract-0.3.0/tests/identity/test_binding_peer_identity.py +78 -0
  69. sayfirst_contract-0.3.0/tests/identity/test_connect_bounds.py +61 -0
  70. sayfirst_contract-0.3.0/tests/identity/test_default_address.py +101 -0
  71. sayfirst_contract-0.3.0/tests/identity/test_forward_compatibility.py +137 -0
  72. sayfirst_contract-0.3.0/tests/identity/test_generation_negotiation.py +210 -0
  73. sayfirst_contract-0.3.0/tests/identity/test_identity_vocabulary.py +198 -0
  74. sayfirst_contract-0.3.0/tests/identity/test_no_tcp_fallback.py +160 -0
  75. sayfirst_contract-0.3.0/tests/identity/test_peer_credentials.py +259 -0
  76. sayfirst_contract-0.3.0/tests/identity/test_reconnect_verification.py +123 -0
  77. sayfirst_contract-0.3.0/tests/identity/test_socket_client.py +550 -0
  78. sayfirst_contract-0.3.0/tests/test_binding.py +332 -0
  79. sayfirst_contract-0.3.0/tests/test_binding_grant_stream.py +398 -0
  80. sayfirst_contract-0.3.0/tests/test_binding_reads.py +460 -0
  81. sayfirst_contract-0.3.0/tests/test_composition_evidence.py +150 -0
  82. sayfirst_contract-0.3.0/tests/test_contract_artifacts.py +500 -0
  83. sayfirst_contract-0.3.0/tests/test_domain.py +170 -0
  84. sayfirst_contract-0.3.0/tests/test_durable_decision_contract.py +135 -0
  85. sayfirst_contract-0.3.0/tests/test_evidence_contract.py +125 -0
  86. sayfirst_contract-0.3.0/tests/test_evidence_verifier.py +757 -0
  87. sayfirst_contract-0.3.0/tests/test_golden.py +277 -0
  88. sayfirst_contract-0.3.0/tests/test_grants.py +95 -0
  89. sayfirst_contract-0.3.0/tests/test_plugin_versions.py +116 -0
  90. sayfirst_contract-0.3.0/tests/test_problem_classes.py +84 -0
  91. sayfirst_contract-0.3.0/tests/test_replay.py +593 -0
  92. sayfirst_contract-0.3.0/tests/test_retrospective_policy.py +111 -0
  93. sayfirst_contract-0.3.0/tests/test_server_acceptance.py +138 -0
  94. sayfirst_contract-0.3.0/tests/test_transport_reads.py +825 -0
@@ -0,0 +1,10 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ __pycache__/
3
+ *.py[cod]
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ .venv/
7
+ dist/
8
+
9
+ # The working report of a change, kept beside the tree and never published.
10
+ .sdd-quiet-gaps-report.md
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,12 @@
1
+ sayfirst control plane
2
+ Copyright 2026 Frédéric Aime
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use these files except in compliance with the License. A copy of the
6
+ License is in the LICENSE file at the root of this repository.
7
+
8
+ Distributions that incorporate this software must reproduce the attribution
9
+ notices this file carries (Apache License 2.0, section 4(d)).
10
+
11
+ The Apache License grants no rights in the names and marks of this project; see
12
+ TRADEMARKS.md.
@@ -0,0 +1,146 @@
1
+ Metadata-Version: 2.5
2
+ Name: sayfirst-contract
3
+ Version: 0.3.0
4
+ Summary: The public domain contract and its generated binding
5
+ Project-URL: Repository, https://github.com/fredaime/sayfirst-control-plane
6
+ Project-URL: Documentation, https://github.com/fredaime/sayfirst-control-plane/blob/main/packages/contract/README.md
7
+ Project-URL: Changelog, https://github.com/fredaime/sayfirst-control-plane/blob/main/CHANGELOG.md
8
+ Author-email: fredaime <frederic.aime@gmail.com>
9
+ License-Expression: Apache-2.0
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Requires-Python: <3.15,>=3.12
16
+ Provides-Extra: stub
17
+ Requires-Dist: sayfirst-contract-stub==0.3.0; extra == 'stub'
18
+ Description-Content-Type: text/markdown
19
+
20
+ <!-- SPDX-License-Identifier: Apache-2.0 -->
21
+ # `sayfirst` contract
22
+
23
+ This distribution publishes generation 1 of the transport-neutral domain
24
+ contract and its generated HTTP-over-Unix-socket binding. It has no runtime
25
+ dependencies. The scriptable fake is available only through the `stub` extra.
26
+
27
+ ## Scenarios
28
+
29
+ <!-- BEGIN GENERATED SCENARIOS -->
30
+
31
+ | Scenario | Binds | Article | Expected |
32
+ |---|---|---:|---|
33
+ | `allow` | both | 1 | `grant=present`, `outcome=allow`, `reason=policy_allows` |
34
+ | `deny` | both | 1 | `outcome=deny`, `reason=policy_denies` |
35
+ | `grant_expired_by_lifetime` | client | 10 | `grant=present`, `grant_use=expired`, `outcome=allow`, `reason=policy_allows` |
36
+ | `grant_hit_within_lifetime` | client | 10 | `grant=present`, `grant_use=hit`, `outcome=allow`, `reason=policy_allows` |
37
+ | `grant_miss_after_policy_version_change` | both | 10 | `after_policy_change={'grant': 'absent', 'outcome': 'deny', 'reason': 'policy_denies'}`, `grant=present`, `outcome=allow`, `reason=policy_allows` |
38
+ | `grant_void_on_arguments_change` | client | 3 | `grant=present`, `grant_use=arguments_changed`, `outcome=allow`, `reason=policy_allows` |
39
+ | `grant_void_on_connection_loss` | client | 10 | `grant=present`, `grant_use=connection_lost`, `outcome=allow`, `reason=policy_allows` |
40
+ | `missing_policy` | both | 1 | `outcome=deny`, `reason=policy_absent` |
41
+ | `no_grant_on_deny` | both | 10 | `grant=absent`, `outcome=deny`, `reason=policy_denies` |
42
+ | `no_grant_without_signal_channel` | both | 10 | `grant=absent`, `outcome=allow`, `reason=policy_allows` |
43
+ | `policy_unavailable_is_could_not_ask` | both | 1 | `grant=absent`, `problem=policy_unavailable`, `result=could_not_ask` |
44
+ | `review_approve` | both | 12 | `outcome=suspend`, `reason=policy_requires_review`, `state=approved`, `after_resolution.outcome=allow`, `after_resolution.reason=approval_granted` |
45
+ | `review_expire` | both | 12 | `outcome=suspend`, `reason=policy_requires_review`, `state=expired` |
46
+ | `review_reject` | both | 12 | `outcome=suspend`, `reason=policy_requires_review`, `state=rejected`, `after_resolution.outcome=deny`, `after_resolution.reason=approval_rejected` |
47
+ | `strictest_rule_wins` | server | 1 | `grant=absent`, `outcome=deny`, `reason=policy_denies` |
48
+ | `unknown_outcome` | client | 13 | `problem=outcome_unknown`, `reported_outcome=unknown`, `result=could_not_ask` |
49
+ | `unreachable` | client | 1 | `problem=unreachable`, `result=could_not_ask` |
50
+
51
+ <!-- END GENERATED SCENARIOS -->
52
+
53
+ ## Server conformance replay
54
+
55
+ Run each server-bound scenario — every row of the table above whose `binds` is
56
+ `both` or `server` — against a daemon instance already arranged for that
57
+ scenario:
58
+
59
+ ```console
60
+ sayfirst-conformance replay \
61
+ --socket allow=/run/conformance/allow.sock \
62
+ --socket deny=/run/conformance/deny.sock \
63
+ --socket grant_miss_after_policy_version_change=/run/conformance/grant_miss_after_policy_version_change.sock \
64
+ --socket missing_policy=/run/conformance/missing_policy.sock \
65
+ --socket no_grant_on_deny=/run/conformance/no_grant_on_deny.sock \
66
+ --socket no_grant_without_signal_channel=/run/conformance/no_grant_without_signal_channel.sock \
67
+ --socket policy_unavailable_is_could_not_ask=/run/conformance/policy_unavailable_is_could_not_ask.sock \
68
+ --socket review_approve=/run/conformance/review_approve.sock \
69
+ --socket review_expire=/run/conformance/review_expire.sock \
70
+ --socket review_reject=/run/conformance/review_reject.sock \
71
+ --socket strictest_rule_wins=/run/conformance/strictest_rule_wins.sock
72
+ ```
73
+
74
+ Name every server-bound scenario once: with `--socket SCENARIO=PATH`, or, for
75
+ one the deployment cannot arrange a daemon for, with
76
+ `--expected-absent SCENARIO=REASON`. A scenario named by neither has no daemon
77
+ to replay against, and it fails. Client-only scenarios are reported as not
78
+ applicable because their `binds` value does not include `server`. Every result
79
+ line contains the scenario name, `proven`, `failed`, or `not-applicable`, and a
80
+ reason, and the last line is the whole run's verdict: `proven` when every
81
+ server-bound scenario is proven, `failed` when any one failed, and `unknown`
82
+ when none failed and not every one was replayed — an expected absence, or a
83
+ platform the client cannot verify a peer on — even when another scenario was
84
+ proven. The exit status is that verdict's: `0` proven, `1` failed, `3` unknown.
85
+ An invalid invocation replays nothing and exits `2`.
86
+
87
+ The command has no way to change a daemon's policy or to move its clock, so
88
+ three arrangements are the deployment's to make. The daemon for
89
+ `grant_miss_after_policy_version_change` is asked the same question twice, and
90
+ must answer the second under a policy that denies it. The daemon for
91
+ `policy_unavailable_is_could_not_ask` must be unable to read its policy when it
92
+ is asked; since a daemon refuses to start on a policy it cannot read, the file
93
+ is broken after the start. And the daemons for the three that end a wait must
94
+ serve both approval operations — the one for `review_expire` suspending with a
95
+ wait shorter than the replay's `--deadline-wait-seconds`, and reading as
96
+ expired as soon as that wait has passed.
97
+
98
+ `sayfirstd conformance replay` is the same replay under the operator surface:
99
+ the same options, the same whole-run line and the same exit statuses. Its
100
+ scenario lines carry the name, the verdict and the reason; those of
101
+ `sayfirst-conformance` add whether the scenario binds the server and how many
102
+ expected members its verdict rests on.
103
+
104
+ The default expects each per-user daemon to run as the invoking user. System
105
+ daemon tests name its numeric account with `--expected-uid`. The client checks
106
+ that identity before sending each request. `review_expire` waits 61 seconds by
107
+ default; a test harness can inject its clock through `SocketHarness` instead.
108
+
109
+ The repository acceptance suite uses the same mapping convention under
110
+ `SAYFIRST_CONFORMANCE_SOCKET_DIR`: it looks for `<scenario>.sock` there and
111
+ uses `SAYFIRST_CONFORMANCE_EXPECTED_UID` when the daemon does not run as the
112
+ test user. When the socket directory is not configured, each case is an
113
+ expected absence whose reason states that observed configuration fact. When it
114
+ is configured, the same inventory runs live and carries no absence claim.
115
+
116
+ ## Distribution boundary
117
+
118
+ The reusable replayer and its HTTP-over-Unix-socket client remain in this
119
+ contract distribution. The client verifies the server's peer credential through
120
+ the same adapters as the transport client, `transport.peer`, and maps failures
121
+ to `impostor`, `peer_credential_unavailable`, `unreachable`, and
122
+ `answer_unreadable`. A platform no adapter covers is not applicable to a
123
+ replay, and on the path a boundary asks through, `hold_decision`, it is the
124
+ could-not-ask `peer_identity_unsupported`. The socket client is published from
125
+ `binding.http_unix_socket.client`; the replay harness is in the sibling
126
+ `replay` module.
127
+
128
+ This repository publishes the `sayfirst-conformance` distribution, the
129
+ `sayfirst_conformance` import package and the `sayfirst-conformance` script;
130
+ it also publishes the operator surface that inspects the daemon, from
131
+ `packages/cli`, as the distribution `sayfirstd`, the import package `sayfirstd`
132
+ and the console script `sayfirstd`. Each of those names is claimed once, by one
133
+ distribution, and `tests/test_client_distribution_names.py` holds that against
134
+ the `[project]` tables. The surface re-exports this operation as `sayfirstd
135
+ conformance replay` while depending on this contract and on no server
136
+ distribution.
137
+
138
+ The distribution `sayfirst-cli`, the import package `sayfirst_cli` and the
139
+ console script `sayfirst` belong to the product command-line interface and are
140
+ not published from this repository; the operator settled that on 2026-09-05.
141
+
142
+ This distribution installs no console script of its own, so nothing here is
143
+ bound to the name of a surface that forwards to it. The operator surface
144
+ `sayfirstd` is the one that reaches this operation today; the product
145
+ command-line interface may reach it through these same modules, and no release
146
+ of it does so yet.
@@ -0,0 +1,127 @@
1
+ <!-- SPDX-License-Identifier: Apache-2.0 -->
2
+ # `sayfirst` contract
3
+
4
+ This distribution publishes generation 1 of the transport-neutral domain
5
+ contract and its generated HTTP-over-Unix-socket binding. It has no runtime
6
+ dependencies. The scriptable fake is available only through the `stub` extra.
7
+
8
+ ## Scenarios
9
+
10
+ <!-- BEGIN GENERATED SCENARIOS -->
11
+
12
+ | Scenario | Binds | Article | Expected |
13
+ |---|---|---:|---|
14
+ | `allow` | both | 1 | `grant=present`, `outcome=allow`, `reason=policy_allows` |
15
+ | `deny` | both | 1 | `outcome=deny`, `reason=policy_denies` |
16
+ | `grant_expired_by_lifetime` | client | 10 | `grant=present`, `grant_use=expired`, `outcome=allow`, `reason=policy_allows` |
17
+ | `grant_hit_within_lifetime` | client | 10 | `grant=present`, `grant_use=hit`, `outcome=allow`, `reason=policy_allows` |
18
+ | `grant_miss_after_policy_version_change` | both | 10 | `after_policy_change={'grant': 'absent', 'outcome': 'deny', 'reason': 'policy_denies'}`, `grant=present`, `outcome=allow`, `reason=policy_allows` |
19
+ | `grant_void_on_arguments_change` | client | 3 | `grant=present`, `grant_use=arguments_changed`, `outcome=allow`, `reason=policy_allows` |
20
+ | `grant_void_on_connection_loss` | client | 10 | `grant=present`, `grant_use=connection_lost`, `outcome=allow`, `reason=policy_allows` |
21
+ | `missing_policy` | both | 1 | `outcome=deny`, `reason=policy_absent` |
22
+ | `no_grant_on_deny` | both | 10 | `grant=absent`, `outcome=deny`, `reason=policy_denies` |
23
+ | `no_grant_without_signal_channel` | both | 10 | `grant=absent`, `outcome=allow`, `reason=policy_allows` |
24
+ | `policy_unavailable_is_could_not_ask` | both | 1 | `grant=absent`, `problem=policy_unavailable`, `result=could_not_ask` |
25
+ | `review_approve` | both | 12 | `outcome=suspend`, `reason=policy_requires_review`, `state=approved`, `after_resolution.outcome=allow`, `after_resolution.reason=approval_granted` |
26
+ | `review_expire` | both | 12 | `outcome=suspend`, `reason=policy_requires_review`, `state=expired` |
27
+ | `review_reject` | both | 12 | `outcome=suspend`, `reason=policy_requires_review`, `state=rejected`, `after_resolution.outcome=deny`, `after_resolution.reason=approval_rejected` |
28
+ | `strictest_rule_wins` | server | 1 | `grant=absent`, `outcome=deny`, `reason=policy_denies` |
29
+ | `unknown_outcome` | client | 13 | `problem=outcome_unknown`, `reported_outcome=unknown`, `result=could_not_ask` |
30
+ | `unreachable` | client | 1 | `problem=unreachable`, `result=could_not_ask` |
31
+
32
+ <!-- END GENERATED SCENARIOS -->
33
+
34
+ ## Server conformance replay
35
+
36
+ Run each server-bound scenario — every row of the table above whose `binds` is
37
+ `both` or `server` — against a daemon instance already arranged for that
38
+ scenario:
39
+
40
+ ```console
41
+ sayfirst-conformance replay \
42
+ --socket allow=/run/conformance/allow.sock \
43
+ --socket deny=/run/conformance/deny.sock \
44
+ --socket grant_miss_after_policy_version_change=/run/conformance/grant_miss_after_policy_version_change.sock \
45
+ --socket missing_policy=/run/conformance/missing_policy.sock \
46
+ --socket no_grant_on_deny=/run/conformance/no_grant_on_deny.sock \
47
+ --socket no_grant_without_signal_channel=/run/conformance/no_grant_without_signal_channel.sock \
48
+ --socket policy_unavailable_is_could_not_ask=/run/conformance/policy_unavailable_is_could_not_ask.sock \
49
+ --socket review_approve=/run/conformance/review_approve.sock \
50
+ --socket review_expire=/run/conformance/review_expire.sock \
51
+ --socket review_reject=/run/conformance/review_reject.sock \
52
+ --socket strictest_rule_wins=/run/conformance/strictest_rule_wins.sock
53
+ ```
54
+
55
+ Name every server-bound scenario once: with `--socket SCENARIO=PATH`, or, for
56
+ one the deployment cannot arrange a daemon for, with
57
+ `--expected-absent SCENARIO=REASON`. A scenario named by neither has no daemon
58
+ to replay against, and it fails. Client-only scenarios are reported as not
59
+ applicable because their `binds` value does not include `server`. Every result
60
+ line contains the scenario name, `proven`, `failed`, or `not-applicable`, and a
61
+ reason, and the last line is the whole run's verdict: `proven` when every
62
+ server-bound scenario is proven, `failed` when any one failed, and `unknown`
63
+ when none failed and not every one was replayed — an expected absence, or a
64
+ platform the client cannot verify a peer on — even when another scenario was
65
+ proven. The exit status is that verdict's: `0` proven, `1` failed, `3` unknown.
66
+ An invalid invocation replays nothing and exits `2`.
67
+
68
+ The command has no way to change a daemon's policy or to move its clock, so
69
+ three arrangements are the deployment's to make. The daemon for
70
+ `grant_miss_after_policy_version_change` is asked the same question twice, and
71
+ must answer the second under a policy that denies it. The daemon for
72
+ `policy_unavailable_is_could_not_ask` must be unable to read its policy when it
73
+ is asked; since a daemon refuses to start on a policy it cannot read, the file
74
+ is broken after the start. And the daemons for the three that end a wait must
75
+ serve both approval operations — the one for `review_expire` suspending with a
76
+ wait shorter than the replay's `--deadline-wait-seconds`, and reading as
77
+ expired as soon as that wait has passed.
78
+
79
+ `sayfirstd conformance replay` is the same replay under the operator surface:
80
+ the same options, the same whole-run line and the same exit statuses. Its
81
+ scenario lines carry the name, the verdict and the reason; those of
82
+ `sayfirst-conformance` add whether the scenario binds the server and how many
83
+ expected members its verdict rests on.
84
+
85
+ The default expects each per-user daemon to run as the invoking user. System
86
+ daemon tests name its numeric account with `--expected-uid`. The client checks
87
+ that identity before sending each request. `review_expire` waits 61 seconds by
88
+ default; a test harness can inject its clock through `SocketHarness` instead.
89
+
90
+ The repository acceptance suite uses the same mapping convention under
91
+ `SAYFIRST_CONFORMANCE_SOCKET_DIR`: it looks for `<scenario>.sock` there and
92
+ uses `SAYFIRST_CONFORMANCE_EXPECTED_UID` when the daemon does not run as the
93
+ test user. When the socket directory is not configured, each case is an
94
+ expected absence whose reason states that observed configuration fact. When it
95
+ is configured, the same inventory runs live and carries no absence claim.
96
+
97
+ ## Distribution boundary
98
+
99
+ The reusable replayer and its HTTP-over-Unix-socket client remain in this
100
+ contract distribution. The client verifies the server's peer credential through
101
+ the same adapters as the transport client, `transport.peer`, and maps failures
102
+ to `impostor`, `peer_credential_unavailable`, `unreachable`, and
103
+ `answer_unreadable`. A platform no adapter covers is not applicable to a
104
+ replay, and on the path a boundary asks through, `hold_decision`, it is the
105
+ could-not-ask `peer_identity_unsupported`. The socket client is published from
106
+ `binding.http_unix_socket.client`; the replay harness is in the sibling
107
+ `replay` module.
108
+
109
+ This repository publishes the `sayfirst-conformance` distribution, the
110
+ `sayfirst_conformance` import package and the `sayfirst-conformance` script;
111
+ it also publishes the operator surface that inspects the daemon, from
112
+ `packages/cli`, as the distribution `sayfirstd`, the import package `sayfirstd`
113
+ and the console script `sayfirstd`. Each of those names is claimed once, by one
114
+ distribution, and `tests/test_client_distribution_names.py` holds that against
115
+ the `[project]` tables. The surface re-exports this operation as `sayfirstd
116
+ conformance replay` while depending on this contract and on no server
117
+ distribution.
118
+
119
+ The distribution `sayfirst-cli`, the import package `sayfirst_cli` and the
120
+ console script `sayfirst` belong to the product command-line interface and are
121
+ not published from this repository; the operator settled that on 2026-09-05.
122
+
123
+ This distribution installs no console script of its own, so nothing here is
124
+ bound to the name of a surface that forwards to it. The operator surface
125
+ `sayfirstd` is the one that reaches this operation today; the product
126
+ command-line interface may reach it through these same modules, and no release
127
+ of it does so yet.
@@ -0,0 +1,50 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ """Wheel-only build facts and repository notices."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import os
7
+ import tempfile
8
+ from datetime import UTC, date, datetime
9
+ from pathlib import Path
10
+ from typing import Any
11
+
12
+ from hatchling.builders.hooks.plugin.interface import BuildHookInterface
13
+
14
+
15
+ class CustomBuildHook(BuildHookInterface):
16
+ """Embed the build date and reproduce repository notices in the wheel."""
17
+
18
+ def initialize(self, version: str, build_data: dict[str, Any]) -> None:
19
+ # In the workspace the notices live at the repository root and have to
20
+ # be carried in by hand. In an unpacked source distribution they
21
+ # travel beside the package, where the backend's own licence globs
22
+ # already find them, so carrying them again would add the same file
23
+ # twice.
24
+ root = Path(self.root)
25
+ if not (root / "LICENSE").is_file():
26
+ metadata_directory = (
27
+ f"{self.metadata.core.name.replace('-', '_')}-{self.metadata.version}.dist-info"
28
+ )
29
+ repository = root.parents[1]
30
+ build_data["force_include"].update(
31
+ {
32
+ str(repository / "LICENSE"): f"{metadata_directory}/licenses/LICENSE",
33
+ str(repository / "NOTICE"): f"{metadata_directory}/licenses/NOTICE",
34
+ }
35
+ )
36
+ epoch = os.environ.get("SOURCE_DATE_EPOCH")
37
+ build_date = (
38
+ datetime.fromtimestamp(int(epoch), UTC).date() if epoch is not None else date.today()
39
+ )
40
+ with tempfile.NamedTemporaryFile(
41
+ mode="w", prefix="sayfirst-build-", suffix=".py", delete=False, encoding="utf-8"
42
+ ) as descriptor:
43
+ descriptor.write(
44
+ f'# SPDX-License-Identifier: Apache-2.0\nBUILD_DATE = "{build_date.isoformat()}"\n'
45
+ )
46
+ self._descriptor = Path(descriptor.name)
47
+ build_data["force_include"][str(self._descriptor)] = "sayfirst_contract/_build_info.py"
48
+
49
+ def finalize(self, version: str, build_data: dict[str, Any], artifact_path: str) -> None:
50
+ self._descriptor.unlink(missing_ok=True)
@@ -0,0 +1,49 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ [project]
3
+ name = "sayfirst-contract"
4
+ version = "0.3.0"
5
+ description = "The public domain contract and its generated binding"
6
+ readme = "README.md"
7
+ requires-python = ">=3.12,<3.15"
8
+ dependencies = []
9
+ license = "Apache-2.0"
10
+
11
+ authors = [{ name = "fredaime", email = "frederic.aime@gmail.com" }]
12
+ classifiers = [
13
+ "Development Status :: 4 - Beta",
14
+ "Programming Language :: Python :: 3",
15
+ "Programming Language :: Python :: 3.12",
16
+ "Programming Language :: Python :: 3.13",
17
+ "Programming Language :: Python :: 3.14",
18
+ ]
19
+
20
+ # The public repository this distribution sends a reader to. It was created
21
+ # fresh, as article 0 asks, in the act that published it on 2026-09-17, under
22
+ # the name the operator chose. `tests/test_pointers_survive_publication.py`
23
+ # holds these URLs, so a rename lands in every project file and in the guard
24
+ # together or not at all. No licence classifier: the licence is declared as an
25
+ # expression above, and an index refuses a distribution that carries both.
26
+ [project.urls]
27
+ Repository = "https://github.com/fredaime/sayfirst-control-plane"
28
+ Documentation = "https://github.com/fredaime/sayfirst-control-plane/blob/main/packages/contract/README.md"
29
+ Changelog = "https://github.com/fredaime/sayfirst-control-plane/blob/main/CHANGELOG.md"
30
+
31
+ [project.optional-dependencies]
32
+ stub = ["sayfirst-contract-stub==0.3.0"]
33
+
34
+ [tool.uv.sources]
35
+ sayfirst-contract-stub = { workspace = true }
36
+
37
+ [build-system]
38
+ requires = ["hatchling==1.32.0"]
39
+ build-backend = "hatchling.build"
40
+
41
+ [tool.hatch.build.targets.wheel]
42
+ packages = ["src/sayfirst_contract"]
43
+
44
+ [tool.hatch.build.targets.sdist.force-include]
45
+ "../../LICENSE" = "LICENSE"
46
+ "../../NOTICE" = "NOTICE"
47
+
48
+ [tool.hatch.build.targets.wheel.hooks.custom]
49
+ path = "hatch_build.py"