Skip to content

fix(web): stop reporting "no update" when the update check could not run - #483

Closed
ChuckBuilds wants to merge 1 commit into
mainfrom
fix/update-check-reports-failure
Closed

fix(web): stop reporting "no update" when the update check could not run#483
ChuckBuilds wants to merge 1 commit into
mainfrom
fix/update-check-reports-failure

Conversation

@ChuckBuilds

Copy link
Copy Markdown
Owner

Follow-on from #482, same area, different failure. #482 explains checkouts that report an error; this one explains checkouts that report nothing at all.

The silence

check-update returns update_available: False whenever git fails:

if fetch_result.returncode != 0:
    logger.warning("check-update: git fetch failed ...")
    return jsonify(_safe)          # {'update_available': False, ...}

and the banner is the only route to the update button:

if (data.update_available && ...) { show banner } else { hide banner }

So a checkout git refuses to touch looks exactly like a current one, permanently — no banner, no button, no error, just a log line the user will never read.

Why a checkout ends up in that state

scripts/install/one-shot-install.sh:

  • clones into ${HOME}/LEDMatrix (line 283, 337)
  • never consults SUDO_USER — zero references
  • contains no chown at all — zero occurrences
  • and its own error text (line 192) suggests running the whole thing as root: sudo bash -c "$(curl -fsSL ...)"

Follow that suggestion and the checkout is root-owned. Tested on real hardware rather than assumed:

repo owner: root  | running git as: devpi

--- git status as the non-root user ---
fatal: detected dubious ownership in repository at '/tmp/ownt/repo'

--- git fetch (what check-update runs) ---
fatal: detected dubious ownership in repository at '/tmp/ownt/repo'

Every git command fails, including this endpoint's fetch. Nothing in the codebase handles safe.directory or dubious ownership — I checked.

What changes

A failed check now reports check_failed with a message the user can act on. For dubious ownership that means naming the actual remedy (sudo chown -R ...), because git's own suggestion — adding a safe.directory exception — would let git read the repo while leaving it owned by root, which is not what anyone wants here.

The banner shows that message rather than hiding itself, with the update button suppressed, since updating cannot succeed until the cause is fixed. Offline is distinguished from broken. The success path is untouched.

Scope

This does not fix the installer, which is the actual cause — it stops the symptom being invisible. The installer wants SUDO_USER handling and a chown, and the suggestion to run it as root should go. That is a separate change to a script I cannot exercise end to end from here, and it is worth doing deliberately rather than bundling.

Verification

Five tests driving the endpoint with a mocked failing fetch. Reverting the endpoint change fails four of them; the fifth guards the success path and correctly does not move. 292 tests pass.

Touches a different region of api_v3.py than #482, so the two are independent.

check-update returned update_available=False whenever git failed. The banner
is the only route to the update button, so a checkout git refuses to touch
looked exactly like a current one -- permanently, with nothing on screen to
act on and only a log line recording why.

The common cause is an install performed as root. scripts/install/one-shot-install.sh
clones into ${HOME}/LEDMatrix, never consults SUDO_USER, and contains no chown
at all, while its own error text suggests running the whole thing under sudo.
The result is a root-owned checkout, and on a rig this is what every git
command in it does:

    fatal: detected dubious ownership in repository at '...'

including the fetch this endpoint runs. Verified on real hardware rather than
assumed.

A failed check now reports check_failed with a message the user can act on --
for dubious ownership, the chown that fixes it. The banner shows that message
instead of hiding itself, with the update button suppressed since updating
cannot work until the cause is fixed. The success path is untouched.

This does not fix the installer, which is the real cause; it stops the symptom
being invisible. The installer needs SUDO_USER handling and a chown, and its
suggestion to run as root should go.

Reverting the endpoint change fails four of the five new tests; the fifth
guards the success path and correctly does not move.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STMbQE4YctTacQXfbYqKuW
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@ChuckBuilds, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 9 minutes

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

Wait for the limit to reset, then comment @coderabbitai review or push new commits to the PR.

An organization admin can change what happens after included review limits in Billing.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 02bb98ed-78b7-4a2d-b315-bcbf7094e514

📥 Commits

Reviewing files that changed from the base of the PR and between cf0a551 and ec8591e.

📒 Files selected for processing (3)
  • test/test_update_check_reports_failure.py
  • web_interface/blueprints/api_v3.py
  • web_interface/templates/v3/base.html

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@ChuckBuilds

Copy link
Copy Markdown
Owner Author

Superseded by #485, which combines the seven api_v3.py PRs so they do not conflict with each other. Every change from this PR is verified present on that branch; the branch here is untouched if you want to compare.

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