ssot-core 0.2.26.dev1__tar.gz → 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 (158) hide show
  1. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/PKG-INFO +8 -7
  2. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/pyproject.toml +9 -7
  3. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_core.egg-info/PKG-INFO +8 -7
  4. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_core.egg-info/SOURCES.txt +7 -0
  5. ssot_core-0.3.0/src/ssot_core.egg-info/requires.txt +7 -0
  6. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/__init__.py +3 -0
  7. ssot_core-0.3.0/src/ssot_registry/api/boundary.py +94 -0
  8. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/config.py +13 -9
  9. ssot_core-0.3.0/src/ssot_registry/api/document_catalog.py +303 -0
  10. ssot_core-0.3.0/src/ssot_registry/api/document_proof.py +189 -0
  11. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/documents.py +5 -1
  12. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/entity_ops.py +3 -3
  13. ssot_core-0.3.0/src/ssot_registry/api/init.py +86 -0
  14. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/local_assurance.py +16 -0
  15. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/packs.py +26 -0
  16. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/proof_graph.py +92 -9
  17. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/release.py +39 -7
  18. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/save.py +12 -2
  19. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/status_sync.py +45 -12
  20. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/upgrade.py +23 -2
  21. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/validate.py +20 -1
  22. ssot_core-0.3.0/src/ssot_registry/api/workspace.py +240 -0
  23. ssot_core-0.3.0/src/ssot_registry/api/workspace_proof.py +365 -0
  24. ssot_core-0.3.0/src/ssot_registry/api/workspace_sync.py +231 -0
  25. ssot_core-0.3.0/src/ssot_registry/api/workspace_upgrade.py +289 -0
  26. ssot_core-0.3.0/src/ssot_registry/api/workspace_views.py +92 -0
  27. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/assets/lineage_graph/manifest.json +1 -1
  28. ssot_core-0.3.0/src/ssot_registry/assets/lineage_graph/ssot-lineage-graph.css +1 -0
  29. ssot_core-0.3.0/src/ssot_registry/assets/lineage_graph/ssot-lineage-graph.js +84 -0
  30. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/control/scaffold.py +4 -4
  31. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/util/fs.py +1 -0
  32. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/util/registry_lock.py +63 -17
  33. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/validators/documents.py +19 -3
  34. ssot_core-0.2.26.dev1/src/ssot_core.egg-info/requires.txt +0 -7
  35. ssot_core-0.2.26.dev1/src/ssot_registry/api/boundary.py +0 -55
  36. ssot_core-0.2.26.dev1/src/ssot_registry/api/init.py +0 -55
  37. ssot_core-0.2.26.dev1/src/ssot_registry/assets/lineage_graph/ssot-lineage-graph.css +0 -1
  38. ssot_core-0.2.26.dev1/src/ssot_registry/assets/lineage_graph/ssot-lineage-graph.js +0 -84
  39. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/README.md +0 -0
  40. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/setup.cfg +0 -0
  41. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_core.egg-info/dependency_links.txt +0 -0
  42. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_core.egg-info/top_level.txt +0 -0
  43. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/__init__.py +0 -0
  44. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/__main__.py +0 -0
  45. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/acl/__init__.py +0 -0
  46. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/acl/policy.py +0 -0
  47. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/acl/wrapper.py +0 -0
  48. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/claims.py +0 -0
  49. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/evidence.py +0 -0
  50. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/graph.py +0 -0
  51. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/lifecycle.py +0 -0
  52. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/load.py +0 -0
  53. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/origin.py +0 -0
  54. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/plan.py +0 -0
  55. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/profile_eval.py +0 -0
  56. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/profile_resolution.py +0 -0
  57. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/registry.py +0 -0
  58. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/api/test_execution.py +0 -0
  59. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/assets/__init__.py +0 -0
  60. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/assets/lineage_graph/__init__.py +0 -0
  61. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/cli/__init__.py +0 -0
  62. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/cli/adr_cmd.py +0 -0
  63. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/cli/boundary_cmd.py +0 -0
  64. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/cli/claim_cmd.py +0 -0
  65. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/cli/common.py +0 -0
  66. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/cli/evidence_cmd.py +0 -0
  67. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/cli/feature_cmd.py +0 -0
  68. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/cli/graph_cmd.py +0 -0
  69. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/cli/init_cmd.py +0 -0
  70. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/cli/issue_cmd.py +0 -0
  71. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/cli/main.py +0 -0
  72. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/cli/profile_cmd.py +0 -0
  73. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/cli/registry_cmd.py +0 -0
  74. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/cli/release_cmd.py +0 -0
  75. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/cli/risk_cmd.py +0 -0
  76. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/cli/spec_cmd.py +0 -0
  77. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/cli/test_cmd.py +0 -0
  78. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/cli/upgrade_cmd.py +0 -0
  79. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/cli/validate_cmd.py +0 -0
  80. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/control/__init__.py +0 -0
  81. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/control/events.py +0 -0
  82. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/control/models.py +0 -0
  83. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/control/paths.py +0 -0
  84. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/control/service.py +0 -0
  85. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/control/sqlite_store.py +0 -0
  86. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/control/sse.py +0 -0
  87. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/graph/__init__.py +0 -0
  88. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/graph/export_dot.py +0 -0
  89. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/graph/export_json.py +0 -0
  90. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/guards/__init__.py +0 -0
  91. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/guards/certification.py +0 -0
  92. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/guards/claim_closure.py +0 -0
  93. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/guards/claim_tier_gates.py +0 -0
  94. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/guards/completion.py +0 -0
  95. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/guards/document_lifecycle.py +0 -0
  96. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/guards/document_supersession.py +0 -0
  97. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/guards/feature_claims.py +0 -0
  98. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/guards/feature_requirements.py +0 -0
  99. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/guards/lifecycle.py +0 -0
  100. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/guards/profile_requirements.py +0 -0
  101. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/guards/promotion.py +0 -0
  102. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/guards/publication.py +0 -0
  103. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/maturation/__init__.py +0 -0
  104. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/maturation/selector.py +0 -0
  105. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/model/__init__.py +0 -0
  106. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/model/boundary.py +0 -0
  107. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/model/claim.py +0 -0
  108. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/model/document.py +0 -0
  109. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/model/enums.py +0 -0
  110. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/model/evidence.py +0 -0
  111. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/model/feature.py +0 -0
  112. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/model/ids.py +0 -0
  113. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/model/issue.py +0 -0
  114. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/model/profile.py +0 -0
  115. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/model/registry.py +0 -0
  116. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/model/release.py +0 -0
  117. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/model/risk.py +0 -0
  118. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/model/schema_version.py +0 -0
  119. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/model/test.py +0 -0
  120. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/proof_links.py +0 -0
  121. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/reports/__init__.py +0 -0
  122. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/reports/certification_report.py +0 -0
  123. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/reports/summary.py +0 -0
  124. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/reports/validation_report.py +0 -0
  125. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/snapshots/__init__.py +0 -0
  126. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/snapshots/boundary_snapshot.py +0 -0
  127. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/snapshots/hashing.py +0 -0
  128. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/snapshots/published_snapshot.py +0 -0
  129. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/snapshots/release_snapshot.py +0 -0
  130. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/templates/__init__.py +0 -0
  131. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/templates/registry.full.json +0 -0
  132. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/templates/registry.minimal.json +0 -0
  133. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/util/__init__.py +0 -0
  134. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/util/document_io.py +0 -0
  135. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/util/errors.py +0 -0
  136. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/util/formatting.py +0 -0
  137. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/util/jcs.py +0 -0
  138. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/util/jsonio.py +0 -0
  139. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/util/time.py +0 -0
  140. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/validators/__init__.py +0 -0
  141. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/validators/bidirectional.py +0 -0
  142. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/validators/bounds.py +0 -0
  143. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/validators/claim_lineage.py +0 -0
  144. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/validators/coverage.py +0 -0
  145. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/validators/feature_parent_links.py +0 -0
  146. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/validators/filesystem.py +0 -0
  147. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/validators/identity.py +0 -0
  148. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/validators/lifecycle.py +0 -0
  149. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/validators/origin.py +0 -0
  150. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/validators/promotion.py +0 -0
  151. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/validators/references.py +0 -0
  152. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/validators/reservations.py +0 -0
  153. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/validators/structure.py +0 -0
  154. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/validators/tiers.py +0 -0
  155. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/version.py +0 -0
  156. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/watch/__init__.py +0 -0
  157. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/watch/git_status.py +0 -0
  158. {ssot_core-0.2.26.dev1 → ssot_core-0.3.0}/src/ssot_registry/watch/observer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ssot-core
