pgc-governance 2.0.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 (76) hide show
  1. pgc_governance-2.0.0/LICENSE +67 -0
  2. pgc_governance-2.0.0/NOTICE +11 -0
  3. pgc_governance-2.0.0/PKG-INFO +163 -0
  4. pgc_governance-2.0.0/README.md +143 -0
  5. pgc_governance-2.0.0/capability_side_effects/implementation/CS_APPENDONLY_JSONL_V0/__init__.py +7 -0
  6. pgc_governance-2.0.0/capability_side_effects/implementation/CS_APPENDONLY_JSONL_V0/capability.json +33 -0
  7. pgc_governance-2.0.0/capability_side_effects/implementation/CS_APPENDONLY_JSONL_V0/errors.py +22 -0
  8. pgc_governance-2.0.0/capability_side_effects/implementation/CS_APPENDONLY_JSONL_V0/impl/__init__.py +0 -0
  9. pgc_governance-2.0.0/capability_side_effects/implementation/CS_APPENDONLY_JSONL_V0/impl/executor.py +127 -0
  10. pgc_governance-2.0.0/capability_side_effects/implementation/CS_APPENDONLY_JSONL_V0/operations.json +48 -0
  11. pgc_governance-2.0.0/capability_side_effects/implementation/CS_APPENDONLY_JSONL_V0/runtime.py +74 -0
  12. pgc_governance-2.0.0/capability_side_effects/implementation/CS_APPENDONLY_JSONL_V0/vocabulary.json +16 -0
  13. pgc_governance-2.0.0/capability_side_effects/implementation/CS_CLOCK_V0/__init__.py +0 -0
  14. pgc_governance-2.0.0/capability_side_effects/implementation/CS_CLOCK_V0/runtime.py +41 -0
  15. pgc_governance-2.0.0/capability_side_effects/implementation/CS_MUTABLE_JSON_V0/__init__.py +7 -0
  16. pgc_governance-2.0.0/capability_side_effects/implementation/CS_MUTABLE_JSON_V0/capability.json +50 -0
  17. pgc_governance-2.0.0/capability_side_effects/implementation/CS_MUTABLE_JSON_V0/errors.py +26 -0
  18. pgc_governance-2.0.0/capability_side_effects/implementation/CS_MUTABLE_JSON_V0/impl/__init__.py +0 -0
  19. pgc_governance-2.0.0/capability_side_effects/implementation/CS_MUTABLE_JSON_V0/impl/backend.py +45 -0
  20. pgc_governance-2.0.0/capability_side_effects/implementation/CS_MUTABLE_JSON_V0/impl/executor.py +290 -0
  21. pgc_governance-2.0.0/capability_side_effects/implementation/CS_MUTABLE_JSON_V0/impl/utils.py +39 -0
  22. pgc_governance-2.0.0/capability_side_effects/implementation/CS_MUTABLE_JSON_V0/operations.json +144 -0
  23. pgc_governance-2.0.0/capability_side_effects/implementation/CS_MUTABLE_JSON_V0/runtime.py +131 -0
  24. pgc_governance-2.0.0/capability_side_effects/implementation/CS_MUTABLE_JSON_V0/vocabulary.json +16 -0
  25. pgc_governance-2.0.0/capability_side_effects/implementation/CS_REGISTRY_V0/__init__.py +7 -0
  26. pgc_governance-2.0.0/capability_side_effects/implementation/CS_REGISTRY_V0/capability.json +74 -0
  27. pgc_governance-2.0.0/capability_side_effects/implementation/CS_REGISTRY_V0/errors.py +19 -0
  28. pgc_governance-2.0.0/capability_side_effects/implementation/CS_REGISTRY_V0/impl/__init__.py +0 -0
  29. pgc_governance-2.0.0/capability_side_effects/implementation/CS_REGISTRY_V0/impl/backend.py +165 -0
  30. pgc_governance-2.0.0/capability_side_effects/implementation/CS_REGISTRY_V0/impl/executor.py +84 -0
  31. pgc_governance-2.0.0/capability_side_effects/implementation/CS_REGISTRY_V0/operations.json +48 -0
  32. pgc_governance-2.0.0/capability_side_effects/implementation/CS_REGISTRY_V0/runtime.py +77 -0
  33. pgc_governance-2.0.0/capability_side_effects/implementation/CS_REGISTRY_V0/vocabulary.json +17 -0
  34. pgc_governance-2.0.0/capability_side_effects/implementation/CS_SNAPSHOT_QUERY_V0/__init__.py +0 -0
  35. pgc_governance-2.0.0/capability_side_effects/implementation/CS_SNAPSHOT_QUERY_V0/runtime.py +97 -0
  36. pgc_governance-2.0.0/capability_side_effects/implementation/CS_TEXT_ARTIFACT_V0/__init__.py +0 -0
  37. pgc_governance-2.0.0/capability_side_effects/implementation/CS_TEXT_ARTIFACT_V0/runtime.py +98 -0
  38. pgc_governance-2.0.0/capability_side_effects/implementation/__init__.py +0 -0
  39. pgc_governance-2.0.0/capability_side_effects/registry/capability_side_effects/CS_APPENDONLY_JSONL_V0.md +252 -0
  40. pgc_governance-2.0.0/capability_side_effects/registry/capability_side_effects/CS_CLOCK_V0.md +85 -0
  41. pgc_governance-2.0.0/capability_side_effects/registry/capability_side_effects/CS_MUTABLE_JSON_V0.md +416 -0
  42. pgc_governance-2.0.0/capability_side_effects/registry/capability_side_effects/CS_REGISTRY_V0.md +365 -0
  43. pgc_governance-2.0.0/capability_side_effects/registry/capability_side_effects/CS_SNAPSHOT_QUERY_V0.md +124 -0
  44. pgc_governance-2.0.0/capability_side_effects/registry/capability_side_effects/CS_TEXT_ARTIFACT_V0.md +110 -0
  45. pgc_governance-2.0.0/capability_transforms/implementation/__init__.py +0 -0
  46. pgc_governance-2.0.0/capability_transforms/implementation/ct_exec_emit_v0.py +60 -0
  47. pgc_governance-2.0.0/capability_transforms/implementation/ct_executor.py +12 -0
  48. pgc_governance-2.0.0/capability_transforms/implementation/ct_pure_assemble_record_v0.py +31 -0
  49. pgc_governance-2.0.0/capability_transforms/implementation/ct_pure_compare_equal_v0.py +23 -0
  50. pgc_governance-2.0.0/capability_transforms/implementation/ct_pure_extract_v0.py +83 -0
  51. pgc_governance-2.0.0/capability_transforms/implementation/ct_pure_filter_records_v0.py +79 -0
  52. pgc_governance-2.0.0/capability_transforms/implementation/ct_pure_generate_id_v0.py +80 -0
  53. pgc_governance-2.0.0/capability_transforms/implementation/ct_pure_lookup_v0.py +46 -0
  54. pgc_governance-2.0.0/capability_transforms/implementation/ct_pure_map_result_to_http_v0.py +66 -0
  55. pgc_governance-2.0.0/capability_transforms/implementation/ct_pure_passthrough_v0.py +12 -0
  56. pgc_governance-2.0.0/capability_transforms/implementation/ct_pure_validate_parameter_rules_v0.py +104 -0
  57. pgc_governance-2.0.0/capability_transforms/implementation/ct_pure_validate_record_structure_v0.py +192 -0
  58. pgc_governance-2.0.0/capability_transforms/implementation/ct_pure_validate_set_membership_v0.py +48 -0
  59. pgc_governance-2.0.0/capability_transforms/registry/capability_transforms/CT_EXEC_EMIT_V0.md +34 -0
  60. pgc_governance-2.0.0/capability_transforms/registry/capability_transforms/CT_PURE_ASSEMBLE_RECORD_V0.md +33 -0
  61. pgc_governance-2.0.0/capability_transforms/registry/capability_transforms/CT_PURE_COMPARE_EQUAL_V0.md +55 -0
  62. pgc_governance-2.0.0/capability_transforms/registry/capability_transforms/CT_PURE_EXTRACT_V0.md +171 -0
  63. pgc_governance-2.0.0/capability_transforms/registry/capability_transforms/CT_PURE_FILTER_RECORDS_V0.md +138 -0
  64. pgc_governance-2.0.0/capability_transforms/registry/capability_transforms/CT_PURE_GENERATE_ID_V0.md +37 -0
  65. pgc_governance-2.0.0/capability_transforms/registry/capability_transforms/CT_PURE_LOOKUP_V0.md +36 -0
  66. pgc_governance-2.0.0/capability_transforms/registry/capability_transforms/CT_PURE_MAP_RESULT_TO_HTTP_V0.md +46 -0
  67. pgc_governance-2.0.0/capability_transforms/registry/capability_transforms/CT_PURE_PASSTHROUGH_V0.md +44 -0
  68. pgc_governance-2.0.0/capability_transforms/registry/capability_transforms/CT_PURE_VALIDATE_PARAMETER_RULES_V0.md +103 -0
  69. pgc_governance-2.0.0/capability_transforms/registry/capability_transforms/CT_PURE_VALIDATE_RECORD_STRUCTURE_V0.md +143 -0
  70. pgc_governance-2.0.0/capability_transforms/registry/capability_transforms/CT_PURE_VALIDATE_SET_MEMBERSHIP_V0.md +86 -0
  71. pgc_governance-2.0.0/pgc_governance.egg-info/PKG-INFO +163 -0
  72. pgc_governance-2.0.0/pgc_governance.egg-info/SOURCES.txt +74 -0
  73. pgc_governance-2.0.0/pgc_governance.egg-info/dependency_links.txt +1 -0
  74. pgc_governance-2.0.0/pgc_governance.egg-info/top_level.txt +2 -0
  75. pgc_governance-2.0.0/pyproject.toml +41 -0
  76. pgc_governance-2.0.0/setup.cfg +4 -0
