Skip to content

feat(targets): limit option flag values to specific releases - #154

Merged
pfeerick merged 6 commits into
masterfrom
feat/release-limited-flag-values
Nov 18, 2026
Merged

pfeerick merged 6 commits into
masterfrom
feat/release-limited-flag-values

Conversation

@pfeerick

@pfeerick pfeerick commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Why

Option flags and their values in targets.json apply to every release. #153 added AR to the colour LCD languages, but Arabic only exists from EdgeTX 3.0 (EdgeTX/edgetx#8031). As a result, cloudbuild and Buddy offer AR for v2.10–v2.12 colour builds, and those builds fail to compile, because TRANSLATIONS is only defined for languages in that release's RADIO_LANGUAGES.

The same problem affects older languages (v2.8.5 and v2.9.4 are still listed) and whole options that only exist in some releases.

What

Flag definitions, either global or under a tag, can now be limited to releases with semver constraints, the same way targets already are:

Field On Limits
version_supported a target (existing) the target
version_supported a flag the whole flag, i.e. every value in that definition
values_version_supported a flag individual values, as a map from value to constraint
"power_led_blue": {
  "build_flag": "POWER_LED_BLUE",
  "values": ["YES", "NO"],
  "version_supported": "< 3.0.0-0"
},
"language": {
  "values": ["AR", "CN", "HE", "JP", "KO", "SK", "TW"],
  "values_version_supported": { "AR": ">= 3.0.0-0", "HE": ">= 2.9.0-0", "KO": ">= 2.11.0-0" }
}

The two flag fields can be combined: a value is supported only if both allow the release.

  • Validation: a build request that uses a flag or value the release doesn't support is rejected with a 422, e.g. option flag not supported by release: language=AR requires release >=3.0.0-0, got v2.12.5.
  • API: each release exposes the values it excludes as exclude_flags (flag → values). It's computed at load time, the same way exclude_targets is. A whole-flag limit lists all of the flag's values, so clients drop the flag without any change.
  • Load check: a values_version_supported key that isn't in values fails the load, which catches typos.
  • UI: the job form hides excluded values for the selected release, and drops flags with no values left.
  • Error type: BuildRequestError now has Unwrap, so errors.Is works on it.
  • Docs: a new README section, "Limiting targets and flag values to releases", covers the fields and the -0 rule. doc/PublicAPI.md describes exclude_targets and exclude_flags for clients.

Use -0 in constraints (>= 3.0.0-0, < 3.0.0-0) so pre-releases follow the same rule as releases. Without it, a constraint never matches pre-releases. nightly (sem_ver v3.0.0) isn't a pre-release.

Limits in targets.json

Language limits come from RADIO_LANGUAGES and the translation headers present at each release tag. 2.12 added no new radio languages.