3
- Version: 0.2.26.dev1
3
+ Version: 0.3.0
4
4
  Summary: Core Python runtime, registry model, validation, and release workflow APIs for SSOT.
5
5
  Author-email: Jacob Stewart <jacob@swarmauri.com>
6
6
  License-Expression: Apache-2.0
@@ -18,11 +18,11 @@ Classifier: Natural Language :: English
18
18
  Classifier: Operating System :: OS Independent
19
19
  Classifier: Programming Language :: Python :: 3
20
20
  Classifier: Programming Language :: Python :: 3 :: Only
21
- Classifier: Programming Language :: Python :: 3.10
22
21
  Classifier: Programming Language :: Python :: 3.11
23
22
  Classifier: Programming Language :: Python :: 3.12
24
23
  Classifier: Programming Language :: Python :: 3.13
25
24
  Classifier: Programming Language :: Python :: 3.14
25
+ Classifier: Programming Language :: Python :: 3.15
26
26
  Classifier: Topic :: Database
27
27
  Classifier: Topic :: File Formats :: JSON
28
28
  Classifier: Topic :: File Formats :: JSON :: JSON Schema
@@ -34,13 +34,14 @@ Classifier: Topic :: Software Development :: Quality Assurance
34
34
  Classifier: Topic :: Software Development :: Testing
35
35
  Classifier: Topic :: System :: Archiving
36
36
  Classifier: Topic :: Utilities
