babylon.engine.headless_runner.manifest
Build manifest.json — the artifact-bundle reproducibility fingerprint.
Spec: 064-headless-sim-runner (T027).
The manifest follows contracts/manifest_json_schema.yaml and exposes:
schema_version— locked literal “1.0”generator— tool name, babylon version, git SHA, python version, partial flagfiles— per-artifact name + schema_ref + sha256 + size + optional row_countreproducibility— deterministic_inputs + non_deterministic_inputs + input_hashcolumn_dictionaries— inlined 22-column dictionary mirroring trace_csv_schema.yaml
input_hash is the SHA-256 of canonical-JSON-serialized
deterministic_inputs; two runs with the same hash MUST produce
byte-identical trace.csv and summary.json (modulo declared wallclock /
hostname fields).
Module Attributes
Inlined column dictionary mirroring trace_csv_schema.yaml. |
Functions
|
Construct the manifest payload as a plain dict. |
|
SHA-256 of canonical JSON serialization of |
Public helper, used by tests. |
- babylon.engine.headless_runner.manifest.TRACE_COLUMN_DICT: tuple[dict[str, Any], ...] = ({'name': 'tick', 'nullable': False, 'semantics': 'Zero-indexed tick.', 'type': 'int', 'units': 'weekly_tick'}, {'name': 'simulated_year', 'nullable': False, 'semantics': 'start_year + tick/52.', 'type': 'float', 'units': 'calendar_year'}, {'name': 'entity_id', 'nullable': False, 'semantics': '5-digit FIPS / canonical short name.', 'type': 'str', 'units': 'id'}, {'name': 'entity_kind', 'nullable': False, 'semantics': 'county | external | national | hex_aggregate.', 'type': 'str', 'units': 'enum'}, {'applies_to': ['county', 'national', 'hex_aggregate'], 'name': 'v', 'nullable': True, 'semantics': 'Variable capital this tick.', 'type': 'float', 'units': 'USD/week'}, {'applies_to': ['county', 'national', 'hex_aggregate'], 'name': 'c', 'nullable': True, 'semantics': 'Constant capital consumed.', 'type': 'float', 'units': 'USD/week'}, {'applies_to': ['county', 'national', 'hex_aggregate'], 'name': 's', 'nullable': True, 'semantics': 'Surplus value extracted.', 'type': 'float', 'units': 'USD/week'}, {'applies_to': ['county', 'national', 'hex_aggregate'], 'name': 'k', 'nullable': True, 'semantics': 'Accumulated capital stock.', 'type': 'float', 'units': 'USD/stock'}, {'applies_to': ['county'], 'name': 'p_acquiescence', 'nullable': True, 'semantics': 'P(S|A).', 'type': 'float', 'units': 'prob'}, {'applies_to': ['county'], 'name': 'p_revolution', 'nullable': True, 'semantics': 'P(S|R).', 'type': 'float', 'units': 'prob'}, {'applies_to': ['county'], 'name': 'ideology_r', 'nullable': True, 'semantics': 'Reactionary weight.', 'type': 'float', 'units': 'simplex'}, {'applies_to': ['county'], 'name': 'ideology_l', 'nullable': True, 'semantics': 'Liberal weight.', 'type': 'float', 'units': 'simplex'}, {'applies_to': ['county'], 'name': 'ideology_f', 'nullable': True, 'semantics': 'Front weight.', 'type': 'float', 'units': 'simplex'}, {'applies_to': ['county'], 'name': 'surveillance_coupling', 'nullable': True, 'semantics': 'State surveillance coupling.', 'type': 'float', 'units': 'ratio'}, {'applies_to': ['county'], 'name': 'internet_access_pct', 'nullable': True, 'semantics': 'Broadband-population fraction.', 'type': 'float', 'units': 'ratio'}, {'applies_to': ['county'], 'name': 'biocapacity_stock', 'nullable': True, 'semantics': 'Remaining biocapacity.', 'type': 'float', 'units': 'abstract'}, {'applies_to': ['county'], 'name': 'energy_stock', 'nullable': True, 'semantics': 'Remaining energy stock.', 'type': 'float', 'units': 'abstract'}, {'applies_to': ['county'], 'name': 'raw_material_stock', 'nullable': True, 'semantics': 'Remaining raw material stock.', 'type': 'float', 'units': 'abstract'}, {'applies_to': ['county', 'national'], 'name': 'profit_rate', 'nullable': True, 'semantics': 's/(c+v).', 'type': 'float', 'units': 'ratio'}, {'applies_to': ['county', 'national'], 'name': 'exploitation_rate', 'nullable': True, 'semantics': 's/v.', 'type': 'float', 'units': 'ratio'}, {'applies_to': ['county'], 'name': 'population', 'nullable': True, 'semantics': 'Resident population.', 'type': 'int', 'units': 'persons'}, {'applies_to': ['county'], 'name': 'employment_proxy', 'nullable': True, 'semantics': 'QCEW-derived employment proxy.', 'type': 'float', 'units': 'FTE'})
Inlined column dictionary mirroring trace_csv_schema.yaml. Embedded here so LLM consumers can parse trace.csv without fetching external schema files.
- babylon.engine.headless_runner.manifest.build_manifest(*, config, session_id, exit_reason, wallclock_start, wallclock_end, artifact_dir, artifact_files, defines_hash, data_versions, engine_systems_invoked=None, bridge_db_reads=None, storage=None, economics_fallbacks=None)[source]
Construct the manifest payload as a plain dict.
- Parameters:
config (
SimulationRunConfig) – TheSimulationRunConfigdriving the run.session_id (
str) – UUID string for this run.exit_reason (
ExitReason) – How the run terminated.wallclock_start (
datetime) – Run start time (UTC).wallclock_end (
datetime) – Run end time (UTC).artifact_dir (
Path) – Where the bundle is being written.artifact_files (
list[tuple[str,str,int,int|None]]) – List of(name, schema_ref, size_bytes, row_count)tuples;row_countis None for non-CSV files.defines_hash (
str) – SHA-256 over the canonical GameDefines serialization.data_versions (
dict[str,Any]) – Reference-data vintages (TIGER year, LODES max year, etc.). Free-form; all entries land indeterministic_inputs.engine_systems_invoked (
list[str] |None) – Ordered list of engine system class names actually executed during the run (spec-065 T081 / spec-066 T036). Empty list when the engine is not wired.bridge_db_reads (
dict[str,int] |None) – Spec-069 SC-002 instrumentation block. If provided, emitted as a top-levelbridge_db_readskey with{population_db_reads, employment_db_reads, total_db_reads}. Omit when running a non-bridged path.storage (
dict[str,Any] |None) – Spec-087 FR-009 storage-footprint block (seebabylon.engine.headless_runner.storage_probe.build_storage_block()). Best-effort —None(collection failed / non-Postgres path) omits the key entirely.economics_fallbacks (
dict[str,Any] |None) – C.8 (spec 2.R) loud-observability block —babylon.engine.services.EconomicsFallbackTally.to_dict()output attesting whether TickDynamicsSystem computed gamma/MELT from wired calculators or fell back to hardcoded coefficients.Noneomits the key (non-bridged / pre-C.8 path).
- Return type:
- Returns:
Dict ready to be JSON-encoded as manifest.json.