Skip to content

sunnylink: regenerate settings_ui.json (restores the Ford pinion toggle)#152

Merged
alan-polk merged 1 commit into
BluePilotDev:bp-devfrom
jrneulight:bp-7.0-settings-regen
Jul 20, 2026
Merged

sunnylink: regenerate settings_ui.json (restores the Ford pinion toggle)#152
alan-polk merged 1 commit into
BluePilotDev:bp-devfrom
jrneulight:bp-7.0-settings-regen

Conversation

@jrneulight

Copy link
Copy Markdown
Contributor

sunnylink: regenerate settings_ui.json (restores the Ford pinion toggle)

The bp-dev merge in #145 hand-resolved the settings_ui.json conflict and fused two
adjacent toggle objects into one. The feature itself merged correctly — only its remote
settings entry disappeared. This regenerates the file from its source.

The evidence that motivated this

settings_ui.json on current bp-dev contains this (abridged):

{
  "key": "FordPrefSteerAngleCurvature",
  "title": "[Vehicle] Use Pinion Yaw Sensor",
  "description": "...",
  "key": "BPUseCustomSounds",          <-- second key, same object
  "title": "[Audio] Use Custom Engage/Disengage Sounds",
  "enablement": [{ "type": "offroad_only" }]
}

FordPrefSteerAngleCurvature opened an object, then BPUseCustomSounds' keys were
appended into that same object instead of starting a new one. JSON permits duplicate
keys and the last one wins, so:

  • the file still parses,
  • it still greps as containing both toggle names,
  • but once parsed, the pinion toggle is gone from the sunnylink settings UI, and it
    took its offroad_only enablement with it.

That combination is why it survived review: every cheap check passes. It only shows up
when you parse the file and look for the key, or when you run the compiler in --check
mode.

Confirming on current bp-dev:

FordPrefSteerAngleCurvature: MISSING
BPUseCustomSounds:           PRESENT

Why the fix is shaped this way

settings_ui.json is a generated artifact — sunnypilot/sunnylink/tools/compile_settings_ui.py
emits it from the authoring tree in settings_ui_src/. The YAML source
(settings_ui_src/pages/vehicle.yaml) was resolved correctly during the merge and still
holds both toggles as separate, complete entries.

So this is not a hand-patch of the JSON. It is one run of the compiler, committing what
it emits. Hand-editing generated output is what produced the bug in the first place.

The evidence afterwards

  • tools/compile_settings_ui.py --check reports a match. Before this commit it reported
    differs from compiled output.
  • sunnypilot/sunnylink/tests/ goes from 2 failed / 75 passed to
    77 passed / 1 skipped. The two failures were
    TestRoundtrip::test_committed_file_is_canonical and
    TestSchemaCoverage::test_all_schema_keys_exist_in_params.
  • Parsing the result finds all three toggles with their enablement intact:
    FordPrefSteerAngleCurvature[offroad_only], BPUseCustomSounds
    [offroad_only], BPCustSoundsSelection[offroad_only, param BPUseCustomSounds].
  • The diff is +7 lines: the closing brace, enablement block, and opening brace that
    separate the two objects. No content is added or removed.

What each change is

One commit, one generated file. No source, schema, or behaviour changes.

Test it yourself

# before this PR this reports "differs from compiled output"
python sunnypilot/sunnylink/tools/compile_settings_ui.py --check

pytest sunnypilot/sunnylink/tests/ -n0

# the direct check: is the toggle actually there once parsed?
python -c "
import json
d = json.load(open('sunnypilot/sunnylink/settings_ui.json'))
def walk(o):
    if isinstance(o, dict):
        if isinstance(o.get('key'), str): yield o['key']
        for v in o.values(): yield from walk(v)
    elif isinstance(o, list):
        for v in o: yield from walk(v)
print('FordPrefSteerAngleCurvature' in list(walk(d)))
"

Risks / limits

  • Generated-file-only change; nothing else moves.
  • Unrelated pre-existing issue, deliberately left alone: validate_settings_ui.py still
    reports duplicate keys: 'BlinkerMinLateralControlSpeed' in [steering, vehicle_settings.ford]. That key is declared in both steering.yaml and
    vehicle.yaml on stock bp-dev and predates this work — worth a separate fix.
  • Worth considering separately: a CI step running compile_settings_ui.py --check would
    have caught this at the merge, since the failure mode is invisible to review.

The bp-dev merge in BluePilotDev#145 resolved the settings_ui.json conflict by hand and fused
two adjacent toggle objects into one: FordPrefSteerAngleCurvature kept its opening
brace, then BPUseCustomSounds' keys were appended into the same object instead of
starting a new one.

JSON allows duplicate keys and the last wins, so the file still parsed and still
grepped as containing both toggle names -- but once parsed, the pinion toggle was
gone from the sunnylink settings UI along with its offroad_only enablement. The
feature itself merged fine; only its remote settings entry disappeared.

settings_ui.json is generated from settings_ui_src/ by
tools/compile_settings_ui.py. The YAML source is correct and was never affected,
so this simply regenerates the committed artifact from it.

Verified: tools/compile_settings_ui.py --check now matches (it did not before), and
sunnypilot/sunnylink/tests/ goes from 2 failed / 75 passed to 77 passed / 1 skipped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants