constants
constants
¶
Global constants for Marianne.
Centralizes magic numbers used throughout the codebase, making them discoverable, consistent, and easy to modify.
Attributes¶
SHEET_NUM_KEY
module-attribute
¶
Standard key for sheet number in dicts and serialised state.
TERMINOLOGY_ALIASES
module-attribute
¶
TERMINOLOGY_ALIASES = {'movement': 'stage', 'voice': 'instance', 'voice_count': 'fan_count', 'total_movements': 'total_stages'}
New-vocabulary key -> legacy alias key for sheet position built-ins.
DEFAULT_INSTRUMENT_NAME
module-attribute
¶
Filename for the per-workspace SQLite state database (#245).
Centralizes a literal that was previously hand-constructed in 8+ path
expressions across cli/, daemon/, execution/, and core/config/. Construct the
path as workspace / STATE_DB_FILENAME so the filename has a single source of
truth.
DAEMON_STATE_DB_PATH
module-attribute
¶
Path to the conductor's registry/state SQLite database (#312).
Centralizes a literal previously hand-constructed in 4 sites: the reserved
DaemonConfig.state_db_path default, the reserved-field warning baseline in
daemon/process.py, and the two functional conductor-down readers in
cli/helpers.py and cli/commands/recover.py. Tilde is expanded at the
point of use (DAEMON_STATE_DB_PATH.expanduser()); the constant itself keeps
the ~ form so it matches the config default verbatim.
Note: this only deduplicates the literal. Config-driven override of the path
remains a deliberately deferred feature — state_db_path is documented as
reserved and logs a warning when set.
VALIDATION_PASS_RATE_KEY
module-attribute
¶
Standard key for validation pass rate in checkpoint/job data.
TRUNCATE_STDOUT_TAIL_CHARS
module-attribute
¶
Default truncation limit for stdout/stderr tails in error display and state.
STRUCTURED_OUTPUT_MAX_BYTES
module-attribute
¶
Largest validated structured_output object kept on the sheet record (GH #489).
Measured as compact JSON. A larger object is not stored (a cut JSON object
cannot be parsed) and SheetState.structured_output_omitted is set instead.
HEALING_CONTEXT_TAIL_CHARS
module-attribute
¶
Maximum stdout/stderr characters captured for self-healing diagnostic context.
RATE_LIMIT_REQUESTS_PER_MINUTE
module-attribute
¶
Maximum requests per minute for API rate limiting.
RATE_LIMIT_REQUESTS_PER_HOUR
module-attribute
¶
Maximum requests per hour for API rate limiting.
RATE_LIMIT_BURST_LIMIT
module-attribute
¶
Maximum burst requests in a short window.
SSE_QUEUE_TIMEOUT_SECONDS
module-attribute
¶
Timeout for SSE event queue reads.
STREAM_CHUNK_SIZE
module-attribute
¶
Default chunk size for stream reads (4 KB).
FILE_HASH_CHUNK_SIZE
module-attribute
¶
Chunk size for file hashing operations (8 KB).
VALIDATION_COMMAND_TIMEOUT_SECONDS
module-attribute
¶
Timeout for user-defined validation commands (1 hour).
VALIDATION_OUTPUT_TRUNCATE_CHARS
module-attribute
¶
Maximum characters for validation command output summaries.
RESET_TIME_MINIMUM_WAIT_SECONDS
module-attribute
¶
Minimum wait time for reset-based rate limit delays (5 minutes).
RESET_TIME_MAXIMUM_WAIT_SECONDS
module-attribute
¶
Maximum wait time for parsed rate limit delays (24 hours).
Safety cap: without this, adversarial or malformed API responses like
'resets in 999999 hours' would schedule timers for years, effectively
blocking the instrument forever with no auto-recovery. 24 hours is the
longest any real API provider rate limit should last. If it's longer,
the operator can re-trigger via mzt clear-rate-limits.
DEFAULT_QUOTA_WAIT_SECONDS
module-attribute
¶
Default wait time when quota exhaustion is detected but no reset time parsed.
DEFAULT_RATE_LIMIT_WAIT_SECONDS
module-attribute
¶
Default wait time for generic rate limit detections.
Functions:¶
positional_template_variables
¶
Build the positional built-ins under BOTH vocabularies (GH #267).
The single place that knows the new names and their legacy aliases, so
Sheet.template_variables and SheetContext.to_dict cannot drift.