pgc-transformation 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 (71) hide show
  1. pgc_transformation-2.0.0/LICENSE +67 -0
  2. pgc_transformation-2.0.0/NOTICE +11 -0
  3. pgc_transformation-2.0.0/PKG-INFO +274 -0
  4. pgc_transformation-2.0.0/README.md +246 -0
  5. pgc_transformation-2.0.0/pgc_transformation.egg-info/PKG-INFO +274 -0
  6. pgc_transformation-2.0.0/pgc_transformation.egg-info/SOURCES.txt +69 -0
  7. pgc_transformation-2.0.0/pgc_transformation.egg-info/dependency_links.txt +1 -0
  8. pgc_transformation-2.0.0/pgc_transformation.egg-info/entry_points.txt +2 -0
  9. pgc_transformation-2.0.0/pgc_transformation.egg-info/requires.txt +4 -0
  10. pgc_transformation-2.0.0/pgc_transformation.egg-info/top_level.txt +1 -0
  11. pgc_transformation-2.0.0/pyproject.toml +60 -0
  12. pgc_transformation-2.0.0/setup.cfg +4 -0
  13. pgc_transformation-2.0.0/transformation/__init__.py +5 -0
  14. pgc_transformation-2.0.0/transformation/__main__.py +4 -0
  15. pgc_transformation-2.0.0/transformation/baseline.py +134 -0
  16. pgc_transformation-2.0.0/transformation/build/__init__.py +0 -0
  17. pgc_transformation-2.0.0/transformation/build/completeness.py +176 -0
  18. pgc_transformation-2.0.0/transformation/build/generators.py +170 -0
  19. pgc_transformation-2.0.0/transformation/build/render.py +1194 -0
  20. pgc_transformation-2.0.0/transformation/cli.py +910 -0
  21. pgc_transformation-2.0.0/transformation/design/__init__.py +6 -0
  22. pgc_transformation-2.0.0/transformation/design/catalog.py +159 -0
  23. pgc_transformation-2.0.0/transformation/design/checks.py +2966 -0
  24. pgc_transformation-2.0.0/transformation/design/derive.py +207 -0
  25. pgc_transformation-2.0.0/transformation/design/emit.py +415 -0
  26. pgc_transformation-2.0.0/transformation/design/evaluate.py +172 -0
  27. pgc_transformation-2.0.0/transformation/design/families.py +96 -0
  28. pgc_transformation-2.0.0/transformation/design/merit.py +155 -0
  29. pgc_transformation-2.0.0/transformation/design/meta.py +348 -0
  30. pgc_transformation-2.0.0/transformation/design/oracle.py +96 -0
  31. pgc_transformation-2.0.0/transformation/design/p0_change_seed/__init__.py +0 -0
  32. pgc_transformation-2.0.0/transformation/design/p0_change_seed/rules.py +92 -0
  33. pgc_transformation-2.0.0/transformation/design/p1_change_request/__init__.py +0 -0
  34. pgc_transformation-2.0.0/transformation/design/p1_change_request/rules.py +153 -0
  35. pgc_transformation-2.0.0/transformation/design/p2_domain_model/__init__.py +0 -0
  36. pgc_transformation-2.0.0/transformation/design/p2_domain_model/rules.py +130 -0
  37. pgc_transformation-2.0.0/transformation/design/p3_analysis_loop/__init__.py +1 -0
  38. pgc_transformation-2.0.0/transformation/design/p3_analysis_loop/rules.py +210 -0
  39. pgc_transformation-2.0.0/transformation/design/p4_business_model/__init__.py +1 -0
  40. pgc_transformation-2.0.0/transformation/design/p4_business_model/rules.py +169 -0
  41. pgc_transformation-2.0.0/transformation/design/p5_business_intent/__init__.py +1 -0
  42. pgc_transformation-2.0.0/transformation/design/p5_business_intent/rules.py +247 -0
  43. pgc_transformation-2.0.0/transformation/design/p6_governance_intent/__init__.py +1 -0
  44. pgc_transformation-2.0.0/transformation/design/p6_governance_intent/rules.py +233 -0
  45. pgc_transformation-2.0.0/transformation/design/p7_design_intent/__init__.py +1 -0
  46. pgc_transformation-2.0.0/transformation/design/p7_design_intent/rules.py +1179 -0
  47. pgc_transformation-2.0.0/transformation/design/p8_authoring_mandate/__init__.py +1 -0
  48. pgc_transformation-2.0.0/transformation/design/p8_authoring_mandate/rules.py +236 -0
  49. pgc_transformation-2.0.0/transformation/design/project.py +178 -0
  50. pgc_transformation-2.0.0/transformation/design/read.py +155 -0
  51. pgc_transformation-2.0.0/transformation/design/rules.py +190 -0
  52. pgc_transformation-2.0.0/transformation/design/sealed.py +55 -0
  53. pgc_transformation-2.0.0/transformation/design/template_reader.py +277 -0
  54. pgc_transformation-2.0.0/transformation/implementation/__init__.py +0 -0
  55. pgc_transformation-2.0.0/transformation/implementation/capability_transforms/__init__.py +0 -0
  56. pgc_transformation-2.0.0/transformation/implementation/capability_transforms/atoms/__init__.py +0 -0
  57. pgc_transformation-2.0.0/transformation/implementation/capability_transforms/atoms/ct_pure_attribute_provenance_v0.py +73 -0
  58. pgc_transformation-2.0.0/transformation/implementation/capability_transforms/atoms/ct_pure_evaluate_rules_v0.py +97 -0
  59. pgc_transformation-2.0.0/transformation/implementation/capability_transforms/atoms/ct_pure_measure_completeness_v0.py +72 -0
  60. pgc_transformation-2.0.0/transformation/implementation/capability_transforms/atoms/ct_pure_parse_prior_phases_v0.py +64 -0
  61. pgc_transformation-2.0.0/transformation/implementation/capability_transforms/atoms/ct_pure_parse_registers_v0.py +53 -0
  62. pgc_transformation-2.0.0/transformation/implementation/capability_transforms/atoms/ct_pure_render_artifacts_v0.py +66 -0
  63. pgc_transformation-2.0.0/transformation/templates/p0_change_seed_template_v0.md +250 -0
  64. pgc_transformation-2.0.0/transformation/templates/p1_change_request_template_v0.md +349 -0
  65. pgc_transformation-2.0.0/transformation/templates/p2_domain_model_template_v0.md +272 -0
  66. pgc_transformation-2.0.0/transformation/templates/p3_analysis_loop_template_v0.md +196 -0
  67. pgc_transformation-2.0.0/transformation/templates/p4_business_model_template_v0.md +238 -0
  68. pgc_transformation-2.0.0/transformation/templates/p5_business_intent_template_v0.md +216 -0
  69. pgc_transformation-2.0.0/transformation/templates/p6_governance_intent_template_v0.md +205 -0
  70. pgc_transformation-2.0.0/transformation/templates/p7_design_intent_template_v0.md +547 -0
  71. pgc_transformation-2.0.0/transformation/templates/p8_authoring_mandate_template_v0.md +172 -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,274 @@