@@ -0,0 +1,67 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright 2026 Bhash Ganti aka Bachi
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+
20
+ ------------------------
21
+ FULL LICENSE TEXT BELOW
22
+ ------------------------
23
+
24
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
25
+
26
+ 1. Definitions.
27
+ "License" shall mean the terms and conditions for use, reproduction,
28
+ and distribution as defined by Sections 1 through 9 of this document.
29
+ "Licensor" shall mean the copyright owner.
30
+ "Legal Entity" shall mean the union of the acting entity and all other
31
+ entities that control, are controlled by, or are under common control.
32
+ "You" shall mean an individual or Legal Entity exercising permissions.
33
+ "Source" form shall mean the preferred form for making modifications.
34
+ "Object" form shall mean any form resulting from mechanical transformation.
35
+ "Work" shall mean the work of authorship.
36
+ "Derivative Works" shall mean any work based on the Work.
37
+ "Contribution" shall mean any work intentionally submitted.
38
+ "Contributor" shall mean Licensor and any individual submitting Contributions.
39
+
40
+ 2. Grant of Copyright License.
41
+ Each Contributor grants You a perpetual, worldwide, non-exclusive,
42
+ no-charge, royalty-free copyright license.
43
+
44
+ 3. Grant of Patent License.
45
+ Each Contributor grants a patent license to make, use, sell, etc.
46
+
47
+ 4. Redistribution.
48
+ You may reproduce and distribute copies provided that:
49
+ - You include a copy of this License
50
+ - You retain notices
51
+ - You state modifications
52
+ - You include NOTICE file if present
53
+
54
+ 5. Submission of Contributions.
55
+ Contributions are under this License unless stated otherwise.
56
+
57
+ 6. Trademarks.
58
+ This License does not grant trademark rights.
59
+
60
+ 7. Disclaimer of Warranty.
61
+ Provided "AS IS", without warranties.
62
+
63
+ 8. Limitation of Liability.
64
+ No liability for damages.
65
+
66
+ 9. Accepting Warranty or Additional Liability.
67
+ You may offer support/warranty on your own behalf only.
@@ -0,0 +1,11 @@
1
+ PGS — Protocol-Governed Systems
2
+ Copyright 2026 Bhash Ganti aka Bachi
3
+
4
+ This project introduces a protocol-first execution model in which:
5
+
6
+ - Behavior is declared in protocol artifacts
7
+ - Execution is performed by a deterministic runtime
8
+ - Capability implementations are bound at compile time
9
+ - Governance is enforced through invariants and assertions
10
+
11
+ Extensibility is achieved by declaration, not refactor.
@@ -0,0 +1,163 @@
1
+ Metadata-Version: 2.4
2
+ Name: pgc-governance
3
+ Version: 2.0.0
4
+ Summary: PGC governance surface — the registry of governed artifacts and the capability implementations a sealed snapshot binds at execution
5
+ Author-email: Bhash Ganti <bachipeachy@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://omnibachi.org/
8
+ Project-URL: Repository, https://github.com/protocol-governed-computing/software_governance
9
+ Project-URL: Standard, https://doi.org/10.5281/zenodo.22150616
10
+ Keywords: protocol-governed-computing,governance,authorization,sdlc
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Software Development :: Compilers
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ License-File: NOTICE
19
+ Dynamic: license-file
20
+
21
+ # software_governance
22
+
23
+ **The normative platform surface — what a conforming PGC system is allowed to be.**
24
+
25
+ Every governed behavior in a PGC composition resolves, eventually, against a declaration in this
26
+ repository. It holds the constitutions, invariants, structures, schemas, surface contracts,
27
+ reserved vocabulary, and the neutral capability transforms and side effects that no single domain
28
+ owns and every domain depends on.
29
+
30
+ It is **declaration first**: constitutions, invariants, structures, schemas and vocabulary that
31
+ the sibling toolchain reads. It also carries the capability transform and side-effect
32
+ implementation modules a sealed snapshot binds by fully qualified module path at execution —
33
+ the only executable code here, and it exists because a snapshot names it.
34
+
35
+ ## Install
36
+
37
+ ```bash
38
+ pip install pgc-governance
39
+ ```
40
+
41
+ This package carries declarations and the implementation modules a sealed
42
+ snapshot binds at execution. It provides no command of its own — the toolchain
43
+ packages read it.
44
+
45
+ ## Where it fits
46
+
47
+ A composition is assembled from repositories that each own one concern:
48
+
49
+ ```
50
+ software_governance the normative surface every composition rests on (this repo)
51
+ conformance_workloads workloads that prove conformance
52
+ business_domains domains built on the surface
53
+
54
+ protocol_compiler source → compiled projections
55
+ snapshot_assembler projections → assembled snapshot
56
+ protocol_runtime snapshot → execution
57
+ snapshot_inspector snapshot → inspection
58
+ ```
59
+
60
+ This repo is the **floor** of that stack. A domain does not import it — a domain *resolves against*
61
+ it, and the compiler is what performs the resolution. If a reference in any domain fails to resolve,
62
+ either the platform is missing an artifact or the domain leaked one it should have declared itself.
63
+
64
+ **A platform is a composition, never a repository.** A Profiled Normative Platform is this surface
65
+ plus selected workloads plus an optional business domain, per a conformance profile. There are as
66
+ many platforms as there are profiles.
67
+
68
+ ## What it holds
69
+
70
+ | Path | Contents |
71
+ |------|----------|
72
+ | `registry/<namespace>/` | The governance surface, one directory per namespace — `actor`, `artifact`, `authority`, `conformance`, `execution`, `governance`, `lifecycle`, `structure`, `transport`, `vocabulary` and others. Each holds its own constitutions, invariants, structures, surface contracts and reserved vocabulary |
73
+ | `registry/schema/` | `SCHEMA_*.json` — the declaration substrate, not a namespace of its own |
74
+ | `capability_transforms/registry/` | Neutral, domain-agnostic capability transform declarations |
75
+ | `capability_side_effects/registry/` | Neutral capability side-effect declarations |
76
+ | `doc/` | The surface map, the governance doctrine, and the rulings that settled contested questions |
77
+
78
+ Artifacts declare namespaces of the form `fb.<concern>` — `structure::STRUCTURE_IDENTITY_V0`,
79
+ `authority::…`. **`fb` is a federation boundary**: a declaration that a distinct governance
80
+ authority has jurisdiction over a named set of protocol semantics. It is not a folder, a package, or
81
+ a deployment unit — see `registry/federation/constitutions/CONSTITUTION_FEDERATION_BOUNDARY_V0.md`.
82
+ Domains declare their own namespaces (`blockchain::`, `book_library_mgmt::`) and never declare into a
83
+ platform boundary.
84
+
85
+ ## What binds a contributor
86
+
87
+ **Identity is declared, not located.** An artifact's namespace comes from the `fqdn:` key in its own
88
+ `## Machine` block, never from the directory it sits in. The registry is organised one directory per
89
+ namespace, so the correspondence is currently one-to-one — a navigation convenience, not the source
90
+ of identity. A file may move without changing what the artifact *is*.
91
+
92
+ **No code, ever.** Normative declarations only: `.md` protocol source and `.json` schemas. A
93
+ directory that would hold `.py` does not belong in this repository. The compiler, assembler, runtime
94
+ and inspector that read this surface are siblings, and none of them is vendored here.
95
+
96
+ **Immutable within a spec version.** A domain extends the platform by adding artifacts in its own
97
+ namespace; it never modifies one here. A behavior change is a new version, never an in-place edit.
98
+
99
+ **A namespace is an ownership boundary.** Create one only for a first-class concern that can evolve
100
+ independently and owns a coherent contract — never because several artifacts happen to reference the
101
+ same artifact kind.
102
+
103
+ ## How completeness is verified
104
+
105
+ The surface is complete and self-supporting **iff the external compiler compiles it to a closed
106
+ snapshot** — every reference resolves, zero unresolved FQDNs. Nothing inside this repository can
107
+ establish that, which is the point: the engine is pointed *at* the surface and never lives inside it.
108
+
109
+ ```bash
110
+ protocol_compiler/compile.sh <this repo>
111
+ ```
112
+
113
+ Then diff the resulting closure against `doc/GOVERNANCE_SURFACE_MAP.md` §6. An unresolved reference
114
+ is either a missing platform artifact or a leaked domain reference — resolved by adding the former
115
+ or moving the latter into the domain that owns it.
116
+
117
+ ## License
118
+
119
+ See `LICENSE` and `NOTICE`.
120
+
121
+ ---
122
+
123
+ ## The package family
124
+
125
+ | Package | Repository | Role |
126
+ |---|---|---|
127
+ | `pgc-compiler` | `protocol_compiler` | declarations → compiled projections |
128
+ | `pgc-assembler` | `snapshot_assembler` | projections → sealed snapshot |
129
+ | `pgc-runtime` | `protocol_runtime` | snapshot → governed execution |
130
+ | `pgc-inspector` | `snapshot_inspector` | snapshot → read-only inspection |
131
+ | `pgc-transformation` | `transformation` | change request → protocol artifacts |
132
+ | `pgc-governance` | `software_governance` | the governance surface and its capability implementations |
133
+ | `pgc-workloads` | `conformance_workloads` | the workloads that make conformance observable |
134
+ | `pgc-domains` | `business_domains` | the business domain implementations the composed snapshot binds |
135
+
136
+ `pip install pgc` brings in the whole family.
137
+
138
+ **Installing the toolchain is one of two steps.** The compiler resolves the governance surface from
139
+ `PGC_PLATFORM_ROOT` — fail-hard, cwd-independent, zero inference — so the *declarations* come from a
140
+ repository you point at, never from a wheel. A registry inside a package would be a second governance
141
+ surface competing with the repository's, and a build could then be governed by a stale copy.
142
+
143
+ ```bash
144
+ git clone https://github.com/protocol-governed-computing/software_governance
145
+ export PGC_PLATFORM_ROOT=$PWD/software_governance
146
+ pgc # reports what is installed and whether the anchor resolves
147
+ ```
148
+
149
+ `PGC_BUILD_ROOT` (compiled output, keeping the governance repo read-only) and `PGC_DOMAIN_ROOTS`
150
+ (additional domains contributing their own `registry/structures`) are optional.
151
+
152
+ **Versioning.** Two schemes, and the published version follows the second.
153
+
154
+ - **Internal** — each repository's `VERSION` file, a monotonic composition ordinal. PGC versions the
155
+ composition rather than each repo: they release together and the governance closure forces lockstep,
156
+ so the ordinal names which composition a repo belongs to. Development happens on `dev/<N>` and each
157
+ cycle is tagged `release-<N>`. This is not published.
158
+ - **Public** — `PUBLIC_VERSION`, tagged on every component repository. The platform is at **`v2`**.
159
+
160
+ **The published version is the public one: `v2` is `2.0.0`.** The standard the packages implement is a
161
+ separate artifact on its own track and is not this number.
162
+
163
+ The standard these packages implement is published separately: https://doi.org/10.5281/zenodo.22150616
@@ -0,0 +1,143 @@
1
+ # software_governance
2
+
3
+ **The normative platform surface — what a conforming PGC system is allowed to be.**
4
+
5
+ Every governed behavior in a PGC composition resolves, eventually, against a declaration in this
6
+ repository. It holds the constitutions, invariants, structures, schemas, surface contracts,
7
+ reserved vocabulary, and the neutral capability transforms and side effects that no single domain
8
+ owns and every domain depends on.
9
+
10
+ It is **declaration first**: constitutions, invariants, structures, schemas and vocabulary that
11
+ the sibling toolchain reads. It also carries the capability transform and side-effect
12
+ implementation modules a sealed snapshot binds by fully qualified module path at execution —
13
+ the only executable code here, and it exists because a snapshot names it.
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ pip install pgc-governance
19
+ ```
20
+
21
+ This package carries declarations and the implementation modules a sealed
22
+ snapshot binds at execution. It provides no command of its own — the toolchain
23
+ packages read it.
24
+
25
+ ## Where it fits
26
+
27
+ A composition is assembled from repositories that each own one concern:
28
+
29
+ ```
30
+ software_governance the normative surface every composition rests on (this repo)
31
+ conformance_workloads workloads that prove conformance
32
+ business_domains domains built on the surface
33
+
34
+ protocol_compiler source → compiled projections
35
+ snapshot_assembler projections → assembled snapshot
36
+ protocol_runtime snapshot → execution
37
+ snapshot_inspector snapshot → inspection
38
+ ```
39
+
40
+ This repo is the **floor** of that stack. A domain does not import it — a domain *resolves against*
41
+ it, and the compiler is what performs the resolution. If a reference in any domain fails to resolve,
42
+ either the platform is missing an artifact or the domain leaked one it should have declared itself.
43
+
44
+ **A platform is a composition, never a repository.** A Profiled Normative Platform is this surface
45
+ plus selected workloads plus an optional business domain, per a conformance profile. There are as
46
+ many platforms as there are profiles.
47
+
48
+ ## What it holds
49
+
50
+ | Path | Contents |
51
+ |------|----------|
52
+ | `registry/<namespace>/` | The governance surface, one directory per namespace — `actor`, `artifact`, `authority`, `conformance`, `execution`, `governance`, `lifecycle`, `structure`, `transport`, `vocabulary` and others. Each holds its own constitutions, invariants, structures, surface contracts and reserved vocabulary |
53
+ | `registry/schema/` | `SCHEMA_*.json` — the declaration substrate, not a namespace of its own |
54
+ | `capability_transforms/registry/` | Neutral, domain-agnostic capability transform declarations |
55
+ | `capability_side_effects/registry/` | Neutral capability side-effect declarations |
56
+ | `doc/` | The surface map, the governance doctrine, and the rulings that settled contested questions |
57
+
58
+ Artifacts declare namespaces of the form `fb.<concern>` — `structure::STRUCTURE_IDENTITY_V0`,
59
+ `authority::…`. **`fb` is a federation boundary**: a declaration that a distinct governance
60
+ authority has jurisdiction over a named set of protocol semantics. It is not a folder, a package, or
61
+ a deployment unit — see `registry/federation/constitutions/CONSTITUTION_FEDERATION_BOUNDARY_V0.md`.
62
+ Domains declare their own namespaces (`blockchain::`, `book_library_mgmt::`) and never declare into a
63
+ platform boundary.
64
+
65
+ ## What binds a contributor
66
+
67
+ **Identity is declared, not located.** An artifact's namespace comes from the `fqdn:` key in its own
68
+ `## Machine` block, never from the directory it sits in. The registry is organised one directory per
69
+ namespace, so the correspondence is currently one-to-one — a navigation convenience, not the source
70
+ of identity. A file may move without changing what the artifact *is*.
71
+
72
+ **No code, ever.** Normative declarations only: `.md` protocol source and `.json` schemas. A
73
+ directory that would hold `.py` does not belong in this repository. The compiler, assembler, runtime
74
+ and inspector that read this surface are siblings, and none of them is vendored here.
75
+
76
+ **Immutable within a spec version.** A domain extends the platform by adding artifacts in its own
77
+ namespace; it never modifies one here. A behavior change is a new version, never an in-place edit.
78
+
79
+ **A namespace is an ownership boundary.** Create one only for a first-class concern that can evolve
80
+ independently and owns a coherent contract — never because several artifacts happen to reference the
81
+ same artifact kind.
82
+
83
+ ## How completeness is verified
84
+
85
+ The surface is complete and self-supporting **iff the external compiler compiles it to a closed
86
+ snapshot** — every reference resolves, zero unresolved FQDNs. Nothing inside this repository can
87
+ establish that, which is the point: the engine is pointed *at* the surface and never lives inside it.
88
+
89
+ ```bash
90
+ protocol_compiler/compile.sh <this repo>
91
+ ```
92
+
93
+ Then diff the resulting closure against `doc/GOVERNANCE_SURFACE_MAP.md` §6. An unresolved reference
94
+ is either a missing platform artifact or a leaked domain reference — resolved by adding the former
95
+ or moving the latter into the domain that owns it.
96
+
97
+ ## License
98
+
99
+ See `LICENSE` and `NOTICE`.
100
+
101
+ ---
102
+
103
+ ## The package family
104
+
105
+ | Package | Repository | Role |
106
+ |---|---|---|
107
+ | `pgc-compiler` | `protocol_compiler` | declarations → compiled projections |
108
+ | `pgc-assembler` | `snapshot_assembler` | projections → sealed snapshot |
109
+ | `pgc-runtime` | `protocol_runtime` | snapshot → governed execution |
110
+ | `pgc-inspector` | `snapshot_inspector` | snapshot → read-only inspection |
111
+ | `pgc-transformation` | `transformation` | change request → protocol artifacts |
112
+ | `pgc-governance` | `software_governance` | the governance surface and its capability implementations |
113
+ | `pgc-workloads` | `conformance_workloads` | the workloads that make conformance observable |
114
+ | `pgc-domains` | `business_domains` | the business domain implementations the composed snapshot binds |
115
+
116
+ `pip install pgc` brings in the whole family.
117
+
118
+ **Installing the toolchain is one of two steps.** The compiler resolves the governance surface from
119
+ `PGC_PLATFORM_ROOT` — fail-hard, cwd-independent, zero inference — so the *declarations* come from a
120
+ repository you point at, never from a wheel. A registry inside a package would be a second governance
121
+ surface competing with the repository's, and a build could then be governed by a stale copy.
122
+
123
+ ```bash
124
+ git clone https://github.com/protocol-governed-computing/software_governance
125
+ export PGC_PLATFORM_ROOT=$PWD/software_governance
126
+ pgc # reports what is installed and whether the anchor resolves
127
+ ```
128
+
129
+ `PGC_BUILD_ROOT` (compiled output, keeping the governance repo read-only) and `PGC_DOMAIN_ROOTS`
130
+ (additional domains contributing their own `registry/structures`) are optional.
131
+
132
+ **Versioning.** Two schemes, and the published version follows the second.
133
+
134
+ - **Internal** — each repository's `VERSION` file, a monotonic composition ordinal. PGC versions the
135
+ composition rather than each repo: they release together and the governance closure forces lockstep,
136
+ so the ordinal names which composition a repo belongs to. Development happens on `dev/<N>` and each
137
+ cycle is tagged `release-<N>`. This is not published.
138
+ - **Public** — `PUBLIC_VERSION`, tagged on every component repository. The platform is at **`v2`**.
139
+
140
+ **The published version is the public one: `v2` is `2.0.0`.** The standard the packages implement is a
141
+ separate artifact on its own track and is not this number.
142
+
143
+ The standard these packages implement is published separately: https://doi.org/10.5281/zenodo.22150616
@@ -0,0 +1,7 @@
1
+ """CS_APPENDONLY_JSONL_V0 package exports."""
2
+
3
+ from capability_side_effects.implementation.CS_APPENDONLY_JSONL_V0.runtime import (
4
+ AppendOnlyJsonlRuntime,
5
+ )
6
+
7
+ __all__ = ["AppendOnlyJsonlRuntime"]
@@ -0,0 +1,33 @@
1
+ {
2
+ "cs_code": "CS_APPENDONLY_JSONL_V0",
3
+ "version": "v0",
4
+
5
+ "kind": "CS",
6
+ "side_effect_type": "persistent",
7
+
8
+ "supported_capability_contracts": [
9
+ "CC_APPEND_RECORD_V0"
10
+ ],
11
+
12
+ "description": "Append-only JSONL persistence with ordered event history.",
13
+
14
+ "durability": "persistent",
15
+ "idempotent": false,
16
+ "replay_policy": "append_once",
17
+
18
+ "guarantees": [
19
+ "append_only",
20
+ "ordered",
21
+ "jsonl_format",
22
+ "durable_across_restarts"
23
+ ],
24
+
25
+ "non_guarantees": [
26
+ "mutation",
27
+ "overwrite",
28
+ "random_access",
29
+ "deletion",
30
+ "key_addressability",
31
+ "exactly_once_delivery"
32
+ ]
33
+ }
@@ -0,0 +1,22 @@
1
+ """
2
+ errors.py — Canonical error types for CS_APPENDONLY_JSONL_V0.
3
+
4
+ These errors represent contract-level failures, not implementation details.
5
+ They are surfaced to CEP via host.py.
6
+ """
7
+
8
+
9
+ class AppendOnlyJsonlError(Exception):
10
+ """Base class for all CS_APPENDONLY_JSONL_V0 errors."""
11
+
12
+
13
+ class InvalidRecord(AppendOnlyJsonlError):
14
+ """Raised when a record fails validation."""
15
+
16
+
17
+ class StorageCorrupt(AppendOnlyJsonlError):
18
+ """Raised when persisted data cannot be read or parsed safely."""
19
+
20
+
21
+ class StorageUnavailable(AppendOnlyJsonlError):
22
+ """Raised when the backend cannot be accessed or written."""
@@ -0,0 +1,127 @@
1
+ """
2
+ executor.py — Capability semantics for CS_APPENDONLY_JSONL_V0.
3
+
4
+ Entity-based storage resolution:
5
+ - Paths resolved from STRUCTURE using store entity metadata
6
+ - storage_structure_artifact injected by RuntimeLoader from the RB's storage_structure reference
7
+ - module_data_root injected by RuntimeLoader from workflow context
8
+ - __pgs_store_entity__ injected per-operation by capability_pipeline from CC step store: field
9
+ """
10
+
11
+ import json
12
+ from datetime import datetime
13
+ from pathlib import Path
14
+ from typing import Any, Dict
15
+
16
+
17
+ class AppendOnlyJsonlEngine:
18
+ """
19
+ Implements append-only JSONL semantics with entity-based path resolution.
20
+ Storage paths are declared in STRUCTURE, not in RB policy.
21
+ """
22
+
23
+ def __init__(self, config: Dict[str, Any]):
24
+ self._storage_structure = config.get("storage_structure_artifact")
25
+ if not self._storage_structure:
26
+ raise ValueError(
27
+ "CS_APPENDONLY_JSONL_V0 requires storage_structure_artifact in config. "
28
+ "RuntimeLoader must inject it from the RB storage_structure reference."
29
+ )
30
+
31
+ self._module_data_root = config.get("module_data_root")
32
+ if not self._module_data_root:
33
+ raise ValueError(
34
+ "CS_APPENDONLY_JSONL_V0 requires module_data_root in config. "
35
+ "RuntimeLoader must inject it from workflow context."
36
+ )
37
+
38
+ core = self._storage_structure.get("frontmatter", {}).get("core", {})
39
+ self._entity_storage_map = core.get("entity_stores", {})
40
+ if not self._entity_storage_map:
41
+ raise ValueError("STRUCTURE artifact missing entity_stores")
42
+
43
+ def _resolve_storage_path(self, payload: Dict[str, Any]) -> Path:
44
+ """
45
+ Resolve storage path from STRUCTURE using store entity metadata.
46
+
47
+ PROTOCOL: Store entity is injected by capability_pipeline from CC step metadata.
48
+ """
49
+ store_entity = payload.get("__pgs_store_entity__")
50
+ if not store_entity:
51
+ raise ValueError(
52
+ "PROTOCOL VIOLATION: Missing __pgs_store_entity__ in payload. "
53
+ "CC step must declare store: field for entity-based storage."
54
+ )
55
+
56
+ entity_config = self._entity_storage_map.get(store_entity)
57
+ if not entity_config:
58
+ raise ValueError(
59
+ f"PROTOCOL VIOLATION: Entity '{store_entity}' not found in STRUCTURE entity_stores. "
60
+ f"Available entities: {list(self._entity_storage_map.keys())}"
61
+ )
62
+
63
+ subpath = entity_config.get("path")
64
+ if not subpath:
65
+ raise ValueError(
66
+ f"PROTOCOL VIOLATION: Entity '{store_entity}' missing 'path' in STRUCTURE. "
67
+ "Storage topology must declare paths for all entities."
68
+ )
69
+
70
+ return Path(self._module_data_root) / subpath
71
+
72
+ def append(self, payload: Dict[str, Any]) -> Dict[str, Any]:
73
+ """Append a record to the log."""
74
+ path = self._resolve_storage_path(payload)
75
+
76
+ sequence_counter = 0
77
+ if path.exists():
78
+ with open(path) as f:
79
+ sequence_counter = sum(1 for _ in f)
80
+
81
+ record = payload.get("record")
82
+ stream_id = payload.get("stream_id")
83
+ actor_id = payload.get("actor_id")
84
+
85
+ timestamp = datetime.utcnow().isoformat()
86
+ record_id = f"{timestamp}_{sequence_counter:06d}"
87
+ sequence_number = sequence_counter + 1
88
+
89
+ log_entry = {
90
+ "record_id": record_id,
91
+ "sequence_number": sequence_number,
92
+ "timestamp": timestamp,
93
+ "actor_id": actor_id,
94
+ "stream_id": stream_id,
95
+ "record": record,
96
+ }
97
+
98
+ path.parent.mkdir(parents=True, exist_ok=True)
99
+ with open(path, "a") as f:
100
+ f.write(json.dumps(log_entry) + "\n")
101
+
102
+ return {
103
+ "result_status": "SUCCESS",
104
+ "record_id": record_id,
105
+ "sequence_number": sequence_number,
106
+ }
107
+
108
+ def read_all(self, payload: Dict[str, Any]) -> Dict[str, Any]:
109
+ """Read all entries from the log, optionally filtered by stream_id."""
110
+ path = self._resolve_storage_path(payload)
111
+ stream_id = payload.get("stream_id")
112
+ entries = []
113
+
114
+ if path.exists():
115
+ with open(path) as f:
116
+ for line in f:
117
+ entry = json.loads(line)
118
+ if stream_id is None or entry.get("stream_id") == stream_id:
119
+ entries.append(entry)
120
+
121
+ return {"result_status": "SUCCESS", "entries": entries}
122
+
123
+ def get_all(self, payload: Dict[str, Any]) -> Dict[str, Any]:
124
+ """GET_ALL — the contract-declared operation name for reading the whole log. The runtime host
125
+ dispatches `getattr(engine, op.lower())`, so the GET_ALL contract op resolves here; delegates to
126
+ the read_all implementation."""
127
+ return self.read_all(payload)
@@ -0,0 +1,48 @@
1
+ {
2
+ "cs_code": "CS_APPENDONLY_JSONL_V0",
3
+ "version": "v0",
4
+ "category": "storage",
5
+ "description": "Append-only JSONL persistence with ordered event history.",
6
+
7
+ "operations": {
8
+ "APPEND": {
9
+ "summary": "Append a record to the end of the log",
10
+ "input": ["record", "stream_id", "actor_id"],
11
+ "output": ["result_status", "record_id", "sequence_number"],
12
+ "handler": "append",
13
+ "idempotent": false,
14
+ "result_status_values": ["SUCCESS", "VIOLATION", "BACKEND_ERROR"],
15
+ "notes": "NOT idempotent - each call creates a new entry"
16
+ },
17
+
18
+ "GET_ALL": {
19
+ "summary": "Retrieve all records from the log",
20
+ "input": ["stream_id"],
21
+ "output": ["result_status", "entries"],
22
+ "handler": "read_all",
23
+ "idempotent": true,
24
+ "result_status_values": ["SUCCESS", "BACKEND_ERROR"],
25
+ "notes": "Returns array of all entries in append order"
26
+ },
27
+
28
+ "GET_RANGE": {
29
+ "summary": "Retrieve records within a sequence range",
30
+ "input": ["start_sequence", "end_sequence", "stream_id"],
31
+ "output": ["result_status", "entries"],
32
+ "handler": "read_range",
33
+ "idempotent": true,
34
+ "result_status_values": ["SUCCESS", "VIOLATION", "BACKEND_ERROR"],
35
+ "notes": "Inclusive range [start, end]"
36
+ },
37
+
38
+ "GET_SINCE": {
39
+ "summary": "Retrieve all records after a given timestamp",
40
+ "input": ["timestamp", "stream_id"],
41
+ "output": ["result_status", "entries"],
42
+ "handler": "read_since",
43
+ "idempotent": true,
44
+ "result_status_values": ["SUCCESS", "VIOLATION", "BACKEND_ERROR"],
45
+ "notes": "Useful for tailing logs and incremental reads"
46
+ }
47
+ }
48
+ }