Skip to content

constants

Centralized constants for snakesee.

This module consolidates configuration constants and magic numbers used across multiple modules to ensure consistency and make tuning easier.

Configuration is organized into two modules:

  1. This module (constants.py): Runtime configuration
  2. RefreshRateConfig: TUI refresh rates
  3. CacheConfig: Caching behavior and TTLs
  4. FileSizeLimits: Security limits for file parsing

  5. snakesee.state.config: Estimation-specific configuration

  6. EstimationConfig: Time estimation parameters
  7. VarianceMultipliers: Variance settings per estimation method
  8. ConfidenceWeights: Confidence calculation weights
  9. ConfidenceThresholds: Decision thresholds
  10. TimeConstants: Time-related constants

Note: This module defines STALE_WORKFLOW_THRESHOLD_SECONDS (1800.0 seconds / 30 minutes), which is imported by state.config.TimeConstants.stale_workflow_threshold to ensure a single source of truth.

For estimation-specific configuration, see :class:snakesee.state.config.EstimationConfig.

Classes

CacheConfig dataclass

Configuration for caching behavior.

Attributes:

Name Type Description
default_tool_progress_ttl float

Default TTL for tool progress cache in seconds.

adaptive_ttl_multiplier float

Multiplier for adaptive cache TTL based on refresh rate.

max_cache_ttl float

Maximum cache TTL in seconds (cap for adaptive calculation).

exists_cache_ttl float

TTL for filesystem existence check cache in seconds.

Source code in snakesee/constants.py
@dataclass(frozen=True)
class CacheConfig:
    """Configuration for caching behavior.

    Attributes:
        default_tool_progress_ttl: Default TTL for tool progress cache in seconds.
        adaptive_ttl_multiplier: Multiplier for adaptive cache TTL based on refresh rate.
        max_cache_ttl: Maximum cache TTL in seconds (cap for adaptive calculation).
        exists_cache_ttl: TTL for filesystem existence check cache in seconds.
    """

    default_tool_progress_ttl: float = 5.0
    adaptive_ttl_multiplier: float = 2.5
    max_cache_ttl: float = 15.0
    exists_cache_ttl: float = 5.0

FileSizeLimits dataclass

Security limits for file sizes.

Attributes:

Name Type Description
max_metadata_file_size int

Maximum size in bytes for metadata files (10 MB).

max_events_line_length int

Maximum line length in bytes for events file (1 MB).

Source code in snakesee/constants.py
@dataclass(frozen=True)
class FileSizeLimits:
    """Security limits for file sizes.

    Attributes:
        max_metadata_file_size: Maximum size in bytes for metadata files (10 MB).
        max_events_line_length: Maximum line length in bytes for events file (1 MB).
    """

    max_metadata_file_size: int = 10 * 1024 * 1024
    max_events_line_length: int = 1 * 1024 * 1024

RefreshRateConfig dataclass

Configuration for TUI refresh rate.

Attributes:

Name Type Description
min_rate float

Minimum refresh rate in seconds (fastest).

max_rate float

Maximum refresh rate in seconds (slowest).

default_rate float

Default refresh rate in seconds.

Source code in snakesee/constants.py
@dataclass(frozen=True)
class RefreshRateConfig:
    """Configuration for TUI refresh rate.

    Attributes:
        min_rate: Minimum refresh rate in seconds (fastest).
        max_rate: Maximum refresh rate in seconds (slowest).
        default_rate: Default refresh rate in seconds.
    """

    min_rate: float = 0.5
    max_rate: float = 60.0
    default_rate: float = 1.0