1
+ Metadata-Version: 2.4
2
+ Name: pgc-transformation
3
+ Version: 2.0.0
4
+ Summary: PGC transformation compiler — the governed change request to authoring mandate pipeline (P0-P8), and the construction compiler that renders artifacts from an approved design (command: tc)
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/transformation
9
+ Project-URL: Standard, https://doi.org/10.5281/zenodo.22150616
10
+ Keywords: protocol-governed-computing,pgc,transformation,change-request,evolution
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Topic :: Software Development :: Compilers
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ License-File: NOTICE
23
+ Requires-Dist: pgc-inspector>=2.0.0
24
+ Requires-Dist: pgc-runtime>=2.0.0
25
+ Requires-Dist: click
26
+ Requires-Dist: pyyaml
27
+ Dynamic: license-file
28
+
29
+ # transformation
30
+
31
+ **The governed Change Request → Protocol Artifact pipeline**, and it holds **two compilers**.
32
+
33
+ | Compiler | Transforms | Code | Registry |
34
+ |---|---|---|---|
35
+ | **Design** | problem → design | `transformation/design/` | `registry/design/` |
36
+ | **Construction** | design → protocol artifacts | `transformation/build/` | `registry/build/` |
37
+
38
+ They are two because they fail differently. A *design* failure is a mandate that is incomplete or
39
+ contradictory, and a phase's rule set catches it. A *construction* failure is a mandate that was
40
+ valid and did not uniquely determine an artifact — only the thing that renders can expose that, and
41
+ the repair amends the design language rather than one register. Merging them would blur two failure
42
+ classes that different layers repair.
43
+
44
+ The repository is named for the lifecycle, not for either compiler. **`transformation` is not a
45
+ third compiler.** A functional rehost of RI-0's `pgs_change_mgmt`, extended well past where RI-0
46
+ stopped.
47
+
48
+ A change begins as a plain-language problem statement and is driven through gated phases into an
49
+ **Authoring Mandate** — a complete, reviewable dossier — *before* any protocol artifact is written.
50
+ Only after the mandate is approved are artifacts authored, and the protocol compiler then governs
51
+ their admissibility.
52
+
53
+ ```
54
+ problem statement → P0 → Gate 0 → seed → dossier P1..P7 → Gate 1 → P8 → Gate 2
55
+ → construction → authored artifacts
56
+ → protocol_compiler S1..S9 → snapshot_assembler → conformance → runtime → trace
57
+ ```
58
+
59
+ This pipeline is measured in **phases (P0–P8)**; `protocol_compiler` is measured in **stages
60
+ (S1–S9)**. RI-0 numbered both S1–S7/S1–S9, which made every piece of evidence ambiguous about which
61
+ pipeline produced it. A dossier has phases, a compilation has stages, and nothing uses one word for
62
+ the other.
63
+
64
+ ## Install
65
+
66
+ ```bash
67
+ pip install pgc-transformation
68
+ ```
69
+
70
+ Once installed:
71
+
72
+ ```bash
73
+ tc --help
74
+ ```
75
+
76
+ ## Build-time tool
77
+
78
+ `transformation` is **CLI only** — no TI/TE boundary contract, no Operation Identity, not
79
+ reachable over transport. A boundary contract governs a runtime surface served from a sealed
80
+ snapshot; this tool runs *before* a snapshot exists, its output is authored artifacts a human
81
+ gates, and its only reader is the person driving the change.
82
+
83
+ ```bash
84
+ tc phase list # phases this build governs
85
+ tc phase check --phase p0 <seed.md> # structural oracle — ADMISSIBLE / INADMISSIBLE
86
+ tc phase check --phase p1 <register.md>
87
+ tc phase check --phase p2 <register.md> --snapshot <root> # grounds against the composition
88
+ tc phase template --phase p1 # the required section structure
89
+ tc phase rules --phase p1 # the declared rule set
90
+ tc phase project <prior.md> --phase p1 --out <doc.md> # phases that decide nothing
91
+
92
+ tc phase meta # do the rule sets themselves hold?
93
+ tc phase emit --check # are the sealed workflows current?
94
+
95
+ tc baseline show --snapshot <root> # the composition present, as a pin
96
+ tc baseline verify <pin.json> --snapshot <root>
97
+ tc baseline approve <pin.json> --phase p2 --by <who>
98
+
99
+ tc construction check <dossier> --snapshot <root> # does the design determine its artifacts?
100
+ tc construction emit <dossier> --root <domain> # render them, at 100% or not at all
101
+ ```
102
+
103
+ Two of these judge the pipeline rather than a dossier. `tc phase meta` asserts that every declared
104
+ rule can run and every implemented mechanism is declared — if that correspondence breaks, a verdict
105
+ over a document is meaningless, because a rule that cannot run reports green over a subject it never
106
+ evaluated. `tc phase emit --check` asserts the sealed copy of a rule set still agrees with the
107
+ generator that produces it; a rule added after a workflow was emitted once left 52 rules sealed
108
+ against 55 declared, and every run reported confidently on the smaller set. Both belong in a build.
109
+
110
+ `tc construction check` measures **determinacy** before anything is written: the fraction of the
111
+ facts the artifacts require that the design determines. Below 100% nothing is emitted, because a
112
+ generator choosing a value it was not given is a generator inventing one.
113
+
114
+ ## The two loops
115
+
116
+ `$W` is the workspace root holding the sibling repos.
117
+
118
+ **After editing a dossier's P7 or P8** — skipping a step leaves the snapshot describing a design that
119
+ no longer exists:
120
+
121
+ ```bash
122
+ D=$W/business_domains/book_library_mgmt/cr_dossiers/cr_01_catalog
123
+
124
+ tc construction check $D --snapshot $W/snapshot
125
+ tc construction emit $D --root $W/business_domains/book_library_mgmt
126
+
127
+ python $W/transformation/scripts/testbed/construction_acceptance.py
128
+ $W/protocol_compiler/compile_domain.sh $W/business_domains/book_library_mgmt
129
+ PGC_SNAPSHOT_PROFILE=REFERENCE_PLATFORM_PROFILE_V1 $W/snapshot_assembler/assemble.sh
130
+ ```
131
+
132
+ `--snapshot` on the check is not optional in practice. Completeness never looks at what already
133
+ exists, so an artifact inventoried `EXTEND` is rendered whole and replaces its predecessor — a design
134
+ stating only the delta deletes the rest, at 100% completeness. The flag is what runs the narrowing
135
+ check; without it that check does not run, and says so.
136
+
137
+ Construction writes into `data/`, never into the domain. **Promotion is a separate, deliberate act.**
138
+ A `tc construction build` CLI existed once and was removed, because it duplicated a governed path
139
+ with an ungoverned one.
140
+
141
+ A new capability transform is a protocol artifact *and* a Python implementation. Construction renders
142
+ the first; the second is hand-authored at
143
+ `business_domains/<domain>/implementation/capability_transforms/atoms/<code_lower>.py` with a
144
+ callable `execute(inputs, context)` raising `CTExecutionError`. A CT whose module is missing returns
145
+ nothing and its contract yields `VIOLATION` — while every check above still passes.
146
+
147
+ **After changing a phase's rule set** — the rules are declared in
148
+ `transformation/design/<phase>/rules.py` and *sealed* into that phase's workflow artifact. Editing
149
+ the declaration alone leaves `tc phase check` and the governed workflow evaluating different rule
150
+ sets:
151
+
152
+ ```bash
153
+ tc phase emit --check # names the drifted phase
154
+ python $W/transformation/scripts/emit_rule_sets.py # re-seal
155
+ $W/protocol_compiler/compile_domain.sh $W/transformation
156
+ PGC_SNAPSHOT_PROFILE=REFERENCE_PLATFORM_PROFILE_V1 $W/snapshot_assembler/assemble.sh
157
+ python $W/transformation/scripts/testbed/build_fixtures.py
158
+ python $W/transformation/scripts/testbed/build_payloads.py
159
+ ```
160
+
161
+ Fixtures and payloads are **derived from the live dossier** — never hand-edit one; change the dossier
162
+ or the mutator in `build_fixtures.py`. A derived fixture cannot go stale silently, because the
163
+ derivation raises rather than producing a wrong one.
164
+
165
+ The fast inner loop is `python scripts/testbed/differential.py`, which drives the capability
166
+ transforms directly. It proves the rule sets and the check logic and nothing about workflow wiring;
167
+ `scripts/testbed/e2e_phases_test.py` boots the assembled snapshot and proves the wiring. Neither
168
+ substitutes for the other — a workflow that bound `$.capability_result.header` across nodes passed
169
+ the differential and failed immediately under the runtime.
170
+
171
+ From P2 a phase also needs its **priors**, or the handoff between phases goes unchecked:
172
+ P1←p0 · P2←p1 · P3←p2 · P4←p3 · **P5←p0** · P6←p5 · P7←p5+p6 · P8←p7. P5 reads the seed, not P4: the
173
+ subdomain purpose is authored once at P0, has no register to travel in through P1–P4, and reappears
174
+ at P5.
175
+
176
+ ## Why "transformation", not "change management"
177
+
178
+ **PGC evolution is never greenfield.** Every change is a transformation of an existing composition:
179
+ a new domain still compiles against the platform's normative closure and composes into a snapshot
180
+ that already exists. The name states what the tool does; `change_mgmt` named the process around it.
181
+
182
+ That property is also what makes the tool testable. Its distinguishing logic — REUSE / EXTEND
183
+ decisions, placement, ownership, semantic preservation, roundtrip equivalence — is meaningful only
184
+ against a baseline. A greenfield run exercises none of it.
185
+
186
+ ## Relationship to the rest of the toolchain
187
+
188
+ ```
189
+ protocol_compiler source → compiled projections
190
+ snapshot_assembler projections → assembled snapshot
191
+ protocol_runtime snapshot → execution
192
+ snapshot_inspector snapshot → inspection
193
+ transformation problem → change request → authoring mandate (this repo)
194
+ ```
195
+
196
+ Every snapshot fact this pipeline needs arrives through
197
+ `inspector.api.query(operation, params, snapshot_root)`. It imports nothing from `compiler.*`.
198
+ RI-0's pipeline reached directly into `pgs_compiler.compiler.projections` to build indexes itself;
199
+ removing that coupling is why `snapshot_inspector` was completed first, and building this repo
200
+ without it is that work's acceptance test.
201
+
202
+ ## Validation is pinned
203
+
204
+ Runs are validated against a **named, frozen snapshot**, never "the current snapshot" — every
205
+ register a snapshot-reading phase emits encodes facts about one specific composition. A run that
206
+ observes a different `snapshot_id` fails before any phase executes.
207
+
208
+ Rebaselining is deliberate and has two halves. `tc baseline verify` proves the composition is the
209
+ one named; `tc baseline approve` records that someone re-read the registers asserting facts about
210
+ it. Which registers a phase owes is derived from its rule set — a register rests on a snapshot fact
211
+ exactly when a rule governing it consults an observation. The approval lives in the pin, so re-pinning
212
+ drops it: an approval is against one composition and survives no other.
213
+
214
+ ## Documents
215
+
216
+ - `doc/THE_SHAPE_OF_A_CHANGE_V0.md` — when a subject is a new change request and when it is the
217
+ same one re-authored, and which artifacts a governance change may amend.
218
+ - `doc/TRANSFORMATION_COMPILER_PLAN_V1_ADDENDUM_A.md` — the `book_library_mgmt` domain, its
219
+ decomposition, and the change request sequence it is worked through.
220
+ - `doc/TRANSFORMATION_COMPILER_PLAN_V1_ADDENDUM_B.md` — self-hosting: why the pipeline's first
221
+ governed change is itself, and what that settles. Plan V1 itself has been removed; the addenda are
222
+ what survives, and a settled ruling is restated where it is needed rather than by restoring the
223
+ plan.
224
+ - `doc/REGISTER_COVERAGE_VERIFICATION.md` — whether a design can state, for an artifact it amends,
225
+ every fact that artifact carries. Four observed instances of one pattern: a fact the authoring
226
+ path never had to state because authoring supplies it, and the amending path must state and
227
+ cannot.
228
+ - `templates/` — the phase templates. **These are the authority**: registers, columns, controlled
229
+ vocabularies and optionality are read from them, and rule sets are derived. A shape declared
230
+ anywhere else is not a template.
231
+
232
+ ---
233
+
234
+ ## The package family
235
+
236
+ | Package | Repository | Role |
237
+ |---|---|---|
238
+ | `pgc-compiler` | `protocol_compiler` | declarations → compiled projections |
239
+ | `pgc-assembler` | `snapshot_assembler` | projections → sealed snapshot |
240
+ | `pgc-runtime` | `protocol_runtime` | snapshot → governed execution |
241
+ | `pgc-inspector` | `snapshot_inspector` | snapshot → read-only inspection |
242
+ | `pgc-transformation` | `transformation` | change request → protocol artifacts |
243
+ | `pgc-governance` | `software_governance` | the governance surface and its capability implementations |
244
+ | `pgc-workloads` | `conformance_workloads` | the workloads that make conformance observable |
245
+ | `pgc-domains` | `business_domains` | the business domain implementations the composed snapshot binds |
246
+
247
+ `pip install pgc` brings in the whole family.
248
+
249
+ **Installing the toolchain is one of two steps.** The compiler resolves the governance surface from
250
+ `PGC_PLATFORM_ROOT` — fail-hard, cwd-independent, zero inference — so the *declarations* come from a
251
+ repository you point at, never from a wheel. A registry inside a package would be a second governance
252
+ surface competing with the repository's, and a build could then be governed by a stale copy.
253
+
254
+ ```bash
255
+ git clone https://github.com/protocol-governed-computing/software_governance
256
+ export PGC_PLATFORM_ROOT=$PWD/software_governance
257
+ pgc # reports what is installed and whether the anchor resolves
258
+ ```
259
+
260
+ `PGC_BUILD_ROOT` (compiled output, keeping the governance repo read-only) and `PGC_DOMAIN_ROOTS`
261
+ (additional domains contributing their own `registry/structures`) are optional.
262
+
263
+ **Versioning.** Two schemes, and the published version follows the second.
264
+
265
+ - **Internal** — each repository's `VERSION` file, a monotonic composition ordinal. PGC versions the
266
+ composition rather than each repo: they release together and the governance closure forces lockstep,
267
+ so the ordinal names which composition a repo belongs to. Development happens on `dev/<N>` and each
268
+ cycle is tagged `release-<N>`. This is not published.
269
+ - **Public** — `PUBLIC_VERSION`, tagged on every component repository. The platform is at **`v2`**.
270
+
271
+ **The published version is the public one: `v2` is `2.0.0`.** The standard the packages implement is a
272
+ separate artifact on its own track and is not this number.
273
+
274
+ The standard these packages implement is published separately: https://doi.org/10.5281/zenodo.22150616
@@ -0,0 +1,246 @@
1
+ # transformation
2
+
3
+ **The governed Change Request → Protocol Artifact pipeline**, and it holds **two compilers**.
4
+
5
+ | Compiler | Transforms | Code | Registry |
6
+ |---|---|---|---|
7
+ | **Design** | problem → design | `transformation/design/` | `registry/design/` |
8
+ | **Construction** | design → protocol artifacts | `transformation/build/` | `registry/build/` |
9
+
10
+ They are two because they fail differently. A *design* failure is a mandate that is incomplete or
11
+ contradictory, and a phase's rule set catches it. A *construction* failure is a mandate that was
12
+ valid and did not uniquely determine an artifact — only the thing that renders can expose that, and
13
+ the repair amends the design language rather than one register. Merging them would blur two failure
14
+ classes that different layers repair.
15
+
16
+ The repository is named for the lifecycle, not for either compiler. **`transformation` is not a
17
+ third compiler.** A functional rehost of RI-0's `pgs_change_mgmt`, extended well past where RI-0
18
+ stopped.
19
+
20
+ A change begins as a plain-language problem statement and is driven through gated phases into an
21
+ **Authoring Mandate** — a complete, reviewable dossier — *before* any protocol artifact is written.
22
+ Only after the mandate is approved are artifacts authored, and the protocol compiler then governs
23
+ their admissibility.
24
+
25
+ ```
26
+ problem statement → P0 → Gate 0 → seed → dossier P1..P7 → Gate 1 → P8 → Gate 2
27
+ → construction → authored artifacts
28
+ → protocol_compiler S1..S9 → snapshot_assembler → conformance → runtime → trace
29
+ ```
30
+
31
+ This pipeline is measured in **phases (P0–P8)**; `protocol_compiler` is measured in **stages
32
+ (S1–S9)**. RI-0 numbered both S1–S7/S1–S9, which made every piece of evidence ambiguous about which
33
+ pipeline produced it. A dossier has phases, a compilation has stages, and nothing uses one word for
34
+ the other.
35
+
36
+ ## Install
37
+
38
+ ```bash
39
+ pip install pgc-transformation
40
+ ```
41
+
42
+ Once installed:
43
+
44
+ ```bash
45
+ tc --help
46
+ ```
47
+
48
+ ## Build-time tool
49
+
50
+ `transformation` is **CLI only** — no TI/TE boundary contract, no Operation Identity, not
51
+ reachable over transport. A boundary contract governs a runtime surface served from a sealed
52
+ snapshot; this tool runs *before* a snapshot exists, its output is authored artifacts a human
53
+ gates, and its only reader is the person driving the change.
54
+
55
+ ```bash
56
+ tc phase list # phases this build governs
57
+ tc phase check --phase p0 <seed.md> # structural oracle — ADMISSIBLE / INADMISSIBLE
58
+ tc phase check --phase p1 <register.md>
59
+ tc phase check --phase p2 <register.md> --snapshot <root> # grounds against the composition
60
+ tc phase template --phase p1 # the required section structure
61
+ tc phase rules --phase p1 # the declared rule set
62
+ tc phase project <prior.md> --phase p1 --out <doc.md> # phases that decide nothing
63
+
64
+ tc phase meta # do the rule sets themselves hold?
65
+ tc phase emit --check # are the sealed workflows current?
66
+
67
+ tc baseline show --snapshot <root> # the composition present, as a pin
68
+ tc baseline verify <pin.json> --snapshot <root>
69
+ tc baseline approve <pin.json> --phase p2 --by <who>
70
+
71
+ tc construction check <dossier> --snapshot <root> # does the design determine its artifacts?
72
+ tc construction emit <dossier> --root <domain> # render them, at 100% or not at all
73
+ ```
74
+
75
+ Two of these judge the pipeline rather than a dossier. `tc phase meta` asserts that every declared
76
+ rule can run and every implemented mechanism is declared — if that correspondence breaks, a verdict
77
+ over a document is meaningless, because a rule that cannot run reports green over a subject it never
78
+ evaluated. `tc phase emit --check` asserts the sealed copy of a rule set still agrees with the
79
+ generator that produces it; a rule added after a workflow was emitted once left 52 rules sealed
80
+ against 55 declared, and every run reported confidently on the smaller set. Both belong in a build.
81
+
82
+ `tc construction check` measures **determinacy** before anything is written: the fraction of the
83
+ facts the artifacts require that the design determines. Below 100% nothing is emitted, because a
84
+ generator choosing a value it was not given is a generator inventing one.
85
+
86
+ ## The two loops
87
+
88
+ `$W` is the workspace root holding the sibling repos.
89
+
90
+ **After editing a dossier's P7 or P8** — skipping a step leaves the snapshot describing a design that
91
+ no longer exists:
92
+
93
+ ```bash
94
+ D=$W/business_domains/book_library_mgmt/cr_dossiers/cr_01_catalog
95
+
96
+ tc construction check $D --snapshot $W/snapshot
97
+ tc construction emit $D --root $W/business_domains/book_library_mgmt
98
+
99
+ python $W/transformation/scripts/testbed/construction_acceptance.py
100
+ $W/protocol_compiler/compile_domain.sh $W/business_domains/book_library_mgmt
101
+ PGC_SNAPSHOT_PROFILE=REFERENCE_PLATFORM_PROFILE_V1 $W/snapshot_assembler/assemble.sh
102
+ ```
103
+
104
+ `--snapshot` on the check is not optional in practice. Completeness never looks at what already
105
+ exists, so an artifact inventoried `EXTEND` is rendered whole and replaces its predecessor — a design
106
+ stating only the delta deletes the rest, at 100% completeness. The flag is what runs the narrowing
107
+ check; without it that check does not run, and says so.
108
+
109
+ Construction writes into `data/`, never into the domain. **Promotion is a separate, deliberate act.**
110
+ A `tc construction build` CLI existed once and was removed, because it duplicated a governed path
111
+ with an ungoverned one.
112
+
113
+ A new capability transform is a protocol artifact *and* a Python implementation. Construction renders
114
+ the first; the second is hand-authored at
115
+ `business_domains/<domain>/implementation/capability_transforms/atoms/<code_lower>.py` with a
116
+ callable `execute(inputs, context)` raising `CTExecutionError`. A CT whose module is missing returns
117
+ nothing and its contract yields `VIOLATION` — while every check above still passes.
118
+
119
+ **After changing a phase's rule set** — the rules are declared in
120
+ `transformation/design/<phase>/rules.py` and *sealed* into that phase's workflow artifact. Editing
121
+ the declaration alone leaves `tc phase check` and the governed workflow evaluating different rule
122
+ sets:
123
+
124
+ ```bash
125
+ tc phase emit --check # names the drifted phase
126
+ python $W/transformation/scripts/emit_rule_sets.py # re-seal
127
+ $W/protocol_compiler/compile_domain.sh $W/transformation
128
+ PGC_SNAPSHOT_PROFILE=REFERENCE_PLATFORM_PROFILE_V1 $W/snapshot_assembler/assemble.sh
129
+ python $W/transformation/scripts/testbed/build_fixtures.py
130
+ python $W/transformation/scripts/testbed/build_payloads.py
131
+ ```
132
+
133
+ Fixtures and payloads are **derived from the live dossier** — never hand-edit one; change the dossier
134
+ or the mutator in `build_fixtures.py`. A derived fixture cannot go stale silently, because the
135
+ derivation raises rather than producing a wrong one.
136
+
137
+ The fast inner loop is `python scripts/testbed/differential.py`, which drives the capability
138
+ transforms directly. It proves the rule sets and the check logic and nothing about workflow wiring;
139
+ `scripts/testbed/e2e_phases_test.py` boots the assembled snapshot and proves the wiring. Neither
140
+ substitutes for the other — a workflow that bound `$.capability_result.header` across nodes passed
141
+ the differential and failed immediately under the runtime.
142
+
143
+ From P2 a phase also needs its **priors**, or the handoff between phases goes unchecked:
144
+ P1←p0 · P2←p1 · P3←p2 · P4←p3 · **P5←p0** · P6←p5 · P7←p5+p6 · P8←p7. P5 reads the seed, not P4: the
145
+ subdomain purpose is authored once at P0, has no register to travel in through P1–P4, and reappears
146
+ at P5.
147
+
148
+ ## Why "transformation", not "change management"
149
+
150
+ **PGC evolution is never greenfield.** Every change is a transformation of an existing composition:
151
+ a new domain still compiles against the platform's normative closure and composes into a snapshot
152
+ that already exists. The name states what the tool does; `change_mgmt` named the process around it.
153
+
154
+ That property is also what makes the tool testable. Its distinguishing logic — REUSE / EXTEND
155
+ decisions, placement, ownership, semantic preservation, roundtrip equivalence — is meaningful only
156
+ against a baseline. A greenfield run exercises none of it.
157
+
158
+ ## Relationship to the rest of the toolchain
159
+
160
+ ```
161
+ protocol_compiler source → compiled projections
162
+ snapshot_assembler projections → assembled snapshot
163
+ protocol_runtime snapshot → execution
164
+ snapshot_inspector snapshot → inspection
165
+ transformation problem → change request → authoring mandate (this repo)
166
+ ```
167
+
168
+ Every snapshot fact this pipeline needs arrives through
169
+ `inspector.api.query(operation, params, snapshot_root)`. It imports nothing from `compiler.*`.
170
+ RI-0's pipeline reached directly into `pgs_compiler.compiler.projections` to build indexes itself;
171
+ removing that coupling is why `snapshot_inspector` was completed first, and building this repo
172
+ without it is that work's acceptance test.
173
+
174
+ ## Validation is pinned
175
+
176
+ Runs are validated against a **named, frozen snapshot**, never "the current snapshot" — every
177
+ register a snapshot-reading phase emits encodes facts about one specific composition. A run that
178
+ observes a different `snapshot_id` fails before any phase executes.
179
+
180
+ Rebaselining is deliberate and has two halves. `tc baseline verify` proves the composition is the
181
+ one named; `tc baseline approve` records that someone re-read the registers asserting facts about
182
+ it. Which registers a phase owes is derived from its rule set — a register rests on a snapshot fact
183
+ exactly when a rule governing it consults an observation. The approval lives in the pin, so re-pinning
184
+ drops it: an approval is against one composition and survives no other.
185
+
186
+ ## Documents
187
+
188
+ - `doc/THE_SHAPE_OF_A_CHANGE_V0.md` — when a subject is a new change request and when it is the
189
+ same one re-authored, and which artifacts a governance change may amend.
190
+ - `doc/TRANSFORMATION_COMPILER_PLAN_V1_ADDENDUM_A.md` — the `book_library_mgmt` domain, its
191
+ decomposition, and the change request sequence it is worked through.
192
+ - `doc/TRANSFORMATION_COMPILER_PLAN_V1_ADDENDUM_B.md` — self-hosting: why the pipeline's first
193
+ governed change is itself, and what that settles. Plan V1 itself has been removed; the addenda are
194
+ what survives, and a settled ruling is restated where it is needed rather than by restoring the
195
+ plan.
196
+ - `doc/REGISTER_COVERAGE_VERIFICATION.md` — whether a design can state, for an artifact it amends,
197
+ every fact that artifact carries. Four observed instances of one pattern: a fact the authoring
198
+ path never had to state because authoring supplies it, and the amending path must state and
199
+ cannot.
200
+ - `templates/` — the phase templates. **These are the authority**: registers, columns, controlled
201
+ vocabularies and optionality are read from them, and rule sets are derived. A shape declared
202
+ anywhere else is not a template.
203
+
204
+ ---
205
+
206
+ ## The package family
207
+
208
+ | Package | Repository | Role |
209
+ |---|---|---|
210
+ | `pgc-compiler` | `protocol_compiler` | declarations → compiled projections |
211
+ | `pgc-assembler` | `snapshot_assembler` | projections → sealed snapshot |
212
+ | `pgc-runtime` | `protocol_runtime` | snapshot → governed execution |
213
+ | `pgc-inspector` | `snapshot_inspector` | snapshot → read-only inspection |
214
+ | `pgc-transformation` | `transformation` | change request → protocol artifacts |
215
+ | `pgc-governance` | `software_governance` | the governance surface and its capability implementations |
216
+ | `pgc-workloads` | `conformance_workloads` | the workloads that make conformance observable |
217
+ | `pgc-domains` | `business_domains` | the business domain implementations the composed snapshot binds |
218
+
219
+ `pip install pgc` brings in the whole family.
220
+
221
+ **Installing the toolchain is one of two steps.** The compiler resolves the governance surface from
222
+ `PGC_PLATFORM_ROOT` — fail-hard, cwd-independent, zero inference — so the *declarations* come from a
223
+ repository you point at, never from a wheel. A registry inside a package would be a second governance
224
+ surface competing with the repository's, and a build could then be governed by a stale copy.
225
+
226
+ ```bash
227
+ git clone https://github.com/protocol-governed-computing/software_governance
228
+ export PGC_PLATFORM_ROOT=$PWD/software_governance
229
+ pgc # reports what is installed and whether the anchor resolves
230
+ ```
231
+
232
+ `PGC_BUILD_ROOT` (compiled output, keeping the governance repo read-only) and `PGC_DOMAIN_ROOTS`
233
+ (additional domains contributing their own `registry/structures`) are optional.
234
+
235
+ **Versioning.** Two schemes, and the published version follows the second.
236
+
237
+ - **Internal** — each repository's `VERSION` file, a monotonic composition ordinal. PGC versions the
238
+ composition rather than each repo: they release together and the governance closure forces lockstep,
239
+ so the ordinal names which composition a repo belongs to. Development happens on `dev/<N>` and each
240
+ cycle is tagged `release-<N>`. This is not published.
241
+ - **Public** — `PUBLIC_VERSION`, tagged on every component repository. The platform is at **`v2`**.
242
+
243
+ **The published version is the public one: `v2` is `2.0.0`.** The standard the packages implement is a
244
+ separate artifact on its own track and is not this number.
245
+
246
+ The standard these packages implement is published separately: https://doi.org/10.5281/zenodo.22150616