fix(flatpak): correct metered check in appstream refresh service - #1035
Open
HuntedRaven7 wants to merge 1 commit into
Open
fix(flatpak): correct metered check in appstream refresh service#1035HuntedRaven7 wants to merge 1 commit into
HuntedRaven7 wants to merge 1 commit into
Conversation
ExecCondition skipped NM_METERED_YES(1) and NM_METERED_NO(2), so an explicitly-unmetered connection 2 was never refreshed while a guessed-metered connection 3 was. NetworkManager's NMMetered docs say to treat NM_METERED_GUESS_YES(3) as metered and all else as unmetered. Skip only 1 and 3; keep 0/unknown fail-open. Moved to a case statement for clearer intent and to avoid future numeric miscomparisons. Closes projectbluefin#1027 Assisted-by: big-pickle (opencode) via GitHub Copilot Co-authored-by: big-pickle <big-pickle@opencode.ai>
HuntedRaven7
requested review from
ahmedadan,
castrojo,
hanthor,
inffy and
ledif
as code owners
August 28, 2026 10:35
hanthor
approved these changes
Aug 29, 2026
hanthor
left a comment
Member
There was a problem hiding this comment.
Correct fix, and the bug was real: the old condition [ "$v" != "1" ] && [ "$v" != "2" ] skipped the refresh for both NM_METERED_YES(1) and NM_METERED_NO(2) — meaning an explicitly-unmetered connection was being denied a refresh it should always get, while NM_METERED_GUESS_YES(3) (which NetworkManager's own docs say to treat as metered) fell through and refreshed anyway. The new case "$v" in 1|3) exit 1;; esac skips only on 1 and 3 and fail-opens (runs the refresh) for everything else, including unknown/empty $v on a busctl failure — matches NM's documented semantics exactly. CI green (test, Compose PR test image, validate, both arch builds).
Generated by Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ExecCondition skipped NM_METERED_YES(1) and NM_METERED_NO(2), so an explicitly-unmetered connection 2 was never refreshed while a guessed-metered connection 3 was. NetworkManager's NMMetered docs say to treat NM_METERED_GUESS_YES(3) as metered and all else as unmetered.
Skip only 1 and 3; keep 0/unknown fail-open. Moved to a case statement for clearer intent and to avoid future numeric miscomparisons.
Closes #1027
Assisted-by: big-pickle (opencode) via OpenCode