Flag / value Limit Why
language HE (colour) >= 2.9.0-0 added in 2.9
language RU, UA >= 2.10.0-0 added in 2.10
language KO (colour) >= 2.11.0-0 added in 2.11
language AR (colour) >= 3.0.0-0 added in 3.0 (EdgeTX/edgetx#8031)
power_led_blue < 3.0.0-0 POWER_LED_BLUE was removed on main
kcx_btaudio >= 3.0.0-0 added on main (EdgeTX/edgetx#6777, #7056), not in 2.12; on 2.12 CMake ignores it, so builds silently lack the feature

KO also moves from the global language list to the colorlcd tag. Korean support (EdgeTX/edgetx#6118, feat(color)) only added LVGL fonts, and there is no B&W Korean font, so B&W builds can't render it.

Compatibility

  • Old targets files: files without the new flag fields behave as before, and the API output is unchanged for them.
  • Old clients: clients that ignore the new fields (current Buddy releases) still show these flags and values. The server refuses the job, and Buddy displays the server's error message.
  • Deploy order: an older server binary ignores the new flag fields. Deploying this targets.json before the server update is harmless but doesn't enforce the limits.

Testing

I ran the build-n-test.yml jobs locally in Docker:

  • JSON/YAML validation
  • gofmt
  • golangci-lint v1.64.8
  • go test ./... against Postgres 13.3
  • npm run lint in ui/, plus npm run build

All pass. The new tests cover:

  • per-value constraints: release candidates, nightly, unknown release, global vs tag
  • whole-flag constraints, alone and combined with per-value ones
  • exclude_flags, JSON output, and invalid constraints
  • the build request errors
  • the real targets.json: each limited language, power_led_blue and kcx_btaudio against every listed release, and colour-only languages offered to colour targets only

Follow-up

The matching Buddy change is EdgeTX/buddy#158, which hides the values in exclude_flags for the selected release and drops flags with none left. It does nothing until this PR is deployed, so the two can merge in either order.

🤖 Generated with Claude Code

pfeerick and others added 2 commits November 17, 2026 20:22
…ints

Option flag definitions (global or per tag) can now carry
`value_constraints`, a map of value -> semver constraint. A constrained
value is only accepted for releases matching the constraint:

- build requests using it on other releases are rejected with
  "option flag not supported by release: <flag>=<value> requires release
  <constraint>, got <release>"
- each release exposes the values it excludes as `exclude_flags`,
  computed at load time like `exclude_targets`
- constraints on values not listed in `values` fail to load

targets.json limits AR (Arabic, colorlcd) to >= 3.0.0-0, since it does
not exist before EdgeTX 3.0 and older color builds fail to compile. The
UI hides excluded values for the selected release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Per EdgeTX's RADIO_LANGUAGES (radio/src/CMakeLists.txt):
- HE first appears in 2.9.0
- RU and UA first appear in 2.10.0
- KO first appears in 2.11.0

v2.8.5 and v2.9.4 are still offered, so builds with these languages on
older releases are now refused. 2.12 added no new radio languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Korean support (EdgeTX/edgetx#6118, "feat(color): ...") only added LVGL
fonts; there is no B&W (stdlcd) Korean font, so B&W builds can't render
it. Move KO from the global language values to the colorlcd tag, keeping
its >= 2.11.0-0 limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pfeerick added a commit to EdgeTX/buddy that referenced this pull request Nov 17, 2026
cloudbuild now reports, per release, the option flag values that release
cannot build as `exclude_flags` (EdgeTX/cloudbuild#154), e.g. the Arabic
language before EdgeTX 3.0. Expose it as `Release.excludeFlags` and drop
those values (and flags left with no values) from the cloud build flag
picker, the same way `excludeTargets` filters targets.

Servers that don't send `exclude_flags` yet yield an empty list, so
nothing is hidden.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pfeerick
pfeerick marked this pull request as ready for review November 18, 2026 05:22
pfeerick and others added 3 commits November 18, 2026 15:36
Use the same name for flag value limits as for target limits, so
targets.json reads consistently: `version_supported` is a constraint on a
target, and a map from value to constraint on a flag.

Document version_supported, exclude_targets and exclude_flags in the
README and the public API doc, including the `-0` rule for constraints
that should match pre-releases and how to remove a whole flag from some
releases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m 3.0

A flag's `version_supported` is now a single constraint for the whole
flag, like a target's, so a flag can be removed from some releases
without listing every value. Per-value limits move to
`values_version_supported`. The two can be combined: a value is supported
only if both allow the release.

A flag with every value excluded is reported in exclude_flags with all
its values, so clients drop it without any change.

POWER_LED_BLUE was removed in EdgeTX 3.0, so limit power_led_blue to
releases before 3.0.0 (nightly included in the exclusion).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KCX_BTAUDIO was added to the TX15 and TX16S MK3 targets on main
(EdgeTX/edgetx#6777, #7056) and isn't in any 2.12 release; the 2.12.6
backports (EdgeTX/edgetx#8070) note it's main-only. On 2.12, CMake
ignores the unknown option, so the build succeeds without the feature.
Limit the flag to releases from 3.0.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pfeerick
pfeerick merged commit e5b08a8 into master Nov 18, 2026
5 checks passed
@pfeerick
pfeerick deleted the feat/release-limited-flag-values branch November 18, 2026 05:58
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.

1 participant