clm-kernel 0.0.0__py3-none-any.whl
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.
- clm/__init__.py +230 -0
- clm/__main__.py +25 -0
- clm/cross_cutting/__init__.py +50 -0
- clm/cross_cutting/_test_runner.py +36 -0
- clm/cross_cutting/async_utils.py +25 -0
- clm/cross_cutting/cel_builder.py +123 -0
- clm/cross_cutting/cel_converter.py +697 -0
- clm/cross_cutting/cel_engine.py +252 -0
- clm/cross_cutting/cel_ops.py +72 -0
- clm/cross_cutting/cel_ops_db.py +157 -0
- clm/cross_cutting/cel_ops_files.py +99 -0
- clm/cross_cutting/cel_ops_state.py +71 -0
- clm/cross_cutting/cel_ops_strings.py +64 -0
- clm/cross_cutting/cel_resolver.py +63 -0
- clm/cross_cutting/cel_slices.py +56 -0
- clm/cross_cutting/cel_store.py +330 -0
- clm/cross_cutting/clm_logger.py +140 -0
- clm/cross_cutting/config/__init__.py +155 -0
- clm/cross_cutting/config/config_constants.py +392 -0
- clm/cross_cutting/config/env_parameters.py +90 -0
- clm/cross_cutting/config/logging.py +378 -0
- clm/cross_cutting/config/settings.py +504 -0
- clm/cross_cutting/context.py +5 -0
- clm/cross_cutting/domain_models.py +55 -0
- clm/cross_cutting/domain_types.py +61 -0
- clm/cross_cutting/effects.py +67 -0
- clm/cross_cutting/errors.py +153 -0
- clm/cross_cutting/governance.py +331 -0
- clm/cross_cutting/guards.py +41 -0
- clm/cross_cutting/mcard.py +321 -0
- clm/cross_cutting/native.py +185 -0
- clm/cross_cutting/observability.py +289 -0
- clm/cross_cutting/pcard.py +434 -0
- clm/cross_cutting/registry.py +71 -0
- clm/cross_cutting/resources.py +84 -0
- clm/cross_cutting/secrets.py +44 -0
- clm/cross_cutting/subprocess_utils.py +118 -0
- clm/cross_cutting/telemetry.py +164 -0
- clm/cross_cutting/testing/__init__.py +8 -0
- clm/cross_cutting/testing/comparator.py +187 -0
- clm/cross_cutting/testing/datasets.py +87 -0
- clm/cross_cutting/timeutil.py +20 -0
- clm/cross_cutting/types/new_type_check.py +0 -0
- clm/cross_cutting/utils/__init__.py +1 -0
- clm/cross_cutting/utils/url_safety.py +50 -0
- clm/cross_cutting/vcard.py +560 -0
- clm/cross_cutting/writer.py +118 -0
- clm/layer0/README.md +50 -0
- clm/layer0/__init__.py +223 -0
- clm/layer0/algebra.py +60 -0
- clm/layer0/algebra_baldwin.py +133 -0
- clm/layer0/algebra_baldwin_generators.py +36 -0
- clm/layer0/algebra_equivalence.py +262 -0
- clm/layer0/algebra_ingest.py +306 -0
- clm/layer0/algebra_manifest_io.py +156 -0
- clm/layer0/assembler.py +481 -0
- clm/layer0/cel/__init__.py +23 -0
- clm/layer0/cel_eval.py +491 -0
- clm/layer0/codec.py +106 -0
- clm/layer0/context.py +122 -0
- clm/layer0/db.py +160 -0
- clm/layer0/exceptions.py +73 -0
- clm/layer0/fibration.py +106 -0
- clm/layer0/gates.py +50 -0
- clm/layer0/hash.py +80 -0
- clm/layer0/loader.py +826 -0
- clm/layer0/math_utils.py +163 -0
- clm/layer0/mcard.py +96 -0
- clm/layer0/model/__init__.py +0 -0
- clm/layer0/model/action.py +223 -0
- clm/layer0/model/card.py +280 -0
- clm/layer0/model/card_triad.py +427 -0
- clm/layer0/model/compatibility.py +60 -0
- clm/layer0/model/dictionary.py +46 -0
- clm/layer0/model/dots.py +331 -0
- clm/layer0/model/event_producer.py +88 -0
- clm/layer0/model/g_time.py +89 -0
- clm/layer0/model/handle.py +163 -0
- clm/layer0/model/hash/__init__.py +6 -0
- clm/layer0/model/hash/algorithms/__init__.py +3 -0
- clm/layer0/model/hash/algorithms/custom_hash.py +7 -0
- clm/layer0/model/hash/algorithms/local_sha256.py +178 -0
- clm/layer0/model/hash/constants.py +53 -0
- clm/layer0/model/hash/enums.py +60 -0
- clm/layer0/model/hash/validator.py +307 -0
- clm/layer0/model/interpreter.py +275 -0
- clm/layer0/model/pagination.py +45 -0
- clm/layer0/model/pcard.py +716 -0
- clm/layer0/model/schema.py +44 -0
- clm/layer0/model/utils/__init__.py +1 -0
- clm/layer0/model/utils/content_analyzer.py +152 -0
- clm/layer0/model/validators/__init__.py +1 -0
- clm/layer0/model/validators/base_validator.py +44 -0
- clm/layer0/model/validators/binary_validator.py +66 -0
- clm/layer0/model/validators/text_validator.py +82 -0
- clm/layer0/model/validators/validation_registry.py +49 -0
- clm/layer0/model/vcard.py +823 -0
- clm/layer0/model/vcard_ext/__init__.py +39 -0
- clm/layer0/model/vcard_ext/core.py +60 -0
- clm/layer0/model/vcard_ext/network.py +23 -0
- clm/layer0/model/vcard_ext/observability.py +63 -0
- clm/layer0/model/vcard_ext/storage.py +60 -0
- clm/layer0/model/vcard_ext/vendors.py +211 -0
- clm/layer0/model/vcard_sandwich.py +119 -0
- clm/layer0/model/vcard_vocabulary.py +463 -0
- clm/layer0/model/workflow.py +274 -0
- clm/layer0/narrative.py +431 -0
- clm/layer0/ontology/collection.py +125 -0
- clm/layer0/parser.py +429 -0
- clm/layer0/relations.py +73 -0
- clm/layer0/rule_evaluator.py +251 -0
- clm/layer0/schema/__init__.py +38 -0
- clm/layer0/schema/ddl.py +97 -0
- clm/layer0/templates/abstract.yaml +99 -0
- clm/layer0/templates/balanced.yaml +253 -0
- clm/layer0/templates/concrete.yaml +172 -0
- clm/layer0/type_registry.py +223 -0
- clm/layer0/types.py +204 -0
- clm/layer0/utils.py +886 -0
- clm/layer0/verifier_core.py +262 -0
- clm/layer1/__init__.py +31 -0
- clm/layer1/action_dispatcher.py +275 -0
- clm/layer1/adapter_registry.py +233 -0
- clm/layer1/algebra_baldwin_generators.py +192 -0
- clm/layer1/arrow_compiler.py +525 -0
- clm/layer1/batch_processor.py +152 -0
- clm/layer1/cel/__init__.py +27 -0
- clm/layer1/cel/builder.py +173 -0
- clm/layer1/engine.py +759 -0
- clm/layer1/engine_async.py +89 -0
- clm/layer1/eval_callback.py +49 -0
- clm/layer1/gate_composer.py +229 -0
- clm/layer1/hoare_sandwich.py +298 -0
- clm/layer1/identity_guard.py +348 -0
- clm/layer1/matrix.py +138 -0
- clm/layer1/neural_runtime.py +221 -0
- clm/layer1/operations/__init__.py +123 -0
- clm/layer1/operations/augment.py +156 -0
- clm/layer1/operations/base.py +109 -0
- clm/layer1/operations/builtins.py +338 -0
- clm/layer1/operations/dispatch.py +144 -0
- clm/layer1/operations/exclude.py +107 -0
- clm/layer1/operations/handle.py +197 -0
- clm/layer1/operations/identity.py +139 -0
- clm/layer1/operations/invert.py +66 -0
- clm/layer1/operations/loader.py +116 -0
- clm/layer1/operations/manipulators/__init__.py +23 -0
- clm/layer1/operations/manipulators/document.py +211 -0
- clm/layer1/operations/manipulators/media.py +134 -0
- clm/layer1/operations/manipulators/structured.py +159 -0
- clm/layer1/operations/manipulators/tabular.py +334 -0
- clm/layer1/operations/port.py +65 -0
- clm/layer1/operations/services.py +529 -0
- clm/layer1/operations/split.py +117 -0
- clm/layer1/operations/substitute.py +75 -0
- clm/layer1/petri.py +1052 -0
- clm/layer1/pocketflow_orchestrator.py +408 -0
- clm/layer1/pocketflow_scheduler.py +519 -0
- clm/layer1/protocols.py +197 -0
- clm/layer1/runtime_adapter.py +718 -0
- clm/layer1/runtimes/__init__.py +71 -0
- clm/layer1/runtimes/_generated_assertions.py +125 -0
- clm/layer1/runtimes/_generated_types.py +42 -0
- clm/layer1/runtimes/base.py +265 -0
- clm/layer1/runtimes/binary.py +101 -0
- clm/layer1/runtimes/factory.py +203 -0
- clm/layer1/runtimes/javascript.py +321 -0
- clm/layer1/runtimes/javascript_runtime.js +33 -0
- clm/layer1/runtimes/js_scripts/isomorphism.mjs +22 -0
- clm/layer1/runtimes/js_scripts/loader.mjs +52 -0
- clm/layer1/runtimes/lambda_calc.py +126 -0
- clm/layer1/runtimes/python.py +288 -0
- clm/layer1/runtimes/python_runtime.py +41 -0
- clm/layer1/runtimes/script.py +114 -0
- clm/layer1/sandbox.py +334 -0
- clm/layer1/savepoint_guard.py +136 -0
- clm/layer1/sparse_net.py +122 -0
- clm/layer1/spec_tester.py +165 -0
- clm/layer1/store.py +295 -0
- clm/layer1/test_runner.py +498 -0
- clm/layer1/type_inspector.py +166 -0
- clm/layer1/verifier.py +772 -0
- clm/layer1/vm.py +91 -0
- clm/layer2/__init__.py +78 -0
- clm/layer2/card_collection.py +678 -0
- clm/layer2/classifier.py +479 -0
- clm/layer2/engine/__init__.py +1 -0
- clm/layer2/engine/abstract_sql_engine.py +320 -0
- clm/layer2/engine/base.py +193 -0
- clm/layer2/engine/duckdb_engine.py +576 -0
- clm/layer2/engine/sqlite_engine.py +518 -0
- clm/layer2/fiber/__init__.py +31 -0
- clm/layer2/fiber/context.py +89 -0
- clm/layer2/fiber/disposable.py +163 -0
- clm/layer2/fiber/fiber.py +125 -0
- clm/layer2/fiber/hoare.py +191 -0
- clm/layer2/file_io.py +376 -0
- clm/layer2/file_registrar.py +77 -0
- clm/layer2/ingest.py +202 -0
- clm/layer2/lineage.py +322 -0
- clm/layer2/mcard_fs.py +262 -0
- clm/layer2/merkle.py +11 -0
- clm/layer2/mime.py +244 -0
- clm/layer2/mime_detector.py +245 -0
- clm/layer2/private_collection.py +118 -0
- clm/layer2/shared_store.py +11 -0
- clm/layer2/storage/__init__.py +190 -0
- clm/layer2/storage/db_bitemporal.py +141 -0
- clm/layer2/storage/db_driver.py +331 -0
- clm/layer2/storage/db_hyperlinks.py +214 -0
- clm/layer2/storage/db_pool.py +139 -0
- clm/layer2/storage/db_repository.py +229 -0
- clm/layer2/storage/savepoint.py +78 -0
- clm/layer2/storage/sqlite_wal.py +74 -0
- clm/layer2/tridb.py +245 -0
- clm/layer2/vcard_receipt.py +71 -0
- clm/layer2/vfs.py +17 -0
- clm/layer3/__init__.py +141 -0
- clm/layer3/agency/__init__.py +19 -0
- clm/layer3/agency/config.py +220 -0
- clm/layer3/agency/providers/__init__.py +15 -0
- clm/layer3/agency/providers/base.py +91 -0
- clm/layer3/agency/providers/mlc_llm.py +169 -0
- clm/layer3/agency/providers/ollama.py +203 -0
- clm/layer3/agency/router.py +71 -0
- clm/layer3/agency/runtime.py +524 -0
- clm/layer3/gateway.py +353 -0
- clm/layer3/open_interpreter_adapter.py +159 -0
- clm/layer3/rag/__init__.py +70 -0
- clm/layer3/rag/cli.py +228 -0
- clm/layer3/rag/config.py +153 -0
- clm/layer3/rag/embeddings/__init__.py +16 -0
- clm/layer3/rag/embeddings/base.py +79 -0
- clm/layer3/rag/embeddings/ollama.py +211 -0
- clm/layer3/rag/embeddings/vision.py +290 -0
- clm/layer3/rag/engine.py +276 -0
- clm/layer3/rag/graph/__init__.py +22 -0
- clm/layer3/rag/graph/community.py +198 -0
- clm/layer3/rag/graph/engine.py +433 -0
- clm/layer3/rag/graph/extractor.py +255 -0
- clm/layer3/rag/graph/schema.py +115 -0
- clm/layer3/rag/graph/store.py +641 -0
- clm/layer3/rag/indexer.py +333 -0
- clm/layer3/rag/llm_providers.json +52 -0
- clm/layer3/rag/semantic_versioning.py +313 -0
- clm/layer3/rag/vector/__init__.py +28 -0
- clm/layer3/rag/vector/handle_vector_store.py +749 -0
- clm/layer3/rag/vector/schema.py +151 -0
- clm/layer3/rag/vector/store.py +632 -0
- clm/layer3/reticulum/__init__.py +55 -0
- clm/layer3/reticulum/bridge.py +74 -0
- clm/layer3/reticulum/daemon.py +88 -0
- clm/layer3/reticulum/discovery.py +164 -0
- clm/layer3/reticulum/identity.py +107 -0
- clm/layer3/reticulum/media.py +148 -0
- clm/layer3/reticulum/transport.py +133 -0
- clm/layer3/satori/__init__.py +209 -0
- clm/layer3/satori/alpha_conversion.py +168 -0
- clm/layer3/satori/beta_reduction.py +359 -0
- clm/layer3/satori/continuation.py +38 -0
- clm/layer3/satori/eta_conversion.py +205 -0
- clm/layer3/satori/free_variables.py +163 -0
- clm/layer3/satori/io_effects.py +370 -0
- clm/layer3/satori/lambda_runtime.py +726 -0
- clm/layer3/satori/lambda_term.py +230 -0
- clm/layer3/satori/sheaf_audit.py +261 -0
- clm/layer3/satori/speech_act.py +279 -0
- clm/layer4/README.md +9 -0
- clm/layer4/__init__.py +67 -0
- clm/layer4/_sovereign_executor.py +580 -0
- clm/layer4/action_commands.py +719 -0
- clm/layer4/api.py +236 -0
- clm/layer4/bootstrap/__init__.py +13 -0
- clm/layer4/bootstrap/bootstrapper.py +118 -0
- clm/layer4/bootstrap/cleanup.py +44 -0
- clm/layer4/bootstrap/clm_hooks.py +49 -0
- clm/layer4/bootstrap/genesis.py +77 -0
- clm/layer4/bootstrap/injection.py +125 -0
- clm/layer4/cli.py +549 -0
- clm/layer4/collection_manager.py +553 -0
- clm/layer4/commands/__init__.py +81 -0
- clm/layer4/commands/action_cmd.py +42 -0
- clm/layer4/commands/check_cmd.py +82 -0
- clm/layer4/commands/envelope.py +73 -0
- clm/layer4/commands/evaluate_cmd.py +224 -0
- clm/layer4/commands/mcard_cmd.py +24 -0
- clm/layer4/commands/petri_cmd.py +92 -0
- clm/layer4/commands/tridb_cmd.py +319 -0
- clm/layer4/commands/version_cmd.py +27 -0
- clm/layer4/diff_commands.py +167 -0
- clm/layer4/eoa_sponsor.py +232 -0
- clm/layer4/events.py +69 -0
- clm/layer4/flux_gateway.py +133 -0
- clm/layer4/gateway.py +91 -0
- clm/layer4/loader.py +307 -0
- clm/layer4/mcard_commands.py +166 -0
- clm/layer4/membrane.py +273 -0
- clm/layer4/navigation.py +50 -0
- clm/layer4/protocol/protocol_entry_python.py +108 -0
- clm/layer4/protocol/python_sync.py +126 -0
- clm/layer4/runner.py +150 -0
- clm/layer4/satori.py +262 -0
- clm/layer4/server/python_sync_client.py +150 -0
- clm/layer4/server/python_sync_server.py +139 -0
- clm/layer4/server/service_api.py +315 -0
- clm/layer4/server/start_servers.py +107 -0
- clm/layer4/server/stop_servers.py +24 -0
- clm/layer4/simulated_optimization_fix.py +0 -0
- clm/layer4/storage.py +463 -0
- clm/layer4/tridb_admin.py +268 -0
- clm/layer4/websocket/test_ws_client.py +104 -0
- clm/layer4/websocket/test_ws_server.py +138 -0
- clm/layer4/websocket/ws_server_local.py +160 -0
- clm/layer5/__init__.py +51 -0
- clm/layer5/async_batch_writer.py +133 -0
- clm/layer5/learning.py +276 -0
- clm/layer5/telemetry_hook.py +107 -0
- clm/layer5/type_lattice.py +238 -0
- clm/py.typed +0 -0
- clm/schemas/__init__.py +652 -0
- clm/schemas/abstract_face_schema.yaml +77 -0
- clm/schemas/cel_schema.yaml +416 -0
- clm/schemas/lifecycle/__init__.py +45 -0
- clm/schemas/lifecycle/models.py +123 -0
- clm/schemas/lifecycle/service.py +364 -0
- clm/schemas/mcard_schema.sql +192 -0
- clm/schemas/mcard_vector_schema.sql +283 -0
- clm/schemas/mlp-context-v1.json +91 -0
- clm_kernel-0.0.0.dist-info/METADATA +121 -0
- clm_kernel-0.0.0.dist-info/RECORD +333 -0
- clm_kernel-0.0.0.dist-info/WHEEL +4 -0
- clm_kernel-0.0.0.dist-info/entry_points.txt +3 -0
- clm_kernel-0.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# Balanced Expectations Template for CLM
|
|
2
|
+
# This template defines the WHY dimension - the verification proofs and test cases
|
|
3
|
+
|
|
4
|
+
# Test Cases (BDD Format)
|
|
5
|
+
test_cases:
|
|
6
|
+
# Behavior-Driven Development test cases
|
|
7
|
+
# Each test case follows Given-When-Then structure
|
|
8
|
+
|
|
9
|
+
# Example test cases:
|
|
10
|
+
- given: "A valid input is provided"
|
|
11
|
+
when: "The transform operation is executed"
|
|
12
|
+
then:
|
|
13
|
+
output: "The input is transformed according to specification"
|
|
14
|
+
status: "success"
|
|
15
|
+
execution_time_ms: "< 50"
|
|
16
|
+
|
|
17
|
+
- given: "An empty input is provided"
|
|
18
|
+
when: "The transform operation is executed"
|
|
19
|
+
then:
|
|
20
|
+
output: "Empty input is returned"
|
|
21
|
+
status: "success"
|
|
22
|
+
execution_time_ms: "< 10"
|
|
23
|
+
|
|
24
|
+
- given: "Invalid input data is provided"
|
|
25
|
+
when: "The transform operation is executed"
|
|
26
|
+
then:
|
|
27
|
+
error: "ValidationError is raised"
|
|
28
|
+
error_message: "Input validation failed"
|
|
29
|
+
status: "error"
|
|
30
|
+
|
|
31
|
+
# Performance Expectations
|
|
32
|
+
expectations:
|
|
33
|
+
performance:
|
|
34
|
+
# Expected performance characteristics
|
|
35
|
+
latency:
|
|
36
|
+
p50_ms: 10
|
|
37
|
+
p90_ms: 25
|
|
38
|
+
p99_ms: 50
|
|
39
|
+
max_ms: 100
|
|
40
|
+
|
|
41
|
+
throughput:
|
|
42
|
+
operations_per_second: 100
|
|
43
|
+
batch_size: 10
|
|
44
|
+
parallel_workers: 4
|
|
45
|
+
|
|
46
|
+
resource_usage:
|
|
47
|
+
memory_mb:
|
|
48
|
+
min: 5
|
|
49
|
+
max: 50
|
|
50
|
+
typical: 15
|
|
51
|
+
cpu_percent:
|
|
52
|
+
min: 1
|
|
53
|
+
max: 25
|
|
54
|
+
typical: 5
|
|
55
|
+
|
|
56
|
+
quality:
|
|
57
|
+
# Quality expectations and metrics
|
|
58
|
+
correctness:
|
|
59
|
+
accuracy_percent: 100
|
|
60
|
+
error_rate_percent: 0
|
|
61
|
+
data_integrity: true
|
|
62
|
+
|
|
63
|
+
reliability:
|
|
64
|
+
availability_percent: 99.9
|
|
65
|
+
mean_time_between_failures_hours: 1000
|
|
66
|
+
recovery_time_seconds: 10
|
|
67
|
+
|
|
68
|
+
maintainability:
|
|
69
|
+
code_coverage_percent: 95
|
|
70
|
+
cyclomatic_complexity_max: 10
|
|
71
|
+
documentation_coverage_percent: 80
|
|
72
|
+
|
|
73
|
+
# Validation Criteria
|
|
74
|
+
validation:
|
|
75
|
+
# Criteria for validating implementation against specification
|
|
76
|
+
input_validation:
|
|
77
|
+
# Input validation rules
|
|
78
|
+
required_fields: []
|
|
79
|
+
optional_fields: []
|
|
80
|
+
field_constraints:
|
|
81
|
+
# Example:
|
|
82
|
+
# string_field:
|
|
83
|
+
# type: "string"
|
|
84
|
+
# min_length: 1
|
|
85
|
+
# max_length: 1000
|
|
86
|
+
# pattern: "^[a-zA-Z0-9]+$"
|
|
87
|
+
|
|
88
|
+
output_validation:
|
|
89
|
+
# Output validation rules
|
|
90
|
+
required_fields: []
|
|
91
|
+
field_constraints:
|
|
92
|
+
# Similar to input_validation but for outputs
|
|
93
|
+
pass
|
|
94
|
+
|
|
95
|
+
business_rules:
|
|
96
|
+
# Business logic validation
|
|
97
|
+
rules:
|
|
98
|
+
# Example:
|
|
99
|
+
# - name: "data_integrity"
|
|
100
|
+
# description: "Output must be derived from input"
|
|
101
|
+
# validation: "output_contains_input_elements"
|
|
102
|
+
# - name: "format_compliance"
|
|
103
|
+
# description: "Output must match required format"
|
|
104
|
+
# validation: "output_matches_schema"
|
|
105
|
+
|
|
106
|
+
# Edge Cases and Boundary Conditions
|
|
107
|
+
edge_cases:
|
|
108
|
+
# Specific edge cases to test
|
|
109
|
+
boundary_values:
|
|
110
|
+
# Example:
|
|
111
|
+
# - input: "empty string"
|
|
112
|
+
# expected: "empty output"
|
|
113
|
+
# - input: "maximum size string"
|
|
114
|
+
# expected: "successful transformation"
|
|
115
|
+
# - input: "special characters only"
|
|
116
|
+
# expected: "successful transformation"
|
|
117
|
+
|
|
118
|
+
error_conditions:
|
|
119
|
+
# Example:
|
|
120
|
+
# - condition: "null input"
|
|
121
|
+
# expected: "ValidationError"
|
|
122
|
+
# - condition: "invalid type"
|
|
123
|
+
# expected: "TypeError"
|
|
124
|
+
# - condition: "oversized input"
|
|
125
|
+
# expected: "SizeError"
|
|
126
|
+
|
|
127
|
+
concurrency:
|
|
128
|
+
# Concurrent execution scenarios
|
|
129
|
+
scenarios:
|
|
130
|
+
# Example:
|
|
131
|
+
# - scenario: "multiple simultaneous executions"
|
|
132
|
+
# expected: "no race conditions"
|
|
133
|
+
# - scenario: "shared resource access"
|
|
134
|
+
# expected: "proper synchronization"
|
|
135
|
+
|
|
136
|
+
# Regression Tests
|
|
137
|
+
regression:
|
|
138
|
+
# Regression test suite
|
|
139
|
+
test_suite:
|
|
140
|
+
# Example regression tests
|
|
141
|
+
- name: "basic_functionality_test"
|
|
142
|
+
description: "Verify basic transformation works"
|
|
143
|
+
test_data: "sample_input.txt"
|
|
144
|
+
expected_output: "expected_output.txt"
|
|
145
|
+
|
|
146
|
+
- name: "performance_regression_test"
|
|
147
|
+
description: "Ensure performance doesn't degrade"
|
|
148
|
+
benchmark_time_ms: 50
|
|
149
|
+
tolerance_percent: 20
|
|
150
|
+
|
|
151
|
+
baseline_metrics:
|
|
152
|
+
# Baseline metrics for regression detection
|
|
153
|
+
version: "1.0.0"
|
|
154
|
+
performance_baseline:
|
|
155
|
+
mean_latency_ms: 10
|
|
156
|
+
p99_latency_ms: 50
|
|
157
|
+
throughput_ops_per_sec: 100
|
|
158
|
+
|
|
159
|
+
# Integration Tests
|
|
160
|
+
integration:
|
|
161
|
+
# Integration test scenarios
|
|
162
|
+
dependencies:
|
|
163
|
+
# Test with actual dependencies
|
|
164
|
+
# Example:
|
|
165
|
+
# - name: "database_integration"
|
|
166
|
+
# description: "Test with real database"
|
|
167
|
+
# setup: "create_test_database"
|
|
168
|
+
# teardown: "cleanup_test_database"
|
|
169
|
+
|
|
170
|
+
api_compatibility:
|
|
171
|
+
# API compatibility tests
|
|
172
|
+
# Example:
|
|
173
|
+
# - endpoint: "transform"
|
|
174
|
+
# method: "POST"
|
|
175
|
+
# request_schema: "transform_request.json"
|
|
176
|
+
# response_schema: "transform_response.json"
|
|
177
|
+
|
|
178
|
+
# Security Tests
|
|
179
|
+
security:
|
|
180
|
+
# Security-related test cases
|
|
181
|
+
vulnerabilities:
|
|
182
|
+
# Example:
|
|
183
|
+
# - type: "injection"
|
|
184
|
+
# test_input: "malicious_string'; DROP TABLE users; --"
|
|
185
|
+
# expected_behavior: "rejected or sanitized"
|
|
186
|
+
# - type: "buffer_overflow"
|
|
187
|
+
# test_input: "very_long_string_repeated_10000_times"
|
|
188
|
+
# expected_behavior: "graceful handling"
|
|
189
|
+
|
|
190
|
+
access_control:
|
|
191
|
+
# Access control tests
|
|
192
|
+
# Example:
|
|
193
|
+
# - role: "unauthorized_user"
|
|
194
|
+
# action: "execute"
|
|
195
|
+
# expected: "access_denied"
|
|
196
|
+
# - role: "authorized_user"
|
|
197
|
+
# action: "execute"
|
|
198
|
+
# expected: "success"
|
|
199
|
+
|
|
200
|
+
# Compliance and Audit
|
|
201
|
+
compliance:
|
|
202
|
+
# Compliance requirements and tests
|
|
203
|
+
standards:
|
|
204
|
+
# Example:
|
|
205
|
+
# - standard: "GDPR"
|
|
206
|
+
# requirement: "data_protection"
|
|
207
|
+
# test: "verify_no_pii_exposure"
|
|
208
|
+
# - standard: "SOC2"
|
|
209
|
+
# requirement: "audit_trail"
|
|
210
|
+
# test: "verify_execution_logging"
|
|
211
|
+
|
|
212
|
+
audit_requirements:
|
|
213
|
+
# Audit trail requirements
|
|
214
|
+
logging:
|
|
215
|
+
- "execution_start"
|
|
216
|
+
- "execution_success"
|
|
217
|
+
- "execution_failure"
|
|
218
|
+
- "performance_metrics"
|
|
219
|
+
|
|
220
|
+
retention:
|
|
221
|
+
logs_retention_days: 90
|
|
222
|
+
audit_data_retention_days: 365
|
|
223
|
+
|
|
224
|
+
# Continuous Monitoring
|
|
225
|
+
monitoring:
|
|
226
|
+
# Runtime monitoring expectations
|
|
227
|
+
alerts:
|
|
228
|
+
# Example:
|
|
229
|
+
# - metric: "error_rate"
|
|
230
|
+
# threshold: "> 5%"
|
|
231
|
+
# severity: "warning"
|
|
232
|
+
# - metric: "latency_p99"
|
|
233
|
+
# threshold: "> 100ms"
|
|
234
|
+
# severity: "critical"
|
|
235
|
+
|
|
236
|
+
dashboards:
|
|
237
|
+
# Required monitoring dashboards
|
|
238
|
+
# Example:
|
|
239
|
+
# - name: "performance_dashboard"
|
|
240
|
+
# metrics: ["latency", "throughput", "error_rate"]
|
|
241
|
+
# - name: "quality_dashboard"
|
|
242
|
+
# metrics: ["accuracy", "availability", "resource_usage"]
|
|
243
|
+
|
|
244
|
+
# Version History
|
|
245
|
+
version_history:
|
|
246
|
+
# Track changes and their impact on expectations
|
|
247
|
+
current_version: "1.0.0"
|
|
248
|
+
changes:
|
|
249
|
+
# Example:
|
|
250
|
+
# - version: "1.0.0"
|
|
251
|
+
# date: "2024-01-01"
|
|
252
|
+
# changes: ["initial_release"]
|
|
253
|
+
# impact: "baseline_expectations_established"
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Concrete Implementation Template for CLM
|
|
2
|
+
# This template defines the HOW dimension - the implementation details
|
|
3
|
+
|
|
4
|
+
# Operation Type
|
|
5
|
+
operation: "transform" # Type of operation (e.g., "transform", "validate", "compute", "identity")
|
|
6
|
+
|
|
7
|
+
# Implementation Details
|
|
8
|
+
implementation:
|
|
9
|
+
# Core implementation logic
|
|
10
|
+
# Example:
|
|
11
|
+
# algorithm: "map_transform"
|
|
12
|
+
# steps:
|
|
13
|
+
# - "validate_input"
|
|
14
|
+
# - "apply_transformation"
|
|
15
|
+
# - "validate_output"
|
|
16
|
+
|
|
17
|
+
# Input handling
|
|
18
|
+
inputs:
|
|
19
|
+
# Map abstract inputs to concrete parameters
|
|
20
|
+
# Example:
|
|
21
|
+
# data:
|
|
22
|
+
# parameter_name: "input_data"
|
|
23
|
+
# validation: "validate_utf8"
|
|
24
|
+
# transformation: "normalize_line_endings"
|
|
25
|
+
|
|
26
|
+
# Output handling
|
|
27
|
+
outputs:
|
|
28
|
+
# Map concrete outputs to abstract specifications
|
|
29
|
+
# Example:
|
|
30
|
+
# result:
|
|
31
|
+
# source: "processed_data"
|
|
32
|
+
# format: "json"
|
|
33
|
+
# encoding: "utf-8"
|
|
34
|
+
|
|
35
|
+
# Algorithm Specification
|
|
36
|
+
algorithm:
|
|
37
|
+
# Detailed algorithm description
|
|
38
|
+
name: "" # Algorithm name
|
|
39
|
+
complexity: "" # Time/space complexity (e.g., "O(n)", "O(n log n)")
|
|
40
|
+
|
|
41
|
+
# Step-by-step process
|
|
42
|
+
steps:
|
|
43
|
+
# Example:
|
|
44
|
+
# - name: "validate_input"
|
|
45
|
+
# description: "Check input data validity"
|
|
46
|
+
# implementation: "validate_utf8_length"
|
|
47
|
+
# - name: "transform_data"
|
|
48
|
+
# description: "Apply transformation function"
|
|
49
|
+
# implementation: "apply_transformation_function"
|
|
50
|
+
# - name: "format_output"
|
|
51
|
+
# description: "Format output according to specification"
|
|
52
|
+
# implementation: "format_as_json"
|
|
53
|
+
|
|
54
|
+
# Transform Function
|
|
55
|
+
transform_function: "" # Name of transformation function
|
|
56
|
+
# Pre-defined options: "upper_case", "lower_case", "count_bytes", "identity", "reverse", "sort"
|
|
57
|
+
|
|
58
|
+
# Custom Implementation
|
|
59
|
+
custom_code:
|
|
60
|
+
# For custom Python code (when transform_function is "custom")
|
|
61
|
+
enabled: false
|
|
62
|
+
code: "" # Python code string
|
|
63
|
+
dependencies: [] # Required imports
|
|
64
|
+
|
|
65
|
+
# Error Handling
|
|
66
|
+
error_handling:
|
|
67
|
+
# How errors are handled
|
|
68
|
+
strategy: "raise" # Options: "raise", "return_error", "log_continue"
|
|
69
|
+
|
|
70
|
+
# Error types and handling
|
|
71
|
+
error_types:
|
|
72
|
+
# Example:
|
|
73
|
+
# validation_error:
|
|
74
|
+
# action: "raise"
|
|
75
|
+
# message: "Input validation failed"
|
|
76
|
+
# runtime_error:
|
|
77
|
+
# action: "log_continue"
|
|
78
|
+
# message: "Runtime error, returning None"
|
|
79
|
+
|
|
80
|
+
# Fallback behavior
|
|
81
|
+
fallback:
|
|
82
|
+
enabled: false
|
|
83
|
+
action: "return_none" # Options: "return_none", "return_default", "retry"
|
|
84
|
+
|
|
85
|
+
# Resource Requirements
|
|
86
|
+
resources:
|
|
87
|
+
# System resource requirements
|
|
88
|
+
memory:
|
|
89
|
+
min: "10MB"
|
|
90
|
+
max: "100MB"
|
|
91
|
+
strategy: "proportional_to_input" # Options: "fixed", "proportional_to_input"
|
|
92
|
+
|
|
93
|
+
cpu:
|
|
94
|
+
cores: 1
|
|
95
|
+
intensity: "low" # Options: "low", "medium", "high"
|
|
96
|
+
|
|
97
|
+
io:
|
|
98
|
+
disk_access: false
|
|
99
|
+
network_access: false
|
|
100
|
+
max_bandwidth: "1MB/s"
|
|
101
|
+
|
|
102
|
+
# Performance Characteristics
|
|
103
|
+
performance:
|
|
104
|
+
# Expected performance metrics
|
|
105
|
+
execution_time:
|
|
106
|
+
min_ms: 1
|
|
107
|
+
max_ms: 100
|
|
108
|
+
typical_ms: 10
|
|
109
|
+
|
|
110
|
+
throughput:
|
|
111
|
+
operations_per_second: 100
|
|
112
|
+
unit: "items"
|
|
113
|
+
|
|
114
|
+
scalability:
|
|
115
|
+
linear: true # Whether performance scales linearly with input size
|
|
116
|
+
max_input_size: "1MB"
|
|
117
|
+
|
|
118
|
+
# Security Considerations
|
|
119
|
+
security:
|
|
120
|
+
# Security-related implementation details
|
|
121
|
+
input_validation: true
|
|
122
|
+
output_sanitization: true
|
|
123
|
+
resource_limits: true
|
|
124
|
+
|
|
125
|
+
# Access control
|
|
126
|
+
permissions:
|
|
127
|
+
read: true
|
|
128
|
+
execute: true
|
|
129
|
+
modify: false
|
|
130
|
+
delete: false
|
|
131
|
+
|
|
132
|
+
# Sandboxing
|
|
133
|
+
sandbox_required: false
|
|
134
|
+
isolation_level: "process" # Options: "process", "thread", "none"
|
|
135
|
+
|
|
136
|
+
# Testing Support
|
|
137
|
+
testing:
|
|
138
|
+
# Testing-specific implementation details
|
|
139
|
+
mock_enabled: true
|
|
140
|
+
deterministic: true # Whether results are deterministic
|
|
141
|
+
|
|
142
|
+
# Test data requirements
|
|
143
|
+
test_data:
|
|
144
|
+
generators:
|
|
145
|
+
- "random_string"
|
|
146
|
+
- "fixed_example"
|
|
147
|
+
sizes:
|
|
148
|
+
- "small: 1KB"
|
|
149
|
+
- "medium: 10KB"
|
|
150
|
+
- "large: 100KB"
|
|
151
|
+
|
|
152
|
+
# Monitoring and Observability
|
|
153
|
+
monitoring:
|
|
154
|
+
# Metrics and logging configuration
|
|
155
|
+
metrics_enabled: true
|
|
156
|
+
logging_level: "INFO"
|
|
157
|
+
|
|
158
|
+
# Custom metrics
|
|
159
|
+
custom_metrics:
|
|
160
|
+
- "transformation_time"
|
|
161
|
+
- "input_size"
|
|
162
|
+
- "output_size"
|
|
163
|
+
|
|
164
|
+
# Version Information
|
|
165
|
+
implementation_version: "1.0.0"
|
|
166
|
+
compatibility_matrix:
|
|
167
|
+
# Compatible versions and features
|
|
168
|
+
min_ptr_version: "0.1.0"
|
|
169
|
+
supported_features:
|
|
170
|
+
- "caching"
|
|
171
|
+
- "batch_processing"
|
|
172
|
+
- "async_execution"
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import contextlib
|
|
2
|
+
import json
|
|
3
|
+
import os
|
|
4
|
+
import re
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
import yaml
|
|
8
|
+
|
|
9
|
+
from .exceptions import TypeValidationError
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class TypeRegistry:
|
|
13
|
+
def __init__(self, clm_root: str):
|
|
14
|
+
self.clm_root = clm_root
|
|
15
|
+
self.types_dir = os.path.join(clm_root, "types")
|
|
16
|
+
self.registry: dict[str, dict[str, Any]] = {}
|
|
17
|
+
self.content_types: dict[str, dict[str, Any]] = {}
|
|
18
|
+
self.transport_types: dict[str, dict[str, Any]] = {}
|
|
19
|
+
self.load_registry()
|
|
20
|
+
|
|
21
|
+
def load_registry(self):
|
|
22
|
+
if not os.path.exists(self.types_dir):
|
|
23
|
+
return
|
|
24
|
+
|
|
25
|
+
subdirs = ["meta", "primitives", "runtime", "content", "transport", "codegen"]
|
|
26
|
+
for subdir in subdirs:
|
|
27
|
+
subdir_path = os.path.join(self.types_dir, subdir)
|
|
28
|
+
if not os.path.exists(subdir_path):
|
|
29
|
+
continue
|
|
30
|
+
for fname in os.listdir(subdir_path):
|
|
31
|
+
if fname.endswith(".yaml") or fname.endswith(".yml"):
|
|
32
|
+
name = os.path.splitext(fname)[0]
|
|
33
|
+
fpath = os.path.join(subdir_path, fname)
|
|
34
|
+
try:
|
|
35
|
+
with open(fpath, encoding="utf-8") as f:
|
|
36
|
+
data = yaml.safe_load(f)
|
|
37
|
+
inner = data.get("clm", data)
|
|
38
|
+
concrete = inner.get("concrete_impl", {})
|
|
39
|
+
|
|
40
|
+
universe_level = concrete.get("universe_level", 0)
|
|
41
|
+
schema = concrete.get("schema", {})
|
|
42
|
+
|
|
43
|
+
type_info = {
|
|
44
|
+
"name": name,
|
|
45
|
+
"path": fpath,
|
|
46
|
+
"universe_level": int(universe_level),
|
|
47
|
+
"schema": schema,
|
|
48
|
+
"concrete": concrete
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
self.registry[name.lower()] = type_info
|
|
52
|
+
|
|
53
|
+
# Content types
|
|
54
|
+
if subdir == "content":
|
|
55
|
+
ct = concrete.get("content_type", {})
|
|
56
|
+
mime = ct.get("mime")
|
|
57
|
+
if mime:
|
|
58
|
+
self.content_types[mime] = type_info
|
|
59
|
+
|
|
60
|
+
# Transport types
|
|
61
|
+
if subdir == "transport":
|
|
62
|
+
tp = concrete.get("transport", {})
|
|
63
|
+
proto = tp.get("protocol")
|
|
64
|
+
if proto:
|
|
65
|
+
self.transport_types[name.lower()] = type_info
|
|
66
|
+
|
|
67
|
+
except Exception:
|
|
68
|
+
pass
|
|
69
|
+
|
|
70
|
+
def get_type_info(self, type_name: str) -> dict[str, Any] | None:
|
|
71
|
+
return self.registry.get(type_name.lower())
|
|
72
|
+
|
|
73
|
+
def validate(self, type_name: str, value: Any, parent_level: int = 999):
|
|
74
|
+
type_info = self.get_type_info(type_name)
|
|
75
|
+
if not type_info:
|
|
76
|
+
raise TypeValidationError(f"Unknown type '{type_name}'")
|
|
77
|
+
|
|
78
|
+
level = type_info["universe_level"]
|
|
79
|
+
if level > parent_level:
|
|
80
|
+
raise TypeValidationError(
|
|
81
|
+
f"STRATIFICATION_ERROR: Type '{type_name}' at Level {level} cannot be nested inside a Level {parent_level} parent type context."
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
schema = type_info["schema"]
|
|
85
|
+
|
|
86
|
+
# Parse string value to JSON if the type expects structured data and value is a string
|
|
87
|
+
parsed_val = value
|
|
88
|
+
if isinstance(value, str):
|
|
89
|
+
val_trimmed = value.strip()
|
|
90
|
+
if (val_trimmed.startswith("{") and val_trimmed.endswith("}")) or \
|
|
91
|
+
(val_trimmed.startswith("[") and val_trimmed.endswith("]")):
|
|
92
|
+
with contextlib.suppress(Exception):
|
|
93
|
+
parsed_val = json.loads(val_trimmed)
|
|
94
|
+
|
|
95
|
+
style = _detect_style(schema)
|
|
96
|
+
fn = _SCHEMA_STYLE_DISPATCH[style]
|
|
97
|
+
fn(self, type_name, value, parsed_val, schema, level)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
# ---------------------------------------------------------------------------
|
|
101
|
+
# Sprint 133.5: Dispatch table for schema-style validation
|
|
102
|
+
# ---------------------------------------------------------------------------
|
|
103
|
+
|
|
104
|
+
def _detect_style(schema: dict) -> str:
|
|
105
|
+
"""Detect which schema style the type uses."""
|
|
106
|
+
if schema.get("constraints"):
|
|
107
|
+
return "primitive"
|
|
108
|
+
if schema.get("required_fields") is not None or schema.get("optional_fields") is not None:
|
|
109
|
+
return "field_list"
|
|
110
|
+
if schema.get("required") is not None or schema.get("properties") is not None:
|
|
111
|
+
return "json_schema"
|
|
112
|
+
return "primitive"
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def _validate_primitive(registry, type_name, value, parsed_val, schema, level):
|
|
116
|
+
"""Validate primitive types (pattern + type_check constraints)."""
|
|
117
|
+
constraints = schema.get("constraints", {})
|
|
118
|
+
pattern = constraints.get("pattern")
|
|
119
|
+
type_check = constraints.get("type_check")
|
|
120
|
+
|
|
121
|
+
if pattern and pattern != "null" and not re.search(pattern, str(value)):
|
|
122
|
+
raise TypeValidationError(f"Value '{value}' violates pattern '{pattern}' for type '{type_name}'")
|
|
123
|
+
|
|
124
|
+
if type_check and type_check != "null":
|
|
125
|
+
if type_check == "is_integer":
|
|
126
|
+
if not re.match(r"^-?[0-9]+$", str(value)):
|
|
127
|
+
raise TypeValidationError(f"Value '{value}' is not a valid integer for type '{type_name}'")
|
|
128
|
+
elif type_check == "is_boolean":
|
|
129
|
+
if str(value).lower() not in ("true", "false"):
|
|
130
|
+
raise TypeValidationError(f"Value '{value}' is not a valid boolean for type '{type_name}'")
|
|
131
|
+
elif type_check == "is_string":
|
|
132
|
+
if isinstance(parsed_val, dict | list):
|
|
133
|
+
raise TypeValidationError(f"Structural payload is not a valid string for type '{type_name}'")
|
|
134
|
+
if re.match(r"^-?[0-9]+(\.[0-9]+)?$", str(value)) or str(value).lower() in ("true", "false"):
|
|
135
|
+
raise TypeValidationError(f"Value '{value}' is not a valid string for type '{type_name}'")
|
|
136
|
+
elif type_check == "is_list":
|
|
137
|
+
if not isinstance(parsed_val, list):
|
|
138
|
+
raise TypeValidationError(f"Value '{value}' is not a valid list structure for type '{type_name}'")
|
|
139
|
+
elif type_check == "is_map":
|
|
140
|
+
if not isinstance(parsed_val, dict):
|
|
141
|
+
raise TypeValidationError(f"Value '{value}' is not a valid map structure for type '{type_name}'")
|
|
142
|
+
elif type_check == "is_process_payload" and not isinstance(parsed_val, dict | list):
|
|
143
|
+
raise TypeValidationError(f"Value '{value}' is not a valid process payload (must be map or list) for type '{type_name}'")
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def _validate_field_list(registry, type_name, value, parsed_val, schema, level):
|
|
147
|
+
"""Validate using required_fields / optional_fields style."""
|
|
148
|
+
if not isinstance(parsed_val, dict):
|
|
149
|
+
raise TypeValidationError(f"Value is not a map/object structure required by type '{type_name}'")
|
|
150
|
+
|
|
151
|
+
required_fields = schema.get("required_fields") or []
|
|
152
|
+
optional_fields = schema.get("optional_fields") or []
|
|
153
|
+
|
|
154
|
+
for field in required_fields:
|
|
155
|
+
f_name = field.get("name")
|
|
156
|
+
f_type = field.get("type")
|
|
157
|
+
if f_name not in parsed_val:
|
|
158
|
+
raise TypeValidationError(f"Missing required field '{f_name}' of type '{f_type}' in type '{type_name}'")
|
|
159
|
+
|
|
160
|
+
f_val = parsed_val[f_name]
|
|
161
|
+
registry.validate(f_type, f_val, level)
|
|
162
|
+
|
|
163
|
+
f_enum = field.get("enum")
|
|
164
|
+
if f_enum and str(f_val) not in [str(e) for e in f_enum]:
|
|
165
|
+
raise TypeValidationError(f"Value '{f_val}' is not in enum {f_enum} for field '{f_name}' in type '{type_name}'")
|
|
166
|
+
|
|
167
|
+
for field in optional_fields:
|
|
168
|
+
f_name = field.get("name")
|
|
169
|
+
f_type = field.get("type")
|
|
170
|
+
if f_name in parsed_val:
|
|
171
|
+
f_val = parsed_val[f_name]
|
|
172
|
+
if f_val is not None and str(f_val) != "null":
|
|
173
|
+
registry.validate(f_type, f_val, level)
|
|
174
|
+
|
|
175
|
+
f_enum = field.get("enum")
|
|
176
|
+
if f_enum and str(f_val) not in [str(e) for e in f_enum]:
|
|
177
|
+
raise TypeValidationError(f"Value '{f_val}' is not in enum {f_enum} for field '{f_name}' in type '{type_name}'")
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def _validate_json_schema(registry, type_name, value, parsed_val, schema, level):
|
|
181
|
+
"""Validate using JSON Schema style (required / properties)."""
|
|
182
|
+
if not isinstance(parsed_val, dict):
|
|
183
|
+
raise TypeValidationError(f"Value is not a map/object structure required by type '{type_name}'")
|
|
184
|
+
|
|
185
|
+
required_props = schema.get("required") or []
|
|
186
|
+
properties = schema.get("properties") or {}
|
|
187
|
+
|
|
188
|
+
for f_name in required_props:
|
|
189
|
+
if f_name not in parsed_val:
|
|
190
|
+
raise TypeValidationError(f"Missing required field '{f_name}' in type '{type_name}'")
|
|
191
|
+
|
|
192
|
+
f_val = parsed_val[f_name]
|
|
193
|
+
f_info = properties.get(f_name, {})
|
|
194
|
+
f_type = f_info.get("type")
|
|
195
|
+
f_pattern = f_info.get("pattern")
|
|
196
|
+
|
|
197
|
+
if f_pattern and not re.search(f_pattern, str(f_val)):
|
|
198
|
+
raise TypeValidationError(f"Field '{f_name}' value '{f_val}' violates pattern '{f_pattern}' in type '{type_name}'")
|
|
199
|
+
|
|
200
|
+
if f_type:
|
|
201
|
+
resolved_type = f_type
|
|
202
|
+
if f_type == "array":
|
|
203
|
+
resolved_type = "list"
|
|
204
|
+
elif f_type == "object":
|
|
205
|
+
resolved_type = "map"
|
|
206
|
+
registry.validate(resolved_type, f_val, level)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
_SCHEMA_STYLE_DISPATCH = {
|
|
210
|
+
"primitive": _validate_primitive,
|
|
211
|
+
"field_list": _validate_field_list,
|
|
212
|
+
"json_schema": _validate_json_schema,
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def load_clm_features(clm_root: str | None = None) -> dict[str, Any]:
|
|
217
|
+
"""Loads the SSOT Type Lattice functional features from types/lattice/clm_features.yaml."""
|
|
218
|
+
if clm_root is None:
|
|
219
|
+
clm_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../.."))
|
|
220
|
+
features_path = os.path.join(clm_root, "types", "lattice", "clm_features.yaml")
|
|
221
|
+
with open(features_path, encoding="utf-8") as f:
|
|
222
|
+
return yaml.safe_load(f)
|
|
223
|
+
|