Skip to content

feat(cloudbuild): hide flag values the selected release doesn't support - #158

Merged
pfeerick merged 3 commits into
mainfrom
feat/cloudbuild-exclude-flags
Nov 18, 2026
Merged

pfeerick merged 3 commits into
mainfrom
feat/cloudbuild-exclude-flags

Conversation

@pfeerick

@pfeerick pfeerick commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Why

Cloudbuild offers some option flag values to releases that can't build them. For example, the Arabic (AR) language is offered for v2.10–v2.12 colour builds, but it only exists from EdgeTX 3.0, so those builds fail to compile.

EdgeTX/cloudbuild#154 lets cloudbuild limit flag values to specific releases. Each release in /api/targets now lists the values it can't build:

"v2.12.5": { "exclude_flags": { "language": ["AR"] } }

Cloudbuild also refuses such jobs with an error message. This PR makes Buddy hide those values, so users can't pick them in the first place.

What

  • Release in services/cloudbuild.ts gains exclude_flags.
  • The GraphQL Release type gains excludeFlags: [ExcludedFlag] (name, values), mapped from exclude_flags. It's an empty list when the server doesn't send the field. It's deliberately not the existing Flag type: Apollo normalizes objects with an id, so { id: "language", values: ["AR"] } would overwrite the real language flag in the cache and make it disappear.
  • CloudFirmwareReleasesPicker removes the selected release's excluded values from the flag list, and drops a flag if no values remain. This works the same way as the existing excludeTargets filter. CloudVersionTargetForm already clears a selected value that's no longer offered, so switching to an older release clears it on its own.

Compatibility / merge order

Until EdgeTX/cloudbuild#154 is deployed, the server doesn't send exclude_flags, so this change hides nothing. The existing recorded-fixture test exercises exactly that case. It's safe to merge in either order, but it only takes effect once cloudbuild is updated.

Testing

  • cloudbuild.spec.ts: the fixture test now selects excludeFlags, which is empty for the old response. A new test checks that exclude_flags is mapped per release. All 4 tests pass in lockdown mode.
  • New CloudFirmwareReleasesPicker.spec.tsx (with __typename in the mocked response, so Apollo caches as in the app and the Flag collision above is caught): for a release with exclusions, the excluded values are hidden and a flag left with no values is dropped. For a release without exclusions, everything is offered. Before this, the picker had no test at all.
  • ESLint, Prettier and yarn test:types are clean.
  • In a clean Node 22 container with yarn --immutable: lint:all, fmt:check, test:types and the full yarn test (289 tests) all pass.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 36.87%. Comparing base (ae3d432) to head (a042078).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #158      +/-   ##
==========================================
+ Coverage   36.34%   36.87%   +0.53%     
==========================================
  Files         116      116              
  Lines        4287     4301      +14     
  Branches     1037     1038       +1     
==========================================
+ Hits         1558     1586      +28     
+ Misses       2522     2509      -13     
+ Partials      207      206       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

pfeerick and others added 2 commits November 17, 2026 22:09
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>
…picker

Check that CloudFirmwareReleasesPicker removes the values the selected
release excludes, drops flags left with no values, and keeps everything
for a release without exclusions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

EdgeTX Buddy has been automatically deployed to Cloudflare.
✅ Preview: https://9e9165d2.buddy-7a6.pages.dev
✅ Storybook: https://9e9165d2.buddy-7a6.pages.dev/storybook

Release.excludeFlags reused the GraphQL Flag type, which has an `id`.
Apollo normalizes objects by __typename and id, so a release's
`{ id: "language", values: ["AR"] }` and the actual language flag became
the same cache entry (Flag:language). The language flag ended up with
only AR, which the release then excluded, so the flag disappeared from the
picker (e.g. TX12 on v2.12.5). Every release's exclusions for a flag also
shared one entry.

Use a separate ExcludedFlag type keyed by `name`, which Apollo stores
inside each release. The picker test now keeps __typename in its mocked
response, like the real server, which reproduces the bug without the fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pfeerick
pfeerick marked this pull request as ready for review November 18, 2026 07:41
@pfeerick
pfeerick merged commit 96e3f9f into main Nov 18, 2026
18 checks passed
@pfeerick
pfeerick deleted the feat/cloudbuild-exclude-flags branch November 18, 2026 07:45

This branch was successfully deployed

1 active deployment
preview — a0420786 Deployed Nov 18, 2026 by github-actions[bot]
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