cjm-substrate
A dependency-isolated capability-composition runtime: heterogeneous tools run in their own environments behind a uniform HTTP/JSON boundary; the host composes them into workflows with resource-aware scheduling and threads provenance through a context graph.
Modules
cjm_substrate.bootstrap— One-call factory that assembles a CapabilityManager + JobQueue + capabilitycjm_substrate.cli— CLI tool for declarative capability management.cjm_substrate.core._telemetry— Shared GPU/CPU attribution helpers used by both JobQueue._sample_resource_snapshot (CR-6 Stage 3) and CapabilityManager._record_sample_safe (CR-7).cjm_substrate.core.adapter— The typed-task half of the capability-unit fracture (pass-2 Thread 3) —cjm_substrate.core.adapter_manifest— The ADAPTER unit's registration manifest + the surface-based compatibility matcher (CR-17 pt 2, stage 4). Pass-2 Thread 3: registration/discovery = per-unit manifests generated in-env and found by discover_manifests(); compatibility is DERIVED, not declared — the capability records only its structural surface, the adapter declares its protocol (recorded here as member names + parameter lists), and the substrate matches manifest-vs-manifest. Works against UNLOADED capabilities with zero protocol imports host-side.cjm_substrate.core.capability— The tool-capability interface — the manage-the-tool half of the capability-unit fracture (pass-2 Thread 3): identity, lifecycle, config, cancellation, and observability for a tool running in a worker process, serving both concrete capabilities (in workers) and remote proxies (in the host). The task channel is deliberately NOT here: typed task contracts live on task adapters (core.adapter + the per-task cjm--adapter-interface libraries) and results cross the worker boundary through the typed wire layer (core.wire); execute_stream's transitional default remains for fused-era capabilities only. Also home to the CR-12 worker-env contract (EnvVarSpec + the Q1-A template vocabulary), the SG-44/T28 action-dispatcher convention, and the pass-2 Thread-3 structural-surface derivation.cjm_substrate.core.config— Project-level configuration for paths, runtime settings, and environment management.cjm_substrate.core.config_store— Persistent storage for per-capability configuration (with enabled flag).cjm_substrate.core.diagnostics_store— CR-14 (stage 7): the disposable diagnostic-narrative class. Worker-writtencjm_substrate.core.empirical_store— Persistent store for empirically-observed resource usage per (instance_id, config_hash) pair. CR-7's data foundation — record_sample is called from CapabilityManager.execute_capability* finally blocks; aggregates feed eviction-candidate selection + future UI hints + cost-aware retry decisions.cjm_substrate.core.errors— Typed exception hierarchy + JobError dataclass + default classification of bare Python exceptions. The substrate's CR-5 implementation per the 2026-05-19 substrate audit.cjm_substrate.core.journal_store— CR-14 (stage 7): the durable account-of-action. One substrate-derived,cjm_substrate.core.manager— Capability discovery, loading, and lifecycle management via process isolation.cjm_substrate.core.manifest_format— Typed parser + writer for the nested v2.0 manifest layout (2026-05-19 substrate audit, CR-8).cjm_substrate.core.metadata— Data structures for capability metadata.cjm_substrate.core.platform— Cross-platform utilities for process management, path handling, and system detection (Linux, macOS, Windows).cjm_substrate.core.ports— Capability compositions as DAGs of invocation nodes with typed input/outputcjm_substrate.core.proxy— Host-side bridge to isolated capability workers: RemoteCapabilityProxy implements ToolCapability but forwards every call over HTTP to a Universal Worker subprocess running in the capability's own environment. Owns worker process management (spawn with the manifest's python_path, SG-4 parent-bound listening socket / FD inheritance, suicide-pact --ppid, CR-14 stream pump + lifecycle journaling), zero-copy input transfer (FileBackedDTO -> temp files), the typed error contracts crossing the wire (409 -> CapabilityCancelledError; _job_error 500 bodies and stream terminal chunks -> typed exceptions; CR-7 Track A worker-death classification), and a dual sync/async interface for scripts and FastHTML hosts.cjm_substrate.core.queue— Resource-aware multi-lane job queue for capability execution (stage 3 / CR-16 rework).cjm_substrate.core.scheduling— Resource scheduling policies for capability execution.cjm_substrate.core.secret_store— CR-12: project-local secret storage for API-based capabilities (file-backed, 0600).cjm_substrate.core.wire— Typed data transfer at the worker boundary — the zero-copy FileBackedDTOcjm_substrate.core.worker— FastAPI server that runs inside isolated capability environments (the Universal Worker): dynamically loads the capability class named on the CLI, exposes the HTTP lifecycle / execute / task / monitor surface for the proxy, monitors the parent process (the suicide-pact watchdog prevents zombie workers), and reports process-subtree telemetry for resource-scheduling decisions. This module is a process ENTRYPOINT (SG-39): host code never imports it.cjm_substrate.utils.cache_paths— Per-(input-content, config) deterministic cache directories for capability outputs. Same (input content, action, config) always resolves to the same directory; any change to input content OR config produces a different one — no silent overwrites, no stale-artifact accumulation, and chained invalidation for capability sequences (see the cache-paths-design-provenance note for the ffmpeg-bug origin story).cjm_substrate.utils.hashing— Shared cryptographic hashing primitives for content integrity verification.cjm_substrate.utils.validation— Validation helpers for capability configuration dataclasses.tests.test_adapter— TaskAdapter shape test (projected from nbs/core/adapter.ipynb cell c74f6c0e7adetests.test_adapter_manifest— Adapter-manifest matcher tests (projected from nbs/core/adapter_manifest.ipynbtests.test_bootstrap— Bootstrap tests (projected from nbs/bootstrap.ipynb cell smoke-test at thetests.test_cache_paths— Cache-path tests (projected from nbs/utils/cache_paths.ipynb cell cell-teststests.test_capability— ToolCapability tests (projected from nbs/core/capability.ipynb #|hide cellstests.test_cli— CLI validator + source-lint tests (projected from nbs/cli.ipynb hide cellstests.test_config— Configuration tests (projected from nbs/core/config.ipynb cellstests.test_config_store— Config-store tests (projected from nbs/core/config_store.ipynb cell smoke-testtests.test_diagnostics_store— Diagnostics-store tests (projected from nbs/core/diagnostics_store.ipynbtests.test_empirical_store— Empirical-store tests (projected from nbs/core/empirical_store.ipynb cellstests.test_errors— Error-taxonomy regression tests (projected from nbs/core/errors.ipynb cellstests.test_hashing— Hashing-utility tests (projected from nbs/utils/hashing.ipynb cellstests.test_journal_store— Journal-store tests (projected from nbs/core/journal_store.ipynb cellstests.test_manager— CapabilityManager tests (projected from nbs/core/manager.ipynb hide cellstests.test_manifest_format— Manifest-format tests (projected from nbs/core/manifest_format.ipynb cellstests.test_metadata— Capability-metadata tests (projected from nbs/core/metadata.ipynb cellstests.test_platform— Platform-utilities tests (projected from nbs/core/platform.ipynb cellstests.test_ports— Composition-ports tests (projected from nbs/core/ports.ipynb cellstests.test_proxy— RemoteCapabilityProxy tests (projected from nbs/core/proxy.ipynb #|hidetests.test_queue— JobQueue tests (projected from nbs/core/queue.ipynb #|hide cells at thetests.test_scheduling— Scheduling-policy tests (authored at the golden-reference flip oftests.test_secret_store— Secret-store tests (projected from nbs/core/secret_store.ipynb cell smoke-testtests.test_telemetry— GPU-attribution helper tests (projected from nbs/core/telemetry.ipynb cellstests.test_validation— Validation-utility tests (projected from nbs/utils/validation.ipynb cellstests.test_wire— Typed-wire-layer tests (projected from nbs/core/wire.ipynb cells c8a35529 /tests.test_worker— Universal Worker tests (projected from nbs/core/worker.ipynb #|hide cells attests_manual.validate_stage7_observability_e2e— Stage-7 follow-up stress suite — the CR-14 observability record architecture.
API
cjm_substrate.bootstrap
Pipelineclass — Assembled substrate stack: manager + queue + capability bindings.create_pipelinefunction — Assemble a CapabilityManager + JobQueue + capability bindings in one call.
cjm_substrate.cli
generate_adapter_manifestfunction — CR-17 pt 2 (stage 4): introspect a task-adapter impl in-env and write its adapter manifest.install_allfunction — Install and register all capabilities defined in capabilities.yaml.list_capabilitiesfunction — List installed capabilities from manifest directory.list_secretsfunction — List the secret KEY NAMES stored for a capability — never the values (CR-12).logs_commandfunction — Tail / follow the observability stores (CR-14).mainfunction — cjm-substrate CLI for managing isolated capability environments.regenerate_manifestfunction — Re-run introspection for an installed capability and rewrite its manifest.remove_capabilityfunction — Remove a capability's manifest and conda environment.retention_commandfunction — Apply the diagnostics retention policy now (CR-14).run_cmdfunction — Run a shell command and stream output.set_secretfunction — Store a capability secret in the project-local SecretStore (CR-12).setup_hostfunction — Install interface libraries in the current Python environment.setup_runtimefunction — Download and setup micromamba runtime for project-local mode.validate_filefunction — SG-6 + T23: validate a manifest / capabilities.yaml / capability source.
cjm_substrate.core._telemetry
attribute_gpu_to_worker_subtreefunction — Attribute GPU memory across the worker's process subtree.
cjm_substrate.core.adapter
TaskAdapterclass — Base for task adapters — the typed-task half of the capability-unit
cjm_substrate.core.adapter_manifest
AdapterManifestclass — A discovered ADAPTER unit (CR-17 pt 2) — the registration record for oneadapter_manifest_from_dictfunction — Reconstruct anAdapterManifestfrom its on-disk JSON shape.is_adapter_manifestfunction — Route a manifest file by theunitdiscriminator (capability manifestsmatch_protocol_against_surfacefunction — Surface-based compatibility (pass-2 Thread 3) — host-side, manifest-vs-
cjm_substrate.core.capability
ConfigOptionclass — CR-11: one live option for a dynamic config field, with optional metadata.EnvVarSpecclass — CR-12: one entry of a capability's spawn-time worker-environment contract.FieldOptionsclass — CR-11: the live option domain for one dynamic config field.ToolCapabilityclass — Tool-capability interface: manage the tool/worker — identity, lifecycle,capability_actionfunction — Marker decorator tagging a capability method as the handler foraction_name.collect_capability_actionsfunction — Collect action names from@capability_action-decorated methods oncls.derive_structural_surfacefunction — Record a capability class's structural surface by pure self-introspection.expand_worker_env_templatefunction — Substitute${VAR}placeholders intemplateusingplaceholders.template_check_placeholdersfunction — Return the set of placeholder names referenced by a worker-env template.
cjm_substrate.core.config
CJMConfigclass — Main configuration for cjm-substrate.CondaTypeclass — Type of conda implementation to use.RuntimeConfigclass — Runtime environment configuration.RuntimeModeclass — Runtime mode for the capability system.SubstrateConfigclass — Substrate behavior toggles.get_configfunction — Get current config (loads defaults if not set).load_configfunction — Load config with layered resolution (CLI > env vars > yaml > defaults).reset_configfunction — Reset to unloaded state (for testing).set_configfunction — Set current config (called by CLI callback).
cjm_substrate.core.config_store
CapabilityConfigRecordclass — Persisted state for a capability: config dict + enabled flag.CapabilityConfigStoreclass — Protocol for persisting per-capabilityCapabilityConfigRecordacross sessions.LocalCapabilityConfigStoreclass — SQLite-backed default implementation ofCapabilityConfigStore.deletefunction — Remove the record for a capability.getfunction — Fetch the record for a capability.list_allfunction — Return all stored records keyed by capability name.setfunction — Persist a record. Stampsupdated_atto the current time.
cjm_substrate.core.diagnostics_store
DiagnosticRecordclass — One structured worker log record (CR-14 diagnostics class).DiagnosticsLogHandlerclass — Worker-side logging handler writingDiagnosticRecords (CR-14).DiagnosticsStoreclass — Protocol for the disposable diagnostic-narrative store (CR-14).LocalDiagnosticsStoreclass — SQLite-backed defaultDiagnosticsStore(CR-14).StreamChunkclass — One raw stdout/stderr line the host pump captured (death-rattle floor).append_chunkfunction — Persist one raw stream line.append_recordfunction — Persist one structured record.apply_retentionfunction — Retention as a QUERY (the CR-14 reframe's mechanical payoff).install_worker_diagnosticsfunction — Configure worker-process logging (replaces the oldbasicConfig).normalize_stream_linefunction — Collapse CR progress frames to the final frame; drop empty results.query_chunksfunction — Raw stream read, session-scoped.query_recordsfunction — Filtered structured-record read.
cjm_substrate.core.empirical_store
EmpiricalResourceRecordclass — Aggregated empirical resource profile for a (instance_id, config_hash) pair.EmpiricalResourceStoreclass — Protocol for persisting empirically-observed resource usage.LocalEmpiricalResourceStoreclass — SQLite-backed default implementation ofEmpiricalResourceStore.ResourceSampleclass — Single observation captured after an execute call completes.compute_config_hashfunction — CR-7: hash a capability instance's effective config for empirical-record keying.
cjm_substrate.core.errors
CapabilityCancelledErrorclass — Cooperative cancellation signal raised fromToolCapability.check_cancel().CapabilityConfigErrorclass — Unknown / invalid keys in a config dict against a capability's config schema.CapabilityDisabledErrorclass — JobQueue / execute_capability rejected: the capability is currently disabled.CapabilityErrorclass — Base for substrate-recognized capability exceptions.CapabilityFatalErrorclass — Bug / irrecoverable state. The capability cannot complete this job; retrying won't help.CapabilityInputErrorclass — User-fixable error: bad config, invalid argument, missing file.CapabilityNotLoadedErrorclass — Caller submitted to a capability that was never loaded.CapabilityResourceErrorclass — Resource exhaustion: GPU VRAM, system RAM, disk full.CapabilityTimeoutErrorclass — A per-job timeout fired before the capability finished.CapabilityTransientErrorclass — Temporary failure: timeout, network blip, brief resource contention.JobErrorclass — Structured failure summary recorded on a completed Job.ResourceShortfallclass — Quantitative gap between what a capability needed and what was available.TracebackPolicyclass — How much exception detail the substrate records on a JobError.WorkerOOMErrorclass — The worker subprocess died with a kill-signal during an active execute call.classify_exceptionfunction — Return the substrate category for any exception.map_bare_exception_to_job_errorfunction — Convert any exception into a structuredJobError.
cjm_substrate.core.journal_store
JournalEventclass — One durable observability record (CR-14).JournalStoreclass — Protocol for the durable account-of-action (CR-14).LocalJournalStoreclass — SQLite-backed defaultJournalStore(CR-14).SubstrateEventTypeclass — Journal vocabulary beyond the job-scopedJobEventTypeset (CR-14).appendfunction — Persist one event; sets and returnsevent.seq.countfunction — Total journal rows (volume regression checks).queryfunction — Filtered read; all filters AND-combined.terminal_state_eventsfunction — The durable job history (_historymigration rider): terminal
cjm_substrate.core.manager
CapabilityBindingclass — Pre-bound view of a single capability through a shared CapabilityManager.CapabilityManagerclass — Manages capability discovery, loading, and lifecycle via process isolation.
cjm_substrate.core.manifest_format
CodeSectionclass — Code-derived facts refreshed bycjm-ctl regenerate-manifest.DriftTrackingclass — Witness hashes for drift detection.InstallSectionclass — Deployment-specific facts populated at install time.ManifestV2class — Top-level v2.0 manifest with four named sections plusformat_version.compute_config_schema_hashfunction — Hash a JSON Schema with stable canonicalization.compute_structural_surface_hashfunction — Hash a structural surface with stable canonicalization.load_manifestfunction — Load a manifest file and return a typedManifestV2.manifest_to_dictfunction — Serialize aManifestV2to a v2.0 dict.write_manifestfunction — Serialize aManifestV2to disk in v2.0 nested layout (indent=2).
cjm_substrate.core.metadata
CapabilityInstanceclass — Per-instance runtime state for a loaded capability (CR-10 multi-instance).CapabilityLoadSpecclass — One entry inCapabilityManager.load_capabilities_concurrent's batch input (CR-10).CapabilityMetaclass — Metadata about a capability.ResourceRequirementsclass — Binary hard-facts about what a capability needs to run (Phase 5a).
cjm_substrate.core.platform
build_conda_commandfunction — Build a complete conda/mamba/micromamba command.conda_env_existsfunction — Check if a conda environment exists (cross-platform).download_micromambafunction — Download and extract micromamba binary to the specified path.ensure_runtime_availablefunction — Check if the configured conda/micromamba runtime is available.get_conda_commandfunction — Get the conda/mamba/micromamba base command with prefix args for local mode.get_current_platformfunction — Get current platform string for manifest filtering.get_micromamba_binary_pathfunction — Get the configured micromamba binary path for the current platform.get_micromamba_download_urlfunction — Get the micromamba download URL for the specified or current platform.get_popen_isolation_kwargsfunction — Return kwargs for process isolation in subprocess.Popen.get_python_in_envfunction — Get the Python executable path for a conda environment.is_apple_siliconfunction — Check if running on Apple Silicon Mac (for MPS detection).is_linuxfunction — Check if running on Linux.is_macosfunction — Check if running on macOS.is_windowsfunction — Check if running on Windows.run_shell_commandfunction — Run a shell command cross-platform.terminate_processfunction — Terminate a subprocess + its entire process subtree (grandchildren, etc).terminate_selffunction — Terminate the current process (for worker suicide pact).
cjm_substrate.core.ports
Compositionclass — A static DAG of capability-invocation nodes, submitted as one unit.CompositionBindingErrorclass — AnOutputRefcould not be resolved against the producer's recordedCompositionNodeclass — One capability invocation in a composition.CompositionNodeRunclass — Live state of one node within a composition run.CompositionRunclass — Tracks a submitted composition through execution (lives inCompositionValidationErrorclass — A composition failed submit-time validation (duplicate ids, unresolvedNodeStateclass — State of one composition node (and, for the terminal subset, of aOutputRefclass — Binding marker: this kwarg's value comes from an upstream node's result.extract_output_fieldfunction — Extract a field from an upstream result for binding into a kwarg.new_composition_runfunction — Validate a composition and build its run record.resolve_node_kwargsfunction — Materialize a node's kwargs by resolving itsOutputRefmarkers.validate_compositionfunction — Validate a composition and return its derived dependency map.
cjm_substrate.core.proxy
RemoteCapabilityProxyclass — Proxy that forwards capability calls to an isolated Worker subprocess.
cjm_substrate.core.queue
CancelPhaseclass — Phase of a cancellation in progress (CR-6 + CR-4 pairing).Jobclass — A queued capability execution request (CR-6 reshape; stage-3 compositionJobEventclass — A push-based job event (CR-6; stage-3 composition tags).JobEventTypeclass — Push-based job event types (CR-6; stage-3 composition rework; CR-14JobQueueclass — Resource-aware multi-lane job queue with journal-primary observabilityJobQueueDependenciesclass — Substrate dependencies the JobQueue requires (CR-6 + stage 3).JobStatusclass — Status of a job in the queue.QueueStatsclass — Aggregate counts returned byJobQueue.get_stats()(CR-6).ResourceSnapshotclass — Point-in-time resource usage for one job (CR-6 Stage 3).
cjm_substrate.core.scheduling
PermissiveSchedulerclass — Scheduler that allows all executions (Default / Dev Mode).ResourceSchedulerclass — Abstract base class for resource allocation policies.
cjm_substrate.core.secret_store
LocalSecretStoreclass — File-backed defaultSecretStore(0600 JSON undersecrets_dir).SecretStoreclass — Protocol for resolving per-capability secrets (API keys, tokens).delete_secretfunction — Remove a secret, pruning now-empty capability/scope containers.get_secretfunction — Resolve a secret value.list_keysfunction — Return the names of secrets stored for a capability (never the values).set_secretfunction — Persist a secret value.
cjm_substrate.core.wire
CallEnvelopeclass — Substrate-owned per-call identity + control block (CR-14 / CR-15).FileBackedDTOclass — Protocol for Data Transfer Objects that serialize to disk for zero-copy transfer.begin_account_capturefunction — Start a fresh account list for the current call span (worker endpointdrain_accountsfunction — Return + clear the current span's recorded accounts ([] outside a spanflat_from_dictfunction — Default reconstruction for FLAT wire DTOs (no nested-DTO fields).get_call_envelopefunction — The current call envelope, or None outside any call span.record_accountfunction — Record one substrate-family account for the current call span.reset_call_envelopefunction — Restore the prior envelope (always pair withset_call_envelopein finally).set_call_envelopefunction — Set the current call envelope; returns the token forreset_call_envelope.wire_decodefunction — Reconstruct a typed result from its tagged envelope (host side).wire_encodefunction — Wrap a registered wire DTO in its tagged envelope (worker side).wire_typefunction — Register a dataclass as a typed wire DTO underkind.
cjm_substrate.core.worker
EnhancedJSONEncoderclass — JSON encoder that handles dataclasses and other common types.create_appfunction — Create FastAPI app that hosts the specified capability.parent_monitorfunction — Monitor parent process and terminate self if parent dies.run_workerfunction — CLI entry point for running the worker.
cjm_substrate.utils.cache_paths
cache_dir_for_configfunction — Return (and optionally create) a per-(input-content, config) cache directory.list_cache_entriesfunction — Enumerate all per-config cache directories for a given (input, action).prune_cache_for_inputfunction — Delete per-config cache directories for(input, action), optionally
cjm_substrate.utils.hashing
hash_bytesfunction — Compute a hash of byte content.hash_dict_canonicalfunction — Hash a dict via canonical JSON encoding.hash_filefunction — Stream-hash a file without loading it entirely into memory.verify_hashfunction — Verify content against an expected hash string.
cjm_substrate.utils.validation
config_to_dictfunction — Convert a configuration dataclass instance to a dictionary.dataclass_to_jsonschemafunction — Convert a dataclass to a JSON schema for form generation.dict_to_configfunction — Create a configuration dataclass instance from a dictionary.extract_defaultsfunction — Extract default values from a configuration dataclass type.validate_configfunction — Validate all fields in a configuration dataclass against their metadata constraints.validate_field_valuefunction — Validate a value against field metadata constraints.
tests.test_adapter
test_base_protocol_slot_defaults_provisionalfunctiontest_concrete_impl_fills_the_shapefunctiontest_per_task_abc_keeps_its_abstract_setfunction
tests.test_adapter_manifest
test_exact_prefix_and_property_matches_are_compatiblefunctiontest_manifest_round_trip_and_kind_checkfunctiontest_missing_method_says_no_legiblyfunctiontest_missing_property_is_a_mismatchfunctiontest_param_less_old_format_falls_back_to_name_onlyfunctiontest_pre_fracture_surface_is_not_compatible_with_reasonfunctiontest_reordered_params_are_a_mismatchfunction
tests.test_bootstrap
test_normalize_spec_accepts_all_three_formsfunctiontest_normalize_spec_rejects_bad_formsfunctiontest_pipeline_context_manager_starts_and_stopsfunctiontest_pipeline_dataclass_shapefunction
tests.test_cache_paths
test_cache_dir_basic_determinism_and_config_keyingfunction — Same (input, action, config) → same dir; different config → different dir.test_create_false_returns_path_without_mkdirfunctiontest_hash_input_content_false_uses_the_path_stringfunction — hash_input_content=False hashes the path string (URL / non-file inputs).test_list_and_prune_companionsfunctiontest_modify_in_place_changes_the_cache_keyfunctiontest_same_stem_different_content_gets_distinct_keysfunction — Content hash distinguishes two same-stem files in different directories.test_sanitize_stem_edge_casesfunctiontest_sequence_chaining_auto_invalidates_downstreamfunction — When capability A's config changes, A's output content changes, so B'stest_skip_cache_bypasses_the_lookupfunctiontest_stat_cache_round_tripfunction
tests.test_capability
ApplyConfigCapabilityclass — Capability with the clean _apply_config seam.BaseDispatcherclassDispatchCapabilityclassExtendedDispatchCapabilityclassExtendedDispatcherclassFallbackCapabilityclass — No _apply_config — reconfigure must fall back to initialize(new).MinimalCapabilityclass — Concrete capability satisfying abstracts; relies on CR-4 default cleanup().RaisingTriggerCapabilityclassTriggerCapabilityclass — Capability that opts into the declarative RELOAD_TRIGGER pattern.WhisperTestConfigclass — Config dataclass with two RELOAD_TRIGGER-tagged fields sharing a trigger.test_cancel_callbacks_fire_in_order_every_timefunctiontest_cancel_flag_and_check_cancelfunctiontest_cancel_signal_to_registers_and_deregistersfunctiontest_capability_action_tags_without_wrappingfunctiontest_cleanup_and_prefetch_are_optional_no_opsfunctiontest_collect_capability_actions_walks_mrofunctiontest_config_options_default_is_emptyfunctiontest_config_options_override_and_asdict_round_tripfunctiontest_derive_structural_surfacefunctiontest_dispatch_to_action_routes_and_forwards_kwargsfunctiontest_dispatch_unknown_action_raises_typedfunctiontest_dispatch_walks_mro_for_inherited_handlersfunctiontest_env_var_spec_flavors_and_round_tripfunctiontest_execute_stream_default_wraps_executefunctiontest_fields_that_changedfunctiontest_heartbeat_advances_status_tuplefunctiontest_heartbeat_preserves_explicit_progressfunctiontest_heartbeat_thread_terminates_on_both_exitsfunctiontest_misbehaving_cancel_callback_is_skippedfunctiontest_reconfigure_delegates_to_triggersfunctiontest_reconfigure_two_phase_contractfunctiontest_reconfigure_with_triggersfunctiontest_report_progress_fast_path_without_lockfunctiontest_report_progress_safe_under_concurrencyfunctiontest_report_progress_uses_lock_inside_heartbeatfunctiontest_template_check_placeholders_validates_vocabularyfunctiontest_template_is_single_pass_non_recursivefunctiontest_template_missing_value_is_operator_errorfunctiontest_template_static_defaults_pass_throughfunctiontest_template_substitutes_placeholdersfunctiontest_template_unknown_placeholder_raises_with_contextfunction
tests.test_cli
test_adapters_entries_validatedfunction — Stage 6 J10: well-formed adapters pass; malformed flagged loudly.test_bad_config_schema_shape_flaggedfunctiontest_bad_drift_hash_type_flaggedfunctiontest_bad_env_vars_type_flaggedfunctiontest_basicconfig_lint_directory_scanfunction — force=True is an ERROR, plain basicConfig a WARNING, clean filestest_basicconfig_lint_single_file_comment_onlyfunction — Single-file mode; comment-only mentions don't fire.test_clean_manifest_produces_no_warningsfunctiontest_duplicate_capability_names_flaggedfunctiontest_format_detection_from_extensionfunctiontest_missing_capabilities_key_flaggedfunctiontest_missing_code_section_flaggedfunctiontest_missing_env_creation_source_flaggedfunctiontest_missing_format_version_rejects_loudfunction — The v1.0 flat shim was removed at SG-48; no format_version now rejects.test_missing_install_python_path_flaggedfunctiontest_missing_required_code_field_flaggedfunctiontest_non_dict_root_rejectedfunctiontest_resources_type_check_on_nested_layoutfunctiontest_t23_minimal_manifest_validfunctiontest_unrecognized_format_version_rejects_loudfunctiontest_v12_dropped_quantitative_resource_field_warnsfunctiontest_v1_whitespace_only_required_field_rejectedfunction — V1: whitespace-only description now rejected (was: only "" rejected).test_v4_single_element_enum_warns_not_errorsfunctiontest_valid_capabilities_yaml_passesfunctiontest_valid_v2_manifest_passesfunctiontest_worker_env_allowed_placeholders_validate_cleanfunction — Includes the T31-renamed CJM_CAPABILITY_DATA_DIR.test_worker_env_must_be_listfunctiontest_worker_env_old_cjm_data_dir_placeholder_rejectedfunction — T31: the OLD ${CJM_DATA_DIR} placeholder is no longer in the vocabulary.test_worker_env_unknown_placeholder_is_errorfunction
tests.test_config
test_cli_override_takes_effect_and_derived_paths_followfunctiontest_conda_binary_path_defaults_under_prefix_and_none_withoutfunctiontest_conda_binary_path_prefers_platform_binaries_mapfunctiontest_dataclass_creationfunctiontest_default_configuration_pathsfunctiontest_get_config_lazily_loads_and_cachesfunctiontest_substrate_config_flags_default_to_truefunctiontest_substrate_yaml_both_flags_disable_independentlyfunctiontest_substrate_yaml_missing_section_preserves_defaultsfunctiontest_substrate_yaml_single_flag_leaves_other_defaultfunctiontest_substrate_yaml_unknown_keys_ignoredfunction
tests.test_config_store
test_protocol_satisfaction_and_empty_store_safetyfunctiontest_record_round_trip_overwrite_and_deletefunction
tests.test_diagnostics_store
test_age_based_retention_leaves_newer_rowsfunctiontest_handler_stamps_contextvars_identityfunctiontest_normalize_stream_line_collapses_cr_framesfunctiontest_retention_on_missing_db_is_noopfunctiontest_size_budget_retention_deletes_oldest_firstfunctiontest_store_append_and_exact_job_correlationfunction
tests.test_empirical_store
test_compute_config_hash_canonicalizationfunctiontest_delete_record_and_empty_db_safetyfunctiontest_multi_instance_and_multi_config_keyingfunctiontest_sg54_api_usage_totals_accumulatefunctiontest_sg54_pre_migration_db_upgrades_in_placefunctiontest_welford_mean_max_of_peaks_and_success_ratefunction
tests.test_errors
test_classify_exception_defaultsfunctiontest_config_error_reparented_with_canonical_fields_invalidfunctiontest_map_bare_exception_to_job_error_structured_data_and_policyfunctiontest_mro_discipline_no_capability_error_extends_valueerrorfunctiontest_substrate_typed_exceptions_anchor_under_the_right_categoryfunctiontest_worker_oom_error_is_the_track_a_resource_signalfunction
tests.test_hashing
test_hash_bytes_custom_algorithmfunctiontest_hash_bytes_format_and_determinismfunctiontest_hash_dict_canonical_insertion_order_independencefunctiontest_hash_dict_canonical_none_and_nestingfunctiontest_hash_file_streams_and_matches_hash_bytesfunctiontest_verify_hash_roundtrip_and_tamper_detectionfunction
tests.test_journal_store
test_append_is_loud_on_storage_failurefunctiontest_append_query_roundtrip_and_cursorfunctiontest_liveness_routing_constantsfunctiontest_query_missing_db_and_count_zerofunctiontest_terminal_state_events_history_queryfunctiontest_unknown_event_types_roundtrip_untouchedfunction
tests.test_manager
test_cr10_execute_routes_by_instance_idfunction — execute / enable / disable route to the correct CapabilityInstance.test_cr10_generate_instance_idfunction — _generate_instance_id produces unique{name}-{6-char-hex}IDs.test_cr10_instance_queriesfunction — get_instance + list_instances filter correctly.test_cr10_unload_canonical_keeps_remaining_instancesfunction — Unloading the default instance with remaining multi-instances clearstest_cr10_validate_instance_idfunction — _validate_instance_id rejects malformed input.test_cr10b_async_wrappers_forward_to_syncfunction — load_capability_async / unload_capability_async run the sync versionstest_cr10b_load_capabilities_concurrentfunction — load_capabilities_concurrent fans out specs and returns instance_id dict.test_cr10b_max_concurrency_caps_in_flightfunction — max_concurrency caps simultaneous loads (semaphore enforces the cap).test_cr10b_partial_failure_semanticsfunction — fail_fast=False collects exceptions; fail_fast=True re-raises.test_cr10b_unload_capabilities_concurrentfunction — unload_capabilities_concurrent fans out and returns success/failure dict.test_cr12_worker_env_overlay_and_secret_actuationfunction — Overlay composition: unset secret OMITTED (not injected empty); visibletest_cr2_persistence_hooks_deferred_disablefunction — CapabilityConfigStore persistence + enable/disable hooks + deferred-on-disabletest_cr3_global_stats_async_typed_pathsfunctiontest_cr3_global_stats_typed_pathsfunctiontest_cr7_eviction_candidates_multi_axisfunction — _evict_for_resources no longer filters by requires_gpu (CR-7 multi-axis):test_cr7_max_retries_exhausted_raisesfunction — All retries fail → final CapabilityResourceError raised.test_cr7_no_retry_when_max_retries_zerofunction — max_retries=0 → no retry, first failure propagates without reload.test_cr7_no_sample_recording_when_store_absentfunction — Sample recording skipped silently when empirical_store is None.test_cr7_sample_recording_persistsfunction — Sample recording succeeds + persists; second execute folds via Welford.test_cr7_track_a_workeroom_reloadsfunctiontest_cr7_track_b_capability_resource_error_reloadsfunctiontest_gpu_subtree_attribution_sums_grandchildrenfunction — With a sysmon configured and a worker reporting subtree_pids, the sample'stest_gpu_subtree_attribution_without_sysmon_records_zerofunction — No sysmon configured → gpu_memory_mb_peak records as 0.0 (honest signal).test_phase5a_platform_query_filtersfunction — get_compatible_for_current_platform filters a synthetic discovered set;test_sg17_bind_returns_binding_with_defensive_copyfunctiontest_sg17_binding_forwards_to_managerfunction — CapabilityBinding forwards to a stub manager with capability_nametest_sg33_concurrent_limiter_created_and_cachedfunction — SG-33: per-instance asyncio.Semaphore created with the right cap + cached.test_sg5_validate_config_against_schemafunction — Strict mode rejects unknown keys; lenient mode filters + logs.
tests.test_manifest_format
test_config_schema_hash_canonical_deterministic_sensitivefunctiontest_manifest_to_dict_omits_unpopulated_optionalsfunctiontest_missing_format_version_legacy_flat_raisesfunctiontest_non_object_json_raisesfunctiontest_pre_surface_manifest_parses_to_nonefunctiontest_structural_surface_roundtrip_and_hash_determinismfunctiontest_unrecognized_format_version_raisesfunctiontest_v2_roundtrip_fully_populatedfunction
tests.test_metadata
test_capability_instance_defaults_and_tz_aware_created_atfunctiontest_capability_instance_multi_instance_differentiationfunctiontest_capability_meta_construction_and_equalityfunctiontest_phase_5a_resource_requirements_integrationfunction
tests.test_platform
test_conda_env_exists_false_for_nonexistentfunctiontest_current_platform_string_shapefunctiontest_exactly_one_os_detectedfunctiontest_get_conda_command_micromamba_local_prefixfunctiontest_get_conda_command_per_conda_typefunctiontest_get_micromamba_binary_path_resolutionfunctiontest_get_python_in_envfunctiontest_micromamba_download_url_unknown_platform_raisesfunctiontest_micromamba_urls_cover_all_platformsfunctiontest_popen_isolation_kwargsfunctiontest_run_shell_command_echofunctiontest_terminate_process_kills_live_childfunction
tests.test_ports
test_best_effort_lands_completed_despite_failuresfunctiontest_composition_model_shapefunctiontest_direct_member_cancel_lands_cancelledfunctiontest_empty_composition_immediately_terminal_completedfunctiontest_extract_output_field_attribute_and_loud_missesfunctiontest_extract_output_field_dict_key_and_whole_resultfunctiontest_fail_fast_derivation_failed_plus_skippedfunctiontest_failure_skips_transitive_dependents_housekeeping_cancel_stays_failedfunctiontest_parallel_fan_in_both_ready_immediatelyfunctiontest_pipe_progression_execution_time_bindingfunctiontest_record_result_requires_terminal_statefunctiontest_resolve_node_kwargs_replaces_markers_keeps_staticsfunctiontest_user_cancel_intent_dominates_failuresfunctiontest_validate_derives_edges_from_markersfunctiontest_validate_empty_composition_is_validfunctiontest_validate_rejects_cycles_including_self_referencefunctiontest_validate_rejects_duplicate_idsfunctiontest_validate_rejects_unknown_refsfunction
tests.test_proxy
DeathStubProxyclassFakeResponseclassHarvestStubProxyclassHeaderResponseclassListJournalclassStubProcessclasstest_chunk_cancellation_special_casefunctiontest_chunk_fatal_categoryfunctiontest_chunk_resource_category_with_shortfallfunctiontest_chunk_resource_category_without_shortfallfunctiontest_chunk_transient_categoryfunctiontest_chunk_unknown_category_is_forensic_runtime_errorfunctiontest_chunk_user_input_categoryfunctiontest_execute_paths_carry_track_a_checkfunctiontest_exit_code_death_classifies_as_transientfunctiontest_harvest_absent_header_is_noopfunctiontest_harvest_envelope_less_rows_stay_unattributedfunctiontest_harvest_journals_accounts_with_envelope_identityfunctiontest_harvest_malformed_header_never_raisesfunctiontest_sigkill_death_classifies_as_oomfunctiontest_sigsegv_death_classifies_as_transientfunctiontest_unary_fatal_job_error_raises_typedfunctiontest_unary_non_json_body_falls_back_to_runtime_errorfunctiontest_unary_prefix_worker_falls_back_to_runtime_errorfunctiontest_unary_resource_job_error_raises_typedfunctiontest_worker_alive_returns_silentlyfunctiontest_worker_already_cleaned_up_returns_silentlyfunction
tests.test_queue
AdmissionDepsclass — Driver fake with the stage-3 admission surface.FakeCancelCapabilityclass — Worker proxy fake with cooperative cancel + slow execute.FakeDepsclass — Minimal concrete fake satisfying JobQueueDependencies.FakeMetaclassFakeSysmonclass — CR-3 typed MonitorToolProtocol fake: get_system_status + list_processes.FakeWorkerProxyclass — Worker proxy fake: returns deterministic get_stats payload.ProxySysmonDepsclass — Driver fake supporting both worker-proxy + sysmon-capability lookups.RunCorrelationDepsclass — Driver fake that also captures the call envelope the queue set.Stage4Depsclass — Driver fake; exposes the _on_retry attribute slot used by start()/stop()TaskChannelDepsclasstest_block_reason_events_dedupefunctiontest_cancel_composition_before_dispatchfunctiontest_cancel_cooperative_success_phasesfunctiontest_cancel_force_kill_phasesfunctiontest_composition_pipe_bindingfunctiontest_disabled_capability_gate_at_submitfunctiontest_empty_composition_completes_at_submitfunctiontest_event_bus_composition_tag_routingfunctiontest_event_bus_multi_subscriber_fanoutfunctiontest_fail_fast_skips_dependentsfunctiontest_gpu_ledger_co_runs_within_budgetfunctiontest_gpu_ledger_serializes_over_budgetfunctiontest_journal_primary_emission_and_durable_historyfunctiontest_no_profile_job_runs_exclusivefunctiontest_parallel_nodes_co_runfunctiontest_per_instance_cap_defaults_to_onefunctiontest_per_instance_cap_opts_upfunctiontest_protocol_is_runtime_checkablefunctiontest_resource_snapshot_events_at_cadencefunctiontest_resource_snapshot_none_casesfunctiontest_resource_snapshot_with_sysmonfunctiontest_resource_snapshot_without_sysmonfunctiontest_retry_started_eventsfunctiontest_run_correlation_threadingfunctiontest_sg13_eviction_signals_waitersfunctiontest_structural_validation_at_submitfunctiontest_subscriber_keys_routingfunctiontest_task_channel_routingfunctiontest_wedge_gate_refuses_new_submissionsfunction
tests.test_scheduling
test_allocate_async_default_delegates_to_syncfunctiontest_permissive_scheduler_allows_everythingfunction
tests.test_secret_store
test_protocol_and_empty_readsfunctiontest_round_trip_perms_and_no_value_leakfunctiontest_scope_folds_into_on_disk_shape_without_touching_defaultfunction
tests.test_telemetry
test_cpu_only_capability_returns_zero_not_nonefunctiontest_dataclass_shaped_process_records_acceptedfunctiontest_grandchild_gpu_usage_is_attributedfunctiontest_missing_subtree_pids_falls_back_to_worker_onlyfunctiontest_multi_pid_subtree_sums_and_takes_highest_vram_gpu_indexfunctiontest_no_sysmon_returns_nonefunctiontest_sysmon_errors_return_nonefunction
tests.test_validation
ExampleConfigclass — Example configuration dataclass with metadata constraints.test_dataclass_to_jsonschema_structure_and_metadatafunctiontest_dict_to_config_validates_metadata_constraintsfunctiontest_extract_defaults_covers_plain_and_factory_defaultsfunctiontest_python_type_to_json_type_mappingfunctiontest_sg8_strict_rejects_unknown_keys_lenient_warns_and_filtersfunctiontest_validate_config_and_config_to_dictfunction
tests.test_wire
MockAudioDataclass — Example class implementing FileBackedDTO.test_accounts_accumulate_and_drain_oncefunctiontest_accounts_header_ascii_json_roundtripfunctiontest_duplicate_kind_guardfunctiontest_empty_or_absent_envelope_decodes_all_nonefunctiontest_envelope_contextvar_pairing_and_executor_thread_propagationfunctiontest_envelope_roundtrip_drops_none_fieldsfunctiontest_envelope_tolerant_decode_ignores_unknown_keysfunctiontest_executor_thread_shares_capture_listfunctiontest_file_backed_dto_protocol_detectionfunctiontest_flat_dto_roundtrips_typedfunctiontest_nested_dto_roundtrips_through_custom_from_dictfunctiontest_record_account_no_op_outside_capture_spanfunctiontest_subclass_not_encoded_under_parents_kindfunctiontest_transport_terminus_tolerancefunctiontest_unknown_kind_passes_through_envelope_intactfunctiontest_unregistered_objects_pass_through_unchangedfunctiontest_wire_type_requires_dataclassfunction
tests.test_worker
AcctRecordingCapabilityclass — execute records accounts (the T29 storage-helper shape).AcctTaskAdapterclass — Minimal task adapter: /task dispatch target for the TASK_ACCOUNT test.CancellingCapabilityclass — execute() raises CapabilityCancelledError to drive the 409 path.CancellingStreamCapabilityclass — execute_stream raises CapabilityCancelledError mid-stream — SG-52 typedEnvelopeCapabilityclass — Captures the contextvar AS SEEN INSIDE execute() (executor thread).FailingCapabilityclass — execute() raises a real RuntimeError — worker returns 500.FailingStreamCapabilityclass — execute_stream raises a bare RuntimeError — SG-52 typed error chunk withNotAMonitorCapabilityclass — NOT a monitor — lacks get_system_status / list_processes entirely.PrefetchCapabilityclass — Tracks prefetch + reconfigure invocations for endpoint verification.PrefetchRaisingCapabilityclass — prefetch() raises — worker returns 500 with detail.RaisingMonitorCapabilityclass — IS a monitor shape but raises NotImplementedError — a legacy monitorStreamCapabilityclass — execute_stream yields items normally; verifies SG-51's flag reset.test_accounts_ride_response_headerfunctiontest_call_envelope_reaches_executor_thread_and_never_leaksfunctiontest_enhanced_json_encoder_dataclassfunctiontest_enhanced_json_encoder_datetimefunctiontest_execute_cancellation_surfaces_as_409functiontest_execute_real_failure_stays_500_with_job_errorfunctiontest_monitor_endpoints_404_when_not_a_monitorfunctiontest_monitor_endpoints_501_when_opted_outfunctiontest_prefetch_and_reconfigurefunctiontest_prefetch_raising_returns_500functiontest_stream_cancellation_emits_typed_terminal_chunkfunctiontest_stream_failure_emits_typed_terminal_chunkfunctiontest_stream_resets_cancel_flag_before_iterationfunction
tests_manual.validate_stage7_observability_e2e
mainfunctionpart1_latencyfunctionpart2_wedgefunctionpart3_kill9functionpart4_retention_racefunctionpart5_late_subscriberfunction
Dependencies
Used by: cjm-context-graph-projection, cjm-markdown-decompose-core
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cjm_substrate-0.0.52.tar.gz
(282.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cjm_substrate-0.0.52.tar.gz.
File metadata
- Download URL: cjm_substrate-0.0.52.tar.gz
- Upload date:
- Size: 282.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0aad280f828a46f17ea5d612a472765e73a8bc1191f5f257884de19c033ed007
|
|
| MD5 |
db12a5a7d3cc95298970883bd4d9bee0
|
|
| BLAKE2b-256 |
745afae9a5525511724d151eac973dd02d9e4bb1af814d38a70c3f0b7a444767
|
File details
Details for the file cjm_substrate-0.0.52-py3-none-any.whl.
File metadata
- Download URL: cjm_substrate-0.0.52-py3-none-any.whl
- Upload date:
- Size: 207.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5e06e23aafe9baf9d111068a1c0d792c7228120b293e2b05b9dfcfc00e82b31
|
|
| MD5 |
21a8f8d70a652f1fcc61aef1c0e8d0f6
|
|
| BLAKE2b-256 |
29333307b89c24127eb64ed1a5bb242190dbbc85f7b898771589247eeddffae1
|