37
- Requires-Python: <3.15,>=3.10
37
+ Requires-Python: <3.16,>=3.11
38
38
  Description-Content-Type: text/markdown
39
39
  Requires-Dist: orjson<4.0,>=3.10
40
- Requires-Dist: ssot-contracts==0.2.26.dev1
41
- Requires-Dist: ssot-pack-contracts<0.3.0,>=0.2.23
42
- Requires-Dist: ssot-views==0.2.26.dev1
43
- Requires-Dist: tomli>=2.0.1; python_version < "3.11"
40
+ Requires-Dist: ssot-contracts==0.3.0
41
+ Requires-Dist: ssot-pack-contracts<0.3.0,>=0.2.24
42
+ Requires-Dist: ssot-views==0.3.0
43
+ Provides-Extra: delivery
44
+ Requires-Dist: cryptography>=42; extra == "delivery"
44
45
 
45
46
  <div align="center">
46
47
  <h1>🔷 ssot-core</h1>
@@ -4,18 +4,17 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ssot-core"
7
- version = "0.2.26.dev1"
7
+ version = "0.3.0"
8
8
  description = "Core Python runtime, registry model, validation, and release workflow APIs for SSOT."
9
9
  readme = "README.md"
10
- requires-python = ">=3.10,<3.15"
10
+ requires-python = ">=3.11,<3.16"
11
11
  license = "Apache-2.0"
12
12
  authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
13
13
  dependencies = [
14
14
  "orjson>=3.10,<4.0",
15
- "ssot-contracts==0.2.26.dev1",
16
- "ssot-pack-contracts>=0.2.23,<0.3.0",
17
- "ssot-views==0.2.26.dev1",
18
- "tomli>=2.0.1; python_version < '3.11'",
15
+ "ssot-contracts==0.3.0",
16
+ "ssot-pack-contracts>=0.2.24,<0.3.0",
17
+ "ssot-views==0.3.0",
19
18
  ]
20
19
  keywords = ["ssot", "core", "registry", "validation", "release-management", "governance", "compliance"]
21
20
  classifiers = [
@@ -28,11 +27,11 @@ classifiers = [
28
27
  "Operating System :: OS Independent",
29
28
  "Programming Language :: Python :: 3",
30
29
  "Programming Language :: Python :: 3 :: Only",
31
- "Programming Language :: Python :: 3.10",
32
30
  "Programming Language :: Python :: 3.11",
33
31
  "Programming Language :: Python :: 3.12",
34
32
  "Programming Language :: Python :: 3.13",
35
33
  "Programming Language :: Python :: 3.14",
34
+ "Programming Language :: Python :: 3.15",
36
35
  "Topic :: Database",
37
36
  "Topic :: File Formats :: JSON",
38
37
  "Topic :: File Formats :: JSON :: JSON Schema",
@@ -46,6 +45,9 @@ classifiers = [
46
45
  "Topic :: Utilities",
47
46
  ]
48
47
 
48
+ [project.optional-dependencies]
49
+ delivery = ["cryptography>=42"]
50
+
49
51
  [project.urls]
50
52
  Homepage = "https://github.com/groupsum/ssot-registry/tree/main/pkgs/ssot-core"
51
53
  Repository = "https://github.com/groupsum/ssot-registry/tree/main/pkgs/ssot-core"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ssot-core
3
- Version: 0.2.26.dev1
3
+ Version: 0.3.0
4
4
  Summary: Core Python runtime, registry model, validation, and release workflow APIs for SSOT.
5
5
  Author-email: Jacob Stewart <jacob@swarmauri.com>
6
6
  License-Expression: Apache-2.0
@@ -18,11 +18,11 @@ Classifier: Natural Language :: English
18
18
  Classifier: Operating System :: OS Independent
19
19
  Classifier: Programming Language :: Python :: 3
20
20
  Classifier: Programming Language :: Python :: 3 :: Only
21
- Classifier: Programming Language :: Python :: 3.10
22
21
  Classifier: Programming Language :: Python :: 3.11
23
22
  Classifier: Programming Language :: Python :: 3.12
24
23
  Classifier: Programming Language :: Python :: 3.13
25
24
  Classifier: Programming Language :: Python :: 3.14
25
+ Classifier: Programming Language :: Python :: 3.15
26
26
  Classifier: Topic :: Database
27
27
  Classifier: Topic :: File Formats :: JSON
28
28
  Classifier: Topic :: File Formats :: JSON :: JSON Schema
@@ -34,13 +34,14 @@ Classifier: Topic :: Software Development :: Quality Assurance
34
34
  Classifier: Topic :: Software Development :: Testing
35
35
  Classifier: Topic :: System :: Archiving
36
36
  Classifier: Topic :: Utilities
37
- Requires-Python: <3.15,>=3.10
37
+ Requires-Python: <3.16,>=3.11
38
38
  Description-Content-Type: text/markdown
39
39
  Requires-Dist: orjson<4.0,>=3.10
40
- Requires-Dist: ssot-contracts==0.2.26.dev1
41
- Requires-Dist: ssot-pack-contracts<0.3.0,>=0.2.23
42
- Requires-Dist: ssot-views==0.2.26.dev1
43
- Requires-Dist: tomli>=2.0.1; python_version < "3.11"
40
+ Requires-Dist: ssot-contracts==0.3.0
41
+ Requires-Dist: ssot-pack-contracts<0.3.0,>=0.2.24
42
+ Requires-Dist: ssot-views==0.3.0
43
+ Provides-Extra: delivery
44
+ Requires-Dist: cryptography>=42; extra == "delivery"
44
45
 
45
46
  <div align="center">
46
47
  <h1>🔷 ssot-core</h1>
@@ -16,6 +16,8 @@ src/ssot_registry/api/__init__.py
16
16
  src/ssot_registry/api/boundary.py
17
17
  src/ssot_registry/api/claims.py
18
18
  src/ssot_registry/api/config.py
19
+ src/ssot_registry/api/document_catalog.py
20
+ src/ssot_registry/api/document_proof.py
19
21
  src/ssot_registry/api/documents.py
20
22
  src/ssot_registry/api/entity_ops.py
21
23
  src/ssot_registry/api/evidence.py
@@ -37,6 +39,11 @@ src/ssot_registry/api/status_sync.py
37
39
  src/ssot_registry/api/test_execution.py
38
40
  src/ssot_registry/api/upgrade.py
39
41
  src/ssot_registry/api/validate.py
42
+ src/ssot_registry/api/workspace.py
43
+ src/ssot_registry/api/workspace_proof.py
44
+ src/ssot_registry/api/workspace_sync.py
45
+ src/ssot_registry/api/workspace_upgrade.py
46
+ src/ssot_registry/api/workspace_views.py
40
47
  src/ssot_registry/assets/__init__.py
41
48
  src/ssot_registry/assets/lineage_graph/__init__.py
42
49
  src/ssot_registry/assets/lineage_graph/manifest.json
@@ -0,0 +1,7 @@
1
+ orjson<4.0,>=3.10
2
+ ssot-contracts==0.3.0
3
+ ssot-pack-contracts<0.3.0,>=0.2.24
4
+ ssot-views==0.3.0
5
+
6
+ [delivery]
7
+ cryptography>=42
@@ -70,6 +70,7 @@ from .save import save_registry, save_registry_unchecked
70
70
  from .status_sync import sync_automated_statuses
71
71
  from .test_execution import run_boundary_tests, run_resolved_test_rows, run_spec_tests, run_tests
72
72
  from .upgrade import upgrade_registry
73
+ from .workspace_upgrade import upgrade_all_registries, upgrade_workspace_format
73
74
  from .validate import validate_registry
74
75
 
75
76
  __all__ = [
@@ -158,4 +159,6 @@ __all__ = [
158
159
  "run_boundary_tests",
159
160
  "run_resolved_test_rows",
160
161
  "upgrade_registry",
162
+ "upgrade_all_registries",
163
+ "upgrade_workspace_format",
161
164
  ]
@@ -0,0 +1,94 @@
1
+ from __future__ import annotations
2
+
3
+ from pathlib import Path
4
+
5
+ from ssot_registry.snapshots.boundary_snapshot import build_boundary_snapshot
6
+ from ssot_registry.util.errors import ValidationError
7
+ from ssot_registry.util.jsonio import load_json, save_json
8
+ from ssot_registry.util.registry_lock import write_json_atomic
9
+ from .document_catalog import json_digest
10
+ from .document_proof import boundary_snapshot_path, capture_documents, managed_proof_enabled, verify_document_pins
11
+ from .workspace_proof import freeze_members
12
+ from .workspace import serialized_workspace_write
13
+ from .load import load_registry
14
+ from .profile_resolution import resolve_boundary_feature_ids
15
+ from .save import save_registry
16
+ from .validate import validate_registry, validate_registry_document
17
+
18
+
19
+ @serialized_workspace_write
20
+ def freeze_boundary(path: str | Path, boundary_id: str | None = None) -> dict[str, object]:
21
+ registry_path, repo_root, registry = load_registry(path)
22
+
23
+ preflight = validate_registry(registry_path)
24
+ if not preflight["passed"]:
25
+ raise ValidationError("Registry validation failed; boundary freeze refused")
26
+
27
+ boundary_lookup = {row["id"]: row for row in registry["boundaries"]}
28
+ selected_boundary_id = boundary_id or registry["program"]["active_boundary_id"]
29
+ boundary = boundary_lookup.get(selected_boundary_id)
30
+ if boundary is None:
31
+ raise ValueError(f"Unknown boundary id: {selected_boundary_id}")
32
+
33
+ pin_documents = managed_proof_enabled(repo_root, registry)
34
+ previous = boundary_snapshot_path(repo_root, selected_boundary_id)
35
+ if pin_documents and boundary.get("frozen") and previous.is_file():
36
+ snapshot = load_json(previous)
37
+ if "documents" not in snapshot:
38
+ raise ValidationError(f"Cannot replace historical frozen boundary {selected_boundary_id}")
39
+ verify_document_pins(repo_root, registry, snapshot["documents"])
40
+ if snapshot.get("workspace_members", []) != freeze_members(repo_root, boundary):
41
+ raise ValidationError(f"Child scope changed since {selected_boundary_id} was frozen")
42
+ return {
43
+ "passed": True, "registry_path": registry_path.as_posix(), "boundary_id": selected_boundary_id,
44
+ "output_path": previous.as_posix(), "snapshot": snapshot["summary"], "documents": snapshot["documents"],
45
+ }
46
+
47
+ boundary["frozen"] = True
48
+ boundary["status"] = "frozen"
49
+
50
+ postflight = validate_registry_document(registry, registry_path, repo_root)
51
+ if not postflight["passed"]:
52
+ raise ValidationError("Registry validation failed after boundary freeze")
53
+
54
+ features = {row["id"]: row for row in registry["features"]}
55
+ from ssot_registry.validators.identity import build_index
56
+
57
+ index = build_index(registry, [])
58
+ resolved_feature_ids = resolve_boundary_feature_ids(boundary, index)
59
+ selected_features = [features[feature_id] for feature_id in resolved_feature_ids if feature_id in features]
60
+ members = freeze_members(repo_root, boundary)
61
+ if not pin_documents:
62
+ save_registry(registry_path, registry, workspace_lifecycle=True)
63
+ snapshot, output_path = build_boundary_snapshot(
64
+ repo_root,
65
+ registry_path,
66
+ boundary,
67
+ selected_features,
68
+ )
69
+ if pin_documents:
70
+ if previous.is_file():
71
+ staged = load_json(previous)
72
+ if (staged.get("boundary") != boundary or staged.get("features") != selected_features
73
+ or staged.get("workspace_members", []) != members or "documents" not in staged):
74
+ raise ValidationError(f"Pending frozen snapshot for {selected_boundary_id} does not match current scope")
75
+ verify_document_pins(repo_root, registry, staged["documents"])
76
+ snapshot = staged
77
+ else:
78
+ snapshot["documents"] = capture_documents(repo_root, registry, selected_features)
79
+ snapshot["registry_sha256"] = json_digest(registry)
80
+ if members:
81
+ snapshot["workspace_members"] = members
82
+ write_json_atomic(output_path, snapshot)
83
+ save_registry(registry_path, registry, workspace_lifecycle=True)
84
+ else:
85
+ save_json(output_path, snapshot)
86
+
87
+ return {
88
+ "passed": True,
89
+ "registry_path": registry_path.as_posix(),
90
+ "boundary_id": selected_boundary_id,
91
+ "output_path": output_path.as_posix(),
92
+ "snapshot": snapshot["summary"],
93
+ **({"documents": snapshot["documents"], "workspace_members": members} if pin_documents else {}),
94
+ }
@@ -9,10 +9,7 @@ from ssot_registry.util.errors import ValidationError
9
9
  from .graph import export_graph
10
10
  from .validate import validate_registry
11
11
 
12
- try:
13
- import tomllib
14
- except ModuleNotFoundError: # pragma: no cover - Python < 3.11
15
- import tomli as tomllib
12
+ import tomllib
16
13
 
17
14
 
18
15
  CONFIG_RELATIVE_PATH = ".ssot/ssot.toml"
@@ -86,7 +83,9 @@ basename = "registry.graph"
86
83
  _AUTOMATION_DEPTH = 0
87
84
 
88
85
 
89
- def _repo_root_from_path(path: str | Path) -> Path:
86
+ def _repo_root_from_path(path: str | Path, *, discover: bool = True) -> Path:
87
+ from ssot_registry.util.fs import resolve_registry_path
88
+
90
89
  candidate = Path(path).expanduser()
91
90
  if candidate.is_file():
92
91
  if candidate.name == "registry.json" and candidate.parent.name == ".ssot":
@@ -96,7 +95,12 @@ def _repo_root_from_path(path: str | Path) -> Path:
96
95
  return candidate.parent
97
96
  if candidate.name == ".ssot":
98
97
  return candidate.parent
99
- return candidate
98
+ if not discover:
99
+ return candidate
100
+ try:
101
+ return resolve_registry_path(candidate).parent.parent
102
+ except FileNotFoundError:
103
+ return candidate
100
104
 
101
105
 
102
106
  def _config_path(repo_root: Path) -> Path:
@@ -187,14 +191,14 @@ def validate_repo_config_payload(config: dict[str, Any]) -> dict[str, Any]:
187
191
 
188
192
 
189
193
  def ensure_repo_config(path: str | Path, *, overwrite: bool = False) -> dict[str, Any]:
190
- repo_root = _repo_root_from_path(path)
194
+ repo_root = _repo_root_from_path(path, discover=False)
191
195
  repo_root.mkdir(parents=True, exist_ok=True)
192
196
  config_path = _config_path(repo_root)
193
197
  config_path.parent.mkdir(parents=True, exist_ok=True)
194
198
  existed = config_path.exists()
195
199
 
196
200
  if existed and not overwrite:
197
- payload = load_repo_config(path)
201
+ payload = load_repo_config(config_path)
198
202
  return {
199
203
  "passed": True,
200
204
  "config_path": payload["config_path"],
@@ -204,7 +208,7 @@ def ensure_repo_config(path: str | Path, *, overwrite: bool = False) -> dict[str
204
208
  }
205
209
 
206
210
  config_path.write_text(_DEFAULT_TEMPLATE, encoding="utf-8", newline="\n")
207
- payload = load_repo_config(path)
211
+ payload = load_repo_config(config_path)
208
212
  return {
209
213
  "passed": True,
210
214
  "config_path": payload["config_path"],
@@ -0,0 +1,303 @@
1
+ from __future__ import annotations
2
+
3
+ from copy import deepcopy
4
+ from hashlib import sha256
5
+ from pathlib import Path
6
+ import re
7
+ from typing import Any
8
+
9
+ from ssot_contracts.workspace_formats import CATALOG_SCHEMA_VERSION
10
+
11
+ from ssot_registry.util.errors import ValidationError
12
+ from ssot_registry.util.jsonio import load_json, stable_json_dumps
13
+ from ssot_registry.util.registry_lock import write_bytes_atomic, write_json_atomic
14
+
15
+ from .workspace import find_workspace, load_workspace
16
+
17
+ _DIGEST = re.compile(r"(?:sha256:)?([a-f0-9]{64})\Z")
18
+ _SOURCE = re.compile(r"(?:builtin|pack:[a-z0-9][a-z0-9._-]*)\Z")
19
+ SECTIONS = {"adrs": "adr", "specs": "spec"}
20
+
21
+
22
+ def digest_bytes(data: bytes) -> str:
23
+ return sha256(data).hexdigest()
24
+
25
+
26
+ def json_digest(data: Any) -> str:
27
+ return digest_bytes(stable_json_dumps(data).encode("utf-8"))
28
+
29
+
30
+ def digest_key(digest: str) -> str:
31
+ match = _DIGEST.fullmatch(digest) if isinstance(digest, str) else None
32
+ if match is None:
33
+ raise ValidationError(f"Invalid SHA-256 digest: {digest!r}")
34
+ return match[1]
35
+
36
+
37
+ def source_key(source: str) -> str:
38
+ if not isinstance(source, str) or not _SOURCE.fullmatch(source):
39
+ raise ValidationError(f"Invalid catalog source: {source!r}")
40
+ return source
41
+
42
+
43
+ def catalog_dir(root: Path) -> Path:
44
+ directory = root / ".ssot" / "catalog"
45
+ if not directory.resolve().is_relative_to(root.resolve()):
46
+ raise ValidationError(f"Catalog escapes registry: {directory}")
47
+ return directory
48
+
49
+
50
+ def _store_path(root: Path, folder: str, filename: str) -> Path:
51
+ directory = catalog_dir(root)
52
+ path = directory / folder / filename
53
+ if not path.resolve().is_relative_to(directory.resolve()):
54
+ raise ValidationError(f"Catalog object escapes its store: {path}")
55
+ return path
56
+
57
+
58
+ def read_blob(root: Path, digest: str) -> bytes:
59
+ key = digest_key(digest)
60
+ path = _store_path(root, "objects", f"{key}.blob")
61
+ if not path.is_file():
62
+ raise ValidationError(f"Missing document object sha256:{key} in {root}")
63
+ data = path.read_bytes()
64
+ if digest_bytes(data) != key:
65
+ raise ValidationError(f"Document object digest mismatch: {path}")
66
+ return data
67
+
68
+
69
+ def put_blob(root: Path, data: bytes) -> str:
70
+ digest = digest_bytes(data)
71
+ path = _store_path(root, "objects", f"{digest}.blob")
72
+ if path.exists():
73
+ read_blob(root, digest)
74
+ else:
75
+ write_bytes_atomic(path, data)
76
+ return digest
77
+
78
+
79
+ def catalog_state(registry: dict[str, Any]) -> dict[str, Any] | None:
80
+ repo = registry.get("repo")
81
+ state = repo.get("managed_docs") if isinstance(repo, dict) else None
82
+ if state is None:
83
+ return None
84
+ if (
85
+ not isinstance(state, dict)
86
+ or state.get("mode") not in {"shared", "local"}
87
+ or not isinstance(state.get("source_locks"), dict)
88
+ or not isinstance(state.get("catalog_registry_id"), str)
89
+ ):
90
+ raise ValidationError("Invalid managed document storage state")
91
+ for source, digest in state["source_locks"].items():
92
+ source_key(source)
93
+ digest_key(digest)
94
+ return state
95
+
96
+
97
+ def document_store(root: Path, registry: dict[str, Any]) -> Path:
98
+ state = catalog_state(registry)
99
+ if state is None or state["mode"] == "local":
100
+ return root
101
+ workspace = find_workspace(root)
102
+ if workspace is None:
103
+ raise ValidationError(f"Shared documents for {root} require the workspace root")
104
+ inventory = load_workspace(workspace)
105
+ if inventory.root_id != state["catalog_registry_id"]:
106
+ raise ValidationError("Managed document catalog workspace ID mismatch")
107
+ return inventory.root
108
+
109
+
110
+ def read_catalog(root: Path, digest: str, source: str) -> dict[str, Any]:
111
+ key = digest_key(digest)
112
+ path = _store_path(root, "manifests", f"{key}.json")
113
+ if not path.is_file():
114
+ raise ValidationError(f"Missing catalog sha256:{key} in {root}")
115
+ manifest = load_json(path)
116
+ if (
117
+ not isinstance(manifest, dict)
118
+ or manifest.get("schema_version") != CATALOG_SCHEMA_VERSION
119
+ or manifest.get("source") != source
120
+ or not isinstance(manifest.get("source_revision"), str)
121
+ or not isinstance(manifest.get("documents"), dict)
122
+ or set(manifest["documents"]) != set(SECTIONS)
123
+ or any(
124
+ not isinstance(rows, list) or any(
125
+ not isinstance(row, dict) or not all(key in row for key in ("id", "number", "path", "content_sha256"))
126
+ for row in rows
127
+ )
128
+ for rows in manifest["documents"].values()
129
+ )
130
+ or json_digest(manifest) != key
131
+ ):
132
+ raise ValidationError(f"Catalog identity or digest mismatch: {path}")
133
+ return manifest
134
+
135
+
136
+ def save_catalog(root: Path, manifest: dict[str, Any], blobs: dict[str, bytes]) -> str:
137
+ for rows in manifest["documents"].values():
138
+ for row in rows:
139
+ key = digest_key(row["content_sha256"])
140
+ if put_blob(root, blobs[key]) != key:
141
+ raise ValidationError(f"Catalog contains incorrect document bytes: {row['id']}")
142
+ key = json_digest(manifest)
143
+ path = _store_path(root, "manifests", f"{key}.json")
144
+ if path.exists():
145
+ read_catalog(root, key, manifest["source"])
146
+ else:
147
+ write_json_atomic(path, manifest)
148
+ return key
149
+
150
+
151
+ def catalog_blobs(root: Path, manifest: dict[str, Any]) -> dict[str, bytes]:
152
+ return {
153
+ key: read_blob(root, key)
154
+ for key in {row["content_sha256"] for rows in manifest["documents"].values() for row in rows}
155
+ }
156
+
157
+
158
+ def current_catalogs(root: Path) -> dict[str, str]:
159
+ path = _store_path(root, ".", "current.json")
160
+ catalogs = load_json(path) if path.is_file() else {}
161
+ if not isinstance(catalogs, dict):
162
+ raise ValidationError(f"Invalid catalog pointers: {path}")
163
+ return {source_key(source): digest_key(digest) for source, digest in catalogs.items()}
164
+
165
+
166
+ def verify_source_revision(root: Path, manifest: dict[str, Any]) -> None:
167
+ directory = catalog_dir(root) / "manifests"
168
+ candidate = json_digest(manifest)
169
+ for path in sorted(directory.glob("*.json")):
170
+ if path.stem == candidate:
171
+ continue
172
+ existing = load_json(path)
173
+ if existing.get("source") == manifest["source"] and existing.get("source_revision") == manifest["source_revision"]:
174
+ raise ValidationError(f"Catalog {manifest['source']} revision {manifest['source_revision']} already has a different digest")
175
+
176
+
177
+ def publish_catalog(root: Path, source: str, digest: str) -> None:
178
+ catalogs = current_catalogs(root)
179
+ if catalogs.get(source) != digest:
180
+ catalogs[source] = digest
181
+ write_json_atomic(_store_path(root, ".", "current.json"), catalogs)
182
+
183
+
184
+ def builtin_catalog(registry: dict[str, Any]) -> tuple[dict[str, Any], dict[str, bytes]]:
185
+ from ssot_registry.model.document import read_manifest_document_bytes
186
+ from ssot_registry.model.schema_version import schema_version_meets_minimum
187
+ from ssot_registry.util.document_io import build_document_payload, document_body_from_payload, dump_document_text, load_document_text, normalize_document_payload
188
+ from ssot_registry.version import __version__
189
+ from .documents import _manifest_row_to_registry_row, load_document_manifest
190
+
191
+ documents = {section: [] for section in SECTIONS}
192
+ blobs = {}
193
+ for section, kind in SECTIONS.items():
194
+ for entry in load_document_manifest(kind):
195
+ if entry.get("origin") != "ssot-origin" or not schema_version_meets_minimum(registry["schema_version"], entry.get("minimum_schema_version", 0)):
196
+ continue
197
+ row = _manifest_row_to_registry_row(registry, kind, entry)
198
+ raw = read_manifest_document_bytes(kind, entry).decode("utf-8-sig")
199
+ body = document_body_from_payload(kind, normalize_document_payload(kind, load_document_text(raw, source=entry["filename"])))
200
+ payload = dump_document_text(build_document_payload(kind, row, body), Path(row["path"])).encode("utf-8")
201
+ key = digest_bytes(payload)
202
+ row["content_sha256"] = key
203
+ documents[section].append(row)
204
+ blobs[key] = payload
205
+ documents[section].sort(key=lambda row: row["id"])
206
+ return {"schema_version": CATALOG_SCHEMA_VERSION, "source": "builtin", "source_revision": __version__, "documents": documents}, blobs
207
+
208
+
209
+ def registry_with_catalog(registry: dict[str, Any], manifest: dict[str, Any], root_id: str, *, mode: str) -> dict[str, Any]:
210
+ result = deepcopy(registry)
211
+ state = catalog_state(result) or {"mode": mode, "catalog_registry_id": root_id, "source_locks": {}}
212
+ if state["catalog_registry_id"] != root_id:
213
+ raise ValidationError("Registry is bound to another document catalog")
214
+ source = manifest["source"]
215
+ state["source_locks"][source] = json_digest(manifest)
216
+ result["repo"]["managed_docs"] = state
217
+ for kind, reservations in manifest.get("reservations", {}).items():
218
+ target = result["document_id_reservations"][kind]
219
+ for reservation in reservations:
220
+ if reservation not in target:
221
+ if any(item["start"] <= reservation["end"] and reservation["start"] <= item["end"] for item in target):
222
+ raise ValidationError(f"Catalog {source} conflicts with an existing {kind} reservation")
223
+ target.append(deepcopy(reservation))
224
+ target.sort(key=lambda item: (item["start"], item["end"]))
225
+ for section in SECTIONS:
226
+ retained = [
227
+ row for row in result[section]
228
+ if row.get("catalog_source") != source
229
+ and not (source == "builtin" and row.get("origin") == "ssot-origin" and row.get("managed") is True)
230
+ and not (source == row.get("source_pack_id") and row.get("managed") is True)
231
+ ]
232
+ rows = [dict(row, catalog_source=source) for row in manifest["documents"][section]]
233
+ if {row["id"] for row in rows}.intersection(row["id"] for row in retained):
234
+ raise ValidationError(f"Managed catalog {source} conflicts with an existing {section} ID")
235
+ result[section] = sorted(retained + rows, key=lambda row: (row["number"], row["id"]))
236
+ return result
237
+
238
+
239
+ def projected_catalogs(
240
+ root: Path,
241
+ registry: dict[str, Any],
242
+ staged: tuple[dict[str, Any], dict[str, bytes]] | None = None,
243
+ ) -> tuple[dict[str, dict[str, Any]], dict[str, bytes]]:
244
+ state = catalog_state(registry)
245
+ if state is None:
246
+ return {}, {}
247
+ store = document_store(root, registry) if state["source_locks"] else root
248
+ rows = {}
249
+ blobs = {}
250
+ for source, digest in state["source_locks"].items():
251
+ if staged is not None and staged[0]["source"] == source and json_digest(staged[0]) == digest_key(digest):
252
+ manifest, payloads = staged
253
+ else:
254
+ manifest = read_catalog(store, digest, source)
255
+ payloads = catalog_blobs(store, manifest)
256
+ for section in SECTIONS:
257
+ for row in manifest["documents"][section]:
258
+ if row["id"] in rows:
259
+ raise ValidationError(f"Conflicting managed document ID {row['id']}")
260
+ rows[row["id"]] = dict(row, catalog_source=source)
261
+ blobs.update(payloads)
262
+ return rows, blobs
263
+
264
+
265
+ def managed_document_path(root: Path, row: dict[str, Any]) -> Path:
266
+ if "catalog_source" not in row:
267
+ return root / row["path"]
268
+ registry = load_json(root / ".ssot" / "registry.json")
269
+ store = document_store(root, registry)
270
+ key = digest_key(row["content_sha256"])
271
+ read_blob(store, key)
272
+ return _store_path(store, "objects", f"{key}.blob")
273
+
274
+
275
+ def materialized_pack_catalog(
276
+ root: Path, registry: dict[str, Any], source: str, revision: str, document_ids: set[str],
277
+ ) -> tuple[dict[str, Any], dict[str, bytes]]:
278
+ from ssot_registry.model.document import reservation_kind_key
279
+
280
+ documents = {section: [] for section in SECTIONS}
281
+ reservations = {}
282
+ blobs = {}
283
+ for section, kind in SECTIONS.items():
284
+ for row in registry[section]:
285
+ if row["id"] not in document_ids or row.get("source_pack_id") != source:
286
+ continue
287
+ content = (root / row["path"]).read_bytes().replace(b"\r\n", b"\n")
288
+ key = digest_bytes(content)
289
+ if key != row["content_sha256"]:
290
+ raise ValidationError(f"Cannot publish an altered pack document {row['id']}")
291
+ documents[section].append(row)
292
+ reservation_key = reservation_kind_key(kind)
293
+ ranges = reservations.setdefault(reservation_key, [])
294
+ for reservation in registry["document_id_reservations"][reservation_key]:
295
+ if reservation["start"] <= row["number"] <= reservation["end"] and reservation not in ranges:
296
+ ranges.append(reservation)
297
+ blobs[key] = content
298
+ if not blobs:
299
+ raise ValidationError(f"Pack has no materialized extension documents: {source}")
300
+ return {
301
+ "schema_version": CATALOG_SCHEMA_VERSION, "source": source_key(source), "source_revision": revision,
302
+ "documents": documents, "reservations": reservations,
303
+ }, blobs