Skip to content

Config TOML rejects integer values for Double fields — fan curve points/hysteresis silently fall back to defaults #9

@GGGODLIN

Description

@GGGODLIN

Environment

  • smctl 0.1.8 (Homebrew), MacBook Pro (M5 Pro), macOS 26

Repro

A natural-looking custom curve in /etc/smctl/config.toml:

[[fan.curves]]
name = "test"
sensors = []
points = [[0, "max"], [105, "max"]]
hysteresis = 0

After sudo smctl daemon restart:

$ smctl fan profile test
Error: Fan profile 'test' is not configured.

The daemon log (os_log) shows the real cause:

Unable to parse /etc/smctl/config.toml: DecodingError.typeMismatch: expected value of type String.
Path: fan.curves[0].points[0][0]. Debug description: Cannot decode "String" from 0

and after fixing points, the same again for hysteresis:

DecodingError.keyNotFound: Key 'hysteresis' not found … A "Double" does not exist at "hysteresis" in the TOML table.

Writing every number as a float (0.0, 105.0, hysteresis = 0.0) works.

Cause

TOMLKit decodes strictly by TOML type: a TOML integer does not decode as Swift Double. FanPointValue.init(from:) tries Double → falls through to String → throws; hysteresis: Double similarly rejects integers.

Two suggestions

  1. Accept TOML integers wherever a Double is expected (try Int in the decoders), since points = [[50, 2000]] is what everyone will write first.
  2. Surface the parse error to the user: today the daemon logs it and silently runs on defaults, and the CLI only says "profile not configured". smctl daemon status showing last error: - while the config failed to parse is particularly misleading — a config parse failure should at least show up there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions