Skip to content

fix(config): don't flip explicit false booleans via jq // (#265) - #280

Merged
VijitSingh97 merged 3 commits into
developfrom
fix/265-jq-false-flip
Jul 17, 2026
Merged

VijitSingh97 merged 3 commits into
developfrom
fix/265-jq-false-flip

Conversation

@VijitSingh97

Copy link
Copy Markdown
Contributor

Summary

jq's // (alternative) operator treats false the same as null/missing, so every X // true default silently rewrote an operator's explicit false back to true. Fixed the four affected sites by switching to a has()-guarded idiom (explicit value — including a bogus one, which still hits existing validation — passes through untouched; an absent key still defaults to true):

  • rigforge.sh (parse_config pool normalization): keepalive and enabled now use if has("keepalive"/"enabled") then .field else true end.
  • rigforge.sh _seed_g (tune seed for randomx."1gb-pages"): same has() guard.
  • rigforge.sh _seed_wr (tune seed for randomx.wrmsr): same has() guard, kept the existing array/type-filter tail unchanged.

Sites intentionally left alone: .tls // false, _seed_hj/_seed_cq (// false), .cpu.yield // false, and all string/number defaults — false // false is false, so a // false default was never affected.

Tests added (tests/run.sh)

  1. parse_config: pools[0] with "enabled": false, "keepalive": false keeps both false in the generated POOLS_JSON.
  2. parse_config: "enabled": "yes" still fails validation with Pool enabled must be true or false — proves the has() change doesn't bypass the existing boolean check.
  3. Tune seeds: _seed_wr/_seed_g keep an explicit base-config false, and still default to true when the key is absent.

Verified the new tests fail against the unfixed code (reproduced red, then green after the fix). Full suite: make test (lint + 1339 tests) — 0 failures.

Closes #265

🤖 Generated with Claude Code

…ed/keepalive, tune seeds)

jq's `//` treats `false` the same as null/missing, so `.enabled // true` and
similar defaults silently rewrote an operator's explicit `false` back to
`true`. This hit four sites: parse_config's pool keepalive/enabled
normalization, and the tune seed helpers _seed_g (1gb-pages) and _seed_wr
(wrmsr). A parked failover pool with "enabled": false mined anyway, and a
base config with wrmsr/1gb-pages false was benchmarked as if true.

Switch each site to a has()-guarded idiom so an explicit value (including a
bogus one, which still hits the existing true|false validation) passes
through untouched, while an absent key still defaults to true.

Closes #265.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@VijitSingh97
VijitSingh97 enabled auto-merge (squash) July 17, 2026 02:32
VijitSingh97 and others added 2 commits July 16, 2026 21:39
…cov patch gate)

The has() edits inside the multi-line jq map can never be attributed by
kcov, failing the patch-coverage gate. Revert the map to its original
form and restore explicit keepalive/enabled falses in a second
single-line pass instead, the same pattern the #115 tls-fingerprint
re-attach uses (see the comment there). Semantics are unchanged: only a
boolean false matches `== false`, and non-boolean junk still flows
through to the existing validation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@VijitSingh97
VijitSingh97 merged commit c062b3c into develop Jul 17, 2026
9 checks passed
@VijitSingh97
VijitSingh97 deleted the fix/265-jq-false-flip branch July 17, 2026 03:04
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.

parse_config/tune: jq '//' silently flips explicit false booleans to true (pool enabled/keepalive, tune seeds)

1